mirror of https://github.com/jeecgboot/jeecg
jeecg_3.7.1版本发布 - 20170918
parent
7a8209da66
commit
910fc46209
|
@ -1,7 +1,7 @@
|
|||
JEECG 微云快速开发平台
|
||||
===============
|
||||
|
||||
当前最新版本: 3.7(发布日期:20170420)
|
||||
当前最新版本: 3.7.1(发布日期:20170918)
|
||||
|
||||
前言:
|
||||
-----------------------------------
|
||||
|
@ -80,6 +80,7 @@ JEECG
|
|||
技术文档
|
||||
-----------------------------------
|
||||
* [JEECG 开发环境搭建入门](http://blog.csdn.net/zhangdaiscott/article/details/50915206)
|
||||
* [JEECG maven本地仓库下载](http://git.oschina.net/jeecg/jeecg-local-maven)
|
||||
* [JEECG 开发手册](http://git.oschina.net/jeecg/jeecg/attach_files)
|
||||
* [JEECG 常见问题贴](http://www.jeecg.org/forum.php?mod=viewthread&tid=1830&extra=page%3D1)
|
||||
* [JEECG 视频教程](http://www.jeecg.org/forum.php?mod=viewthread&tid=197&extra=page%3D1)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because one or more lines are too long
207
pom.xml
207
pom.xml
|
@ -3,11 +3,11 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>jeecg</artifactId>
|
||||
<version>3.7</version>
|
||||
<version>3.7.1</version>
|
||||
<packaging>war</packaging>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<codegenerate.version>3.6.1-SNAPSHOT</codegenerate.version>
|
||||
<codegenerate.version>3.6.2</codegenerate.version>
|
||||
<minidao.version>1.6-SNAPSHOT</minidao.version>
|
||||
|
||||
<guava.version>16.0.1</guava.version>
|
||||
|
@ -44,7 +44,7 @@
|
|||
<commons-beanutils.version>1.7.0</commons-beanutils.version>
|
||||
<commons-collections.version>3.2.1</commons-collections.version>
|
||||
<commons-chain.version>1.2</commons-chain.version>
|
||||
<commons-codec.version>1.6</commons-codec.version>
|
||||
<commons-codec.version>1.9</commons-codec.version>
|
||||
<commons-digester.version>2.0</commons-digester.version>
|
||||
<commons-io.version>1.3.2</commons-io.version>
|
||||
<commons-fileupload.version>1.2.1</commons-fileupload.version>
|
||||
|
@ -69,8 +69,11 @@
|
|||
<commons-dbcp.version>1.4</commons-dbcp.version>
|
||||
<druid.version>0.2.9</druid.version>
|
||||
<mysql.version>5.1.27</mysql.version>
|
||||
<!-- sqlserver2005 -->
|
||||
<!-- sqlserver2005
|
||||
<sqlserver.version>4.0</sqlserver.version>
|
||||
-->
|
||||
<!-- sqlserver2005 -->
|
||||
<sqlserver.version>1.0.0</sqlserver.version>
|
||||
<!-- oracle -->
|
||||
<ojdbc14.version>10.2.0.5.0</ojdbc14.version>
|
||||
<!-- jtds for mssql/db2 -->
|
||||
|
@ -249,12 +252,13 @@
|
|||
<version>${hibernate-jpa.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- anltr -->
|
||||
<!-- anltr hibernate重复
|
||||
<dependency>
|
||||
<groupId>org.antlr</groupId>
|
||||
<artifactId>antlr</artifactId>
|
||||
<version>${antlr.version}</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- spring orm -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
@ -267,6 +271,32 @@
|
|||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--工作流依赖包 -->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.activiti</groupId>
|
||||
<artifactId>activiti-engine</artifactId>
|
||||
<version>${activiti.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.activiti</groupId>
|
||||
<artifactId>activiti-spring</artifactId>
|
||||
<version>${activiti.version}</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- mybatis 20170218-去掉无效引用-scott
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>${mybatis.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
<version>${mybatis-spring.version}</version>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
<!-- 数据库相关依赖包 _start -->
|
||||
<!--proxool start -->
|
||||
<dependency>
|
||||
|
@ -288,6 +318,13 @@
|
|||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>com.cloudhopper.proxool</groupId>
|
||||
<artifactId>proxool-cglib</artifactId>
|
||||
<version>${proxool.version}</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- proxool end-->
|
||||
<dependency>
|
||||
<groupId>commons-pool</groupId>
|
||||
|
@ -314,13 +351,19 @@
|
|||
<version>${mysql.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- sqlserver-->
|
||||
<!-- sqlserver
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>sqljdbc4</artifactId>
|
||||
<version>${sqlserver.version}</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>jdbc2005</artifactId>
|
||||
<version>${sqlserver.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- oracle-->
|
||||
<!-- oracle -->
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc14</artifactId>
|
||||
|
@ -342,13 +385,13 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- postgresql-->
|
||||
<!-- postgresql
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${postgresql.version}</version>
|
||||
</dependency>
|
||||
|
||||
-->
|
||||
<!-- 数据库相关依赖包 _end -->
|
||||
|
||||
<!-- WEB begin -->
|
||||
|
@ -442,11 +485,11 @@
|
|||
<version>${json-lib.version}</version>
|
||||
<classifier>jdk15</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<!-- <dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson-lib.version}</version>
|
||||
</dependency>
|
||||
</dependency> -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
|
@ -482,6 +525,18 @@
|
|||
<artifactId>log4j</artifactId>
|
||||
<version>${log4j.version}</version>
|
||||
</dependency>
|
||||
<!--Logger Support
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.0.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>log4j-over-slf4j</artifactId>
|
||||
<version>1.6.1</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- classmate -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml</groupId>
|
||||
|
@ -584,6 +639,12 @@
|
|||
<artifactId>ehcache-core</artifactId>
|
||||
<version>${ehcache.version}</version>
|
||||
</dependency>
|
||||
<!-- freemarker
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>${freemarker.version}</version>
|
||||
</dependency> -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>freemarker-null</artifactId>
|
||||
|
@ -795,6 +856,31 @@
|
|||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- kisso begin -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>kisso</artifactId>
|
||||
<version>3.6.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.15</version>
|
||||
</dependency>
|
||||
<!-- kisso end -->
|
||||
|
||||
<!-- cxf webservice
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
||||
<version>${cxf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-transports-http</artifactId>
|
||||
<version>${cxf.version}</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- jeecg plugin -->
|
||||
<dependency>
|
||||
<groupId>org.p3framework</groupId>
|
||||
|
@ -804,7 +890,7 @@
|
|||
<dependency>
|
||||
<groupId>org.p3framework</groupId>
|
||||
<artifactId>jeecg-p3-ui</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<version>1.1.3</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -813,6 +899,12 @@
|
|||
<version>1.0-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.p3framework</groupId>
|
||||
<artifactId>jeecg-p3-generate</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<!-- 插件demo -->
|
||||
<dependency>
|
||||
<groupId>org.p3framework</groupId>
|
||||
|
@ -832,9 +924,32 @@
|
|||
<dependency>
|
||||
<groupId>org.p3framework</groupId>
|
||||
<artifactId>jeecg-p3-biz-chat</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.2</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- begin 腾讯云-->
|
||||
<dependency>
|
||||
<groupId>com.qcloud</groupId>
|
||||
<artifactId>cos_api</artifactId>
|
||||
<version>4.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.4.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpmime</artifactId>
|
||||
<version>4.5.1</version>
|
||||
</dependency>
|
||||
<!-- end 腾讯云-->
|
||||
|
||||
</dependencies>
|
||||
|
||||
<organization>
|
||||
|
@ -843,6 +958,22 @@
|
|||
</organization>
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- 多war开发Maven支持-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<warSourceExcludes>%regex[^plug-in.+(?:(?<!(?:-|\.)min)\.js)]
|
||||
,%regex[^plug-in/accordion.+(?:(?<!(?:-|\.)min)\.css)]
|
||||
,%regex[^plug-in/bootstrap.+(?:(?<!(?:-|\.)min)\.css)]
|
||||
,%regex[^plug-in/easyui/themes/black.+(?:(?<!(?:-|\.)min)\.css)]
|
||||
,%regex[^plug-in/easyui/themes/default.+(?:(?<!(?:-|\.)min)\.css)]
|
||||
,%regex[^plug-in/Validform.+(?:(?<!(?:-|\.)min)\.css)]
|
||||
</warSourceExcludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- tomcat插件 -->
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
|
@ -898,7 +1029,53 @@
|
|||
</systemProperties>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<plugin>
|
||||
<!-- YUI Compressor Maven压缩插件 -->
|
||||
<groupId>net.alchim31.maven</groupId>
|
||||
<artifactId>yuicompressor-maven-plugin</artifactId>
|
||||
<version>1.3.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>compress</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<!-- 读取js,css文件采用UTF-8编码 -->
|
||||
<encoding>UTF-8</encoding>
|
||||
<!-- 不显示js可能的错误 -->
|
||||
<jswarn>false</jswarn>
|
||||
<!-- 若存在已压缩的文件,会先对比源文件是否有改动 有改动便压缩,无改动就不压缩 -->
|
||||
<force>false</force>
|
||||
<!-- 在指定的列号后插入新行 -->
|
||||
<linebreakpos>-1</linebreakpos>
|
||||
<!-- 压缩之前先执行聚合文件操作 -->
|
||||
<preProcessAggregates>true</preProcessAggregates>
|
||||
<!-- 压缩后保存文件后缀 无后缀 -->
|
||||
<nosuffix>true</nosuffix>
|
||||
<!-- 源目录,即需压缩的根目录 -->
|
||||
<sourceDirectory>src/main/webapp/plug-in</sourceDirectory>
|
||||
<!-- 压缩js和css文件 -->
|
||||
<includes>
|
||||
<include>plug-in/**/*.js</include>
|
||||
<include>plug-in/accordion/css/*.css</include>
|
||||
<include>plug-in/bootstrap/css/*.css</include>
|
||||
<include>plug-in/easyui/themes/black/*.css</include>
|
||||
<include>plug-in/easyui/themes/default/*.css</include>
|
||||
<include>plug-in/Validform/**/*.css</include>
|
||||
</includes>
|
||||
<!-- 以下目录和文件不会被压缩 -->
|
||||
<excludes>
|
||||
<exclude>plug-in/**/*.min.js</exclude>
|
||||
<exclude>plug-in/**/*.dev.js</exclude>
|
||||
<exclude>plug-in/*/css/*.min.css</exclude>
|
||||
</excludes>
|
||||
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>jeecg</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
|
|
|
@ -0,0 +1,406 @@
|
|||
package com.jeecg.black.controller;
|
||||
import com.jeecg.black.entity.TsBlackListEntity;
|
||||
import com.jeecg.black.service.TsBlackListServiceI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.text.SimpleDateFormat;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import org.jeecgframework.core.common.controller.BaseController;
|
||||
import org.jeecgframework.core.common.exception.BusinessException;
|
||||
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
|
||||
import org.jeecgframework.core.common.model.common.TreeChildCount;
|
||||
import org.jeecgframework.core.common.model.json.AjaxJson;
|
||||
import org.jeecgframework.core.common.model.json.DataGrid;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.tag.core.easyui.TagUtil;
|
||||
import org.jeecgframework.web.system.pojo.base.TSDepart;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
import org.jeecgframework.core.util.MyBeanUtils;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import org.jeecgframework.core.util.BrowserUtils;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.entity.TemplateExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import java.io.IOException;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import org.jeecgframework.core.util.ExceptionUtil;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.jeecgframework.core.beanvalidator.BeanValidators;
|
||||
import java.util.Set;
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.Validator;
|
||||
import java.net.URI;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 黑名单
|
||||
* @author onlineGenerator
|
||||
* @date 2017-05-18 22:33:13
|
||||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/tsBlackListController")
|
||||
public class TsBlackListController extends BaseController {
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(TsBlackListController.class);
|
||||
|
||||
@Autowired
|
||||
private TsBlackListServiceI tsBlackListService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 黑名单列表 页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "list")
|
||||
public ModelAndView list(HttpServletRequest request) {
|
||||
return new ModelAndView("com/jeecg/black/tsBlackListList");
|
||||
}
|
||||
|
||||
/**
|
||||
* easyui AJAX请求数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param dataGrid
|
||||
* @param user
|
||||
*/
|
||||
|
||||
@RequestMapping(params = "datagrid")
|
||||
public void datagrid(TsBlackListEntity tsBlackList,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
|
||||
CriteriaQuery cq = new CriteriaQuery(TsBlackListEntity.class, dataGrid);
|
||||
//查询条件组装器
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tsBlackList, request.getParameterMap());
|
||||
try{
|
||||
//自定义追加查询条件
|
||||
}catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
cq.add();
|
||||
this.tsBlackListService.getDataGridReturn(cq, true);
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除黑名单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(TsBlackListEntity tsBlackList, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
tsBlackList = systemService.getEntity(TsBlackListEntity.class, tsBlackList.getId());
|
||||
message = "黑名单删除成功";
|
||||
try{
|
||||
tsBlackListService.delete(tsBlackList);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "黑名单删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除黑名单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doBatchDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "黑名单删除成功";
|
||||
try{
|
||||
for(String id:ids.split(",")){
|
||||
TsBlackListEntity tsBlackList = systemService.getEntity(TsBlackListEntity.class,
|
||||
id
|
||||
);
|
||||
tsBlackListService.delete(tsBlackList);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "黑名单删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加黑名单
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doAdd")
|
||||
@ResponseBody
|
||||
public AjaxJson doAdd(TsBlackListEntity tsBlackList, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "黑名单添加成功";
|
||||
try{
|
||||
tsBlackListService.save(tsBlackList);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "黑名单添加失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新黑名单
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson doUpdate(TsBlackListEntity tsBlackList, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "黑名单更新成功";
|
||||
TsBlackListEntity t = tsBlackListService.get(TsBlackListEntity.class, tsBlackList.getId());
|
||||
try {
|
||||
MyBeanUtils.copyBeanNotNull2Bean(tsBlackList, t);
|
||||
tsBlackListService.saveOrUpdate(t);
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "黑名单更新失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 黑名单新增页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goAdd")
|
||||
public ModelAndView goAdd(TsBlackListEntity tsBlackList, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(tsBlackList.getId())) {
|
||||
tsBlackList = tsBlackListService.getEntity(TsBlackListEntity.class, tsBlackList.getId());
|
||||
req.setAttribute("tsBlackListPage", tsBlackList);
|
||||
}
|
||||
return new ModelAndView("com/jeecg/black/tsBlackList-add");
|
||||
}
|
||||
/**
|
||||
* 黑名单编辑页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goUpdate")
|
||||
public ModelAndView goUpdate(TsBlackListEntity tsBlackList, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(tsBlackList.getId())) {
|
||||
tsBlackList = tsBlackListService.getEntity(TsBlackListEntity.class, tsBlackList.getId());
|
||||
req.setAttribute("tsBlackListPage", tsBlackList);
|
||||
}
|
||||
return new ModelAndView("com/jeecg/black/tsBlackList-update");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入功能跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "upload")
|
||||
public ModelAndView upload(HttpServletRequest req) {
|
||||
req.setAttribute("controller_name","tsBlackListController");
|
||||
return new ModelAndView("common/upload/pub_excel_upload");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXls")
|
||||
public String exportXls(TsBlackListEntity tsBlackList,HttpServletRequest request,HttpServletResponse response
|
||||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
CriteriaQuery cq = new CriteriaQuery(TsBlackListEntity.class, dataGrid);
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tsBlackList, request.getParameterMap());
|
||||
List<TsBlackListEntity> tsBlackLists = this.tsBlackListService.getListByCriteriaQuery(cq,false);
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"黑名单");
|
||||
modelMap.put(NormalExcelConstants.CLASS,TsBlackListEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("黑名单列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,tsBlackLists);
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
/**
|
||||
* 导出excel 使模板
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXlsByT")
|
||||
public String exportXlsByT(TsBlackListEntity tsBlackList,HttpServletRequest request,HttpServletResponse response
|
||||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"黑名单");
|
||||
modelMap.put(NormalExcelConstants.CLASS,TsBlackListEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("黑名单列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
AjaxJson j = new AjaxJson();
|
||||
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile file = entity.getValue();// 获取上传文件对象
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<TsBlackListEntity> listTsBlackListEntitys = ExcelImportUtil.importExcel(file.getInputStream(),TsBlackListEntity.class,params);
|
||||
for (TsBlackListEntity tsBlackList : listTsBlackListEntitys) {
|
||||
tsBlackListService.save(tsBlackList);
|
||||
}
|
||||
j.setMsg("文件导入成功!");
|
||||
} catch (Exception e) {
|
||||
j.setMsg("文件导入失败!");
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}finally{
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public List<TsBlackListEntity> list() {
|
||||
List<TsBlackListEntity> listTsBlackLists=tsBlackListService.getList(TsBlackListEntity.class);
|
||||
return listTsBlackLists;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> get(@PathVariable("id") String id) {
|
||||
TsBlackListEntity task = tsBlackListService.get(TsBlackListEntity.class, id);
|
||||
if (task == null) {
|
||||
return new ResponseEntity(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return new ResponseEntity(task, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> create(@RequestBody TsBlackListEntity tsBlackList, UriComponentsBuilder uriBuilder) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<TsBlackListEntity>> failures = validator.validate(tsBlackList);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
//保存
|
||||
try{
|
||||
tsBlackListService.save(tsBlackList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
//按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象.
|
||||
String id = tsBlackList.getId();
|
||||
URI uri = uriBuilder.path("/rest/tsBlackListController/" + id).build().toUri();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setLocation(uri);
|
||||
|
||||
return new ResponseEntity(headers, HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<?> update(@RequestBody TsBlackListEntity tsBlackList) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<TsBlackListEntity>> failures = validator.validate(tsBlackList);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
//保存
|
||||
try{
|
||||
tsBlackListService.saveOrUpdate(tsBlackList);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
//按Restful约定,返回204状态码, 无内容. 也可以返回200状态码.
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
public void delete(@PathVariable("id") String id) {
|
||||
tsBlackListService.deleteEntityById(TsBlackListEntity.class, id);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,247 @@
|
|||
package com.jeecg.black.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.lang.String;
|
||||
import java.lang.Double;
|
||||
import java.lang.Integer;
|
||||
import java.math.BigDecimal;
|
||||
import javax.xml.soap.Text;
|
||||
import java.sql.Blob;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Title: Entity
|
||||
* @Description: 黑名单
|
||||
* @author onlineGenerator
|
||||
* @date 2017-05-18 22:33:13
|
||||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "t_s_black_list", schema = "")
|
||||
@SuppressWarnings("serial")
|
||||
public class TsBlackListEntity implements java.io.Serializable {
|
||||
/**主键*/
|
||||
private java.lang.String id;
|
||||
/**创建人名称*/
|
||||
private java.lang.String createName;
|
||||
/**创建人登录名称*/
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
private java.util.Date createDate;
|
||||
/**更新人名称*/
|
||||
private java.lang.String updateName;
|
||||
/**更新人登录名称*/
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
private java.util.Date updateDate;
|
||||
/**所属部门*/
|
||||
private java.lang.String sysOrgCode;
|
||||
/**所属公司*/
|
||||
private java.lang.String sysCompanyCode;
|
||||
/**流程状态*/
|
||||
private java.lang.String bpmStatus;
|
||||
/**ip地址*/
|
||||
@Excel(name="ip地址",width=15)
|
||||
private java.lang.String ip;
|
||||
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 主键
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(generator = "paymentableGenerator")
|
||||
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
|
||||
|
||||
@Column(name ="ID",nullable=false,length=36)
|
||||
public java.lang.String getId(){
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 主键
|
||||
*/
|
||||
public void setId(java.lang.String id){
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 创建人名称
|
||||
*/
|
||||
|
||||
@Column(name ="CREATE_NAME",nullable=true,length=50)
|
||||
public java.lang.String getCreateName(){
|
||||
return this.createName;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 创建人名称
|
||||
*/
|
||||
public void setCreateName(java.lang.String createName){
|
||||
this.createName = createName;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 创建人登录名称
|
||||
*/
|
||||
|
||||
@Column(name ="CREATE_BY",nullable=true,length=50)
|
||||
public java.lang.String getCreateBy(){
|
||||
return this.createBy;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 创建人登录名称
|
||||
*/
|
||||
public void setCreateBy(java.lang.String createBy){
|
||||
this.createBy = createBy;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.util.Date
|
||||
*@return: java.util.Date 创建日期
|
||||
*/
|
||||
|
||||
@Column(name ="CREATE_DATE",nullable=true,length=20)
|
||||
public java.util.Date getCreateDate(){
|
||||
return this.createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.util.Date
|
||||
*@param: java.util.Date 创建日期
|
||||
*/
|
||||
public void setCreateDate(java.util.Date createDate){
|
||||
this.createDate = createDate;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 更新人名称
|
||||
*/
|
||||
|
||||
@Column(name ="UPDATE_NAME",nullable=true,length=50)
|
||||
public java.lang.String getUpdateName(){
|
||||
return this.updateName;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 更新人名称
|
||||
*/
|
||||
public void setUpdateName(java.lang.String updateName){
|
||||
this.updateName = updateName;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 更新人登录名称
|
||||
*/
|
||||
|
||||
@Column(name ="UPDATE_BY",nullable=true,length=50)
|
||||
public java.lang.String getUpdateBy(){
|
||||
return this.updateBy;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 更新人登录名称
|
||||
*/
|
||||
public void setUpdateBy(java.lang.String updateBy){
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.util.Date
|
||||
*@return: java.util.Date 更新日期
|
||||
*/
|
||||
|
||||
@Column(name ="UPDATE_DATE",nullable=true,length=20)
|
||||
public java.util.Date getUpdateDate(){
|
||||
return this.updateDate;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.util.Date
|
||||
*@param: java.util.Date 更新日期
|
||||
*/
|
||||
public void setUpdateDate(java.util.Date updateDate){
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 所属部门
|
||||
*/
|
||||
|
||||
@Column(name ="SYS_ORG_CODE",nullable=true,length=50)
|
||||
public java.lang.String getSysOrgCode(){
|
||||
return this.sysOrgCode;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 所属部门
|
||||
*/
|
||||
public void setSysOrgCode(java.lang.String sysOrgCode){
|
||||
this.sysOrgCode = sysOrgCode;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 所属公司
|
||||
*/
|
||||
|
||||
@Column(name ="SYS_COMPANY_CODE",nullable=true,length=50)
|
||||
public java.lang.String getSysCompanyCode(){
|
||||
return this.sysCompanyCode;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 所属公司
|
||||
*/
|
||||
public void setSysCompanyCode(java.lang.String sysCompanyCode){
|
||||
this.sysCompanyCode = sysCompanyCode;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 流程状态
|
||||
*/
|
||||
|
||||
@Column(name ="BPM_STATUS",nullable=true,length=32)
|
||||
public java.lang.String getBpmStatus(){
|
||||
return this.bpmStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 流程状态
|
||||
*/
|
||||
public void setBpmStatus(java.lang.String bpmStatus){
|
||||
this.bpmStatus = bpmStatus;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String ip地址
|
||||
*/
|
||||
|
||||
@Column(name ="IP",nullable=true,length=32)
|
||||
public java.lang.String getIp(){
|
||||
return this.ip;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String ip地址
|
||||
*/
|
||||
public void setIp(java.lang.String ip){
|
||||
this.ip = ip;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package com.jeecg.black.service;
|
||||
import com.jeecg.black.entity.TsBlackListEntity;
|
||||
import org.jeecgframework.core.common.service.CommonService;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface TsBlackListServiceI extends CommonService{
|
||||
|
||||
public void delete(TsBlackListEntity entity) throws Exception;
|
||||
|
||||
public Serializable save(TsBlackListEntity entity) throws Exception;
|
||||
|
||||
public void saveOrUpdate(TsBlackListEntity entity) throws Exception;
|
||||
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
package com.jeecg.black.service.impl;
|
||||
import com.jeecg.black.service.TsBlackListServiceI;
|
||||
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
|
||||
import com.jeecg.black.entity.TsBlackListEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.io.Serializable;
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.jeecgframework.core.util.MyClassLoader;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.web.cgform.enhance.CgformEnhanceJavaInter;
|
||||
|
||||
@Service("tsBlackListService")
|
||||
@Transactional
|
||||
public class TsBlackListServiceImpl extends CommonServiceImpl implements TsBlackListServiceI {
|
||||
|
||||
|
||||
public void delete(TsBlackListEntity entity) throws Exception{
|
||||
super.delete(entity);
|
||||
//执行删除操作增强业务
|
||||
this.doDelBus(entity);
|
||||
}
|
||||
|
||||
public Serializable save(TsBlackListEntity entity) throws Exception{
|
||||
Serializable t = super.save(entity);
|
||||
//执行新增操作增强业务
|
||||
this.doAddBus(entity);
|
||||
return t;
|
||||
}
|
||||
|
||||
public void saveOrUpdate(TsBlackListEntity entity) throws Exception{
|
||||
super.saveOrUpdate(entity);
|
||||
//执行更新操作增强业务
|
||||
this.doUpdateBus(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增操作增强业务
|
||||
* @param t
|
||||
* @return
|
||||
*/
|
||||
private void doAddBus(TsBlackListEntity t) throws Exception{
|
||||
}
|
||||
/**
|
||||
* 更新操作增强业务
|
||||
* @param t
|
||||
* @return
|
||||
*/
|
||||
private void doUpdateBus(TsBlackListEntity t) throws Exception{
|
||||
}
|
||||
/**
|
||||
* 删除操作增强业务
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private void doDelBus(TsBlackListEntity t) throws Exception{
|
||||
}
|
||||
|
||||
private Map<String,Object> populationMap(TsBlackListEntity t){
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("id", t.getId());
|
||||
map.put("create_name", t.getCreateName());
|
||||
map.put("create_by", t.getCreateBy());
|
||||
map.put("create_date", t.getCreateDate());
|
||||
map.put("update_name", t.getUpdateName());
|
||||
map.put("update_by", t.getUpdateBy());
|
||||
map.put("update_date", t.getUpdateDate());
|
||||
map.put("sys_org_code", t.getSysOrgCode());
|
||||
map.put("sys_company_code", t.getSysCompanyCode());
|
||||
map.put("bpm_status", t.getBpmStatus());
|
||||
map.put("ip", t.getIp());
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换sql中的变量
|
||||
* @param sql
|
||||
* @param t
|
||||
* @return
|
||||
*/
|
||||
public String replaceVal(String sql,TsBlackListEntity t){
|
||||
sql = sql.replace("#{id}",String.valueOf(t.getId()));
|
||||
sql = sql.replace("#{create_name}",String.valueOf(t.getCreateName()));
|
||||
sql = sql.replace("#{create_by}",String.valueOf(t.getCreateBy()));
|
||||
sql = sql.replace("#{create_date}",String.valueOf(t.getCreateDate()));
|
||||
sql = sql.replace("#{update_name}",String.valueOf(t.getUpdateName()));
|
||||
sql = sql.replace("#{update_by}",String.valueOf(t.getUpdateBy()));
|
||||
sql = sql.replace("#{update_date}",String.valueOf(t.getUpdateDate()));
|
||||
sql = sql.replace("#{sys_org_code}",String.valueOf(t.getSysOrgCode()));
|
||||
sql = sql.replace("#{sys_company_code}",String.valueOf(t.getSysCompanyCode()));
|
||||
sql = sql.replace("#{bpm_status}",String.valueOf(t.getBpmStatus()));
|
||||
sql = sql.replace("#{ip}",String.valueOf(t.getIp()));
|
||||
sql = sql.replace("#{UUID}",UUID.randomUUID().toString());
|
||||
return sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行JAVA增强
|
||||
*/
|
||||
private void executeJavaExtend(String cgJavaType,String cgJavaValue,Map<String,Object> data) throws Exception {
|
||||
if(StringUtil.isNotEmpty(cgJavaValue)){
|
||||
Object obj = null;
|
||||
try {
|
||||
if("class".equals(cgJavaType)){
|
||||
//因新增时已经校验了实例化是否可以成功,所以这块就不需要再做一次判断
|
||||
obj = MyClassLoader.getClassByScn(cgJavaValue).newInstance();
|
||||
}else if("spring".equals(cgJavaType)){
|
||||
obj = ApplicationContextUtil.getContext().getBean(cgJavaValue);
|
||||
}
|
||||
if(obj instanceof CgformEnhanceJavaInter){
|
||||
CgformEnhanceJavaInter javaInter = (CgformEnhanceJavaInter) obj;
|
||||
javaInter.execute("ts_black_list",data);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new Exception("执行JAVA增强出现异常!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +1,47 @@
|
|||
package com.jeecg.demo.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.ws.Response;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jeecgframework.core.common.controller.BaseController;
|
||||
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
|
||||
import org.jeecgframework.core.common.model.common.UploadFile;
|
||||
import org.jeecgframework.core.common.model.json.AjaxJson;
|
||||
import org.jeecgframework.core.common.model.json.ComboTree;
|
||||
import org.jeecgframework.core.util.JSONHelper;
|
||||
import org.jeecgframework.core.common.model.json.DataGrid;
|
||||
import org.jeecgframework.core.common.model.json.TreeGrid;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil;
|
||||
import org.jeecgframework.core.util.*;
|
||||
import org.jeecgframework.tag.core.easyui.TagUtil;
|
||||
import org.jeecgframework.tag.vo.datatable.SortDirection;
|
||||
import org.jeecgframework.tag.vo.easyui.ComboTreeModel;
|
||||
import org.jeecgframework.tag.vo.easyui.TreeGridModel;
|
||||
import org.jeecgframework.web.system.pojo.base.TSAttachment;
|
||||
import org.jeecgframework.web.system.pojo.base.TSDepart;
|
||||
import org.jeecgframework.web.system.pojo.base.TSFunction;
|
||||
import org.jeecgframework.web.system.pojo.base.TSType;
|
||||
import org.jeecgframework.web.system.pojo.base.TSTypegroup;
|
||||
import org.jeecgframework.web.system.pojo.base.TSUser;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jeecg.demo.dao.JeecgMinidaoDao;
|
||||
|
||||
import net.sf.json.JSONArray;
|
||||
import com.jeecg.demo.entity.TSDocument;
|
||||
|
||||
/**
|
||||
* @ClassName: JeecgFormDemoController
|
||||
|
@ -75,8 +89,11 @@ public class JeecgFormDemoController extends BaseController {
|
|||
return new ModelAndView("com/jeecg/demo/ueditor");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(params = "popupMultiValue")
|
||||
public ModelAndView popupMultiValue(HttpServletRequest request) {
|
||||
logger.info("popupMultiValue");
|
||||
return new ModelAndView("com/jeecg/demo/form_popupMultiValue");
|
||||
}
|
||||
|
||||
/**
|
||||
*下拉联动数据---省市区
|
||||
|
@ -189,7 +206,9 @@ public class JeecgFormDemoController extends BaseController {
|
|||
*/
|
||||
@RequestMapping(params = "getAutocompleteData",method ={RequestMethod.GET, RequestMethod.POST})
|
||||
public void getAutocompleteData(HttpServletRequest request, HttpServletResponse response) {
|
||||
String searchVal = request.getParameter("searchVal");
|
||||
|
||||
String searchVal = request.getParameter("q");
|
||||
|
||||
String hql = "from TSUser where userName like '%"+searchVal+"%'";
|
||||
List autoList = systemService.findHql(hql);
|
||||
try {
|
||||
|
@ -209,5 +228,356 @@ public class JeecgFormDemoController extends BaseController {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(params = "eSign")
|
||||
public ModelAndView eSignDemo(HttpServletRequest request) {
|
||||
return new ModelAndView("com/jeecg/demo/zsign");
|
||||
}
|
||||
|
||||
@RequestMapping(params = "siteSelect")
|
||||
public ModelAndView siteSelect(HttpServletRequest request) {
|
||||
logger.info("----左右布局 demo转入页面-----");
|
||||
return new ModelAndView("com/jeecg/demo/siteSelect");
|
||||
}
|
||||
/**
|
||||
* 上下特殊布局
|
||||
*/
|
||||
@RequestMapping(params = "specialLayout")
|
||||
public ModelAndView rowListDemo(HttpServletRequest request) {
|
||||
logger.info("----上下特殊布局 demo转入页面-----");
|
||||
return new ModelAndView("com/jeecg/demo/specialLayout");
|
||||
}
|
||||
|
||||
@RequestMapping(params = "commonUpload")
|
||||
public ModelAndView commonUploadDemo(){
|
||||
return new ModelAndView("system/commonupload/commonUploadFile");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "saveUploadFile")
|
||||
@ResponseBody
|
||||
public AjaxJson saveUploadFile(String documentTitle,String filename,String swfpath){
|
||||
AjaxJson ajaxJson = new AjaxJson();
|
||||
try {
|
||||
TSTypegroup tsTypegroup=systemService.getTypeGroup("fieltype","文档分类");
|
||||
TSType tsType = systemService.getType("files","附件", tsTypegroup);
|
||||
TSDocument document = new TSDocument();
|
||||
document.setDocumentTitle(documentTitle);
|
||||
document.setRealpath(filename);
|
||||
document.setSubclassname(MyClassLoader.getPackPath(document));
|
||||
document.setCreatedate(DateUtils.gettimestamp());
|
||||
document.setTSType(tsType);
|
||||
document.setSwfpath(swfpath);
|
||||
|
||||
String fileName = filename.substring(filename.lastIndexOf("/")+1,filename.lastIndexOf("."));
|
||||
document.setAttachmenttitle(fileName);
|
||||
document.setExtend(filename.substring(filename.lastIndexOf(".") + 1));
|
||||
|
||||
systemService.save(document);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ajaxJson.setSuccess(false);
|
||||
ajaxJson.setMsg("失败:"+e.getMessage());
|
||||
}
|
||||
return ajaxJson;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 文件添加跳转
|
||||
*
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "addFiles")
|
||||
public ModelAndView addFiles(HttpServletRequest req) {
|
||||
return new ModelAndView("system/document/files");
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件编辑跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "editFiles")
|
||||
public ModelAndView editFiles(TSDocument doc, ModelMap map,HttpServletRequest request) {
|
||||
if (StringUtil.isNotEmpty(doc.getId())) {
|
||||
doc = systemService.getEntity(TSDocument.class, doc.getId());
|
||||
map.put("doc", doc);
|
||||
TSAttachment attachment = systemService.get(TSAttachment.class, doc.getId());
|
||||
map.put("attachment",attachment);
|
||||
}
|
||||
return new ModelAndView("system/document/files");
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存文件
|
||||
*
|
||||
* @param document
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@RequestMapping(params = "saveFiles", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public AjaxJson saveFiles(HttpServletRequest request, HttpServletResponse response, TSDocument document) {
|
||||
AjaxJson j = new AjaxJson();
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
TSTypegroup tsTypegroup=systemService.getTypeGroup("fieltype","文档分类");
|
||||
TSType tsType = systemService.getType("files","附件", tsTypegroup);
|
||||
String fileKey = oConvertUtils.getString(request.getParameter("fileKey"));// 文件ID
|
||||
String documentTitle = oConvertUtils.getString(request.getParameter("documentTitle"));// 文件标题
|
||||
if (StringUtil.isNotEmpty(fileKey)) {
|
||||
document.setId(fileKey);
|
||||
document = systemService.getEntity(TSDocument.class, fileKey);
|
||||
document.setDocumentTitle(documentTitle);
|
||||
|
||||
}
|
||||
document.setSubclassname(MyClassLoader.getPackPath(document));
|
||||
document.setCreatedate(DateUtils.gettimestamp());
|
||||
document.setTSType(tsType);
|
||||
UploadFile uploadFile = new UploadFile(request, document);
|
||||
uploadFile.setCusPath("files");
|
||||
//设置weboffice转化【不设置该字段,则不做在线预览转化】
|
||||
uploadFile.setSwfpath("swfpath");
|
||||
document = systemService.uploadFile(uploadFile);
|
||||
attributes.put("url", document.getRealpath());
|
||||
attributes.put("fileKey", document.getId());
|
||||
attributes.put("name", document.getAttachmenttitle());
|
||||
attributes.put("viewhref", "commonController.do?objfileList&fileKey=" + document.getId());
|
||||
attributes.put("delurl", "commonController.do?delObjFile&fileKey=" + document.getId());
|
||||
j.setMsg("文件添加成功");
|
||||
j.setAttributes(attributes);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新闻法规文件列表
|
||||
*/
|
||||
@RequestMapping(params = "documentList")
|
||||
public void documentList(HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
|
||||
CriteriaQuery cq = new CriteriaQuery(TSDocument.class, dataGrid);
|
||||
String typecode = oConvertUtils.getString(request.getParameter("typecode"));
|
||||
cq.createAlias("TSType", "TSType");
|
||||
cq.eq("TSType.typecode", typecode);
|
||||
cq.add();
|
||||
this.systemService.getDataGridReturn(cq, true);
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文档
|
||||
*
|
||||
* @param document
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "delDocument")
|
||||
@ResponseBody
|
||||
public AjaxJson delDocument(TSDocument document, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
document = systemService.getEntity(TSDocument.class, document.getId());
|
||||
message = "" + document.getDocumentTitle() + "被删除成功";
|
||||
systemService.delete(document);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||
Globals.Log_Leavel_INFO);
|
||||
j.setSuccess(true);
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
*/
|
||||
@RequestMapping(params = "functionGrid")
|
||||
@ResponseBody
|
||||
public Object functionGrid(HttpServletRequest request,TreeGrid treegrid, Integer type,HttpServletResponse response, DataGrid dataGrid) {
|
||||
CriteriaQuery cq = new CriteriaQuery(TSFunction.class,dataGrid);
|
||||
boolean pageflag=true;
|
||||
String selfId = request.getParameter("selfId");
|
||||
if (selfId != null) {
|
||||
cq.notEq("id", selfId);
|
||||
}
|
||||
if (treegrid.getId() != null) {
|
||||
pageflag=false;
|
||||
cq.eq("TSFunction.id", treegrid.getId());
|
||||
}
|
||||
if (treegrid.getId() == null) {
|
||||
cq.isNull("TSFunction");
|
||||
}
|
||||
if(type != null){
|
||||
cq.eq("functionType", type.shortValue());
|
||||
}
|
||||
cq.addOrder("functionOrder", SortDirection.asc);
|
||||
cq.add();
|
||||
|
||||
//获取装载数据权限的条件HQL
|
||||
cq = HqlGenerateUtil.getDataAuthorConditionHql(cq, new TSFunction());
|
||||
cq.add();
|
||||
|
||||
|
||||
List<TSFunction> functionList = systemService.getListByCriteriaQuery(cq, pageflag);
|
||||
Long total=systemService.getCountForJdbc("select count(*) from t_s_function where functionlevel=0");
|
||||
|
||||
Collections.sort(functionList, new NumberComparator());
|
||||
|
||||
List<TreeGrid> treeGrids = new ArrayList<TreeGrid>();
|
||||
TreeGridModel treeGridModel = new TreeGridModel();
|
||||
treeGridModel.setIcon("TSIcon_iconPath");
|
||||
treeGridModel.setTextField("functionName");
|
||||
treeGridModel.setParentText("TSFunction_functionName");
|
||||
treeGridModel.setParentId("TSFunction_id");
|
||||
treeGridModel.setSrc("functionUrl");
|
||||
treeGridModel.setIdField("id");
|
||||
treeGridModel.setChildList("TSFunctions");
|
||||
// 添加排序字段
|
||||
treeGridModel.setOrder("functionOrder");
|
||||
|
||||
treeGridModel.setIconStyle("functionIconStyle");
|
||||
|
||||
|
||||
treeGridModel.setFunctionType("functionType");
|
||||
|
||||
treeGrids = systemService.treegrid(functionList, treeGridModel);
|
||||
|
||||
MutiLangUtil.setMutiTree(treeGrids);
|
||||
JSONObject jsonObject=new JSONObject();
|
||||
jsonObject.put("rows",treeGrids);
|
||||
jsonObject.put("total",total);
|
||||
if (pageflag){
|
||||
return jsonObject;
|
||||
}
|
||||
return treeGrids;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限列表页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "function")
|
||||
public ModelAndView function(ModelMap model) {
|
||||
return new ModelAndView("com/jeecg/demo/functionList");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 菜单进入可排序多选界面
|
||||
*/
|
||||
@RequestMapping(params = "selectSort")
|
||||
public ModelAndView selectSort() {
|
||||
return new ModelAndView("com/jeecg/demo/form_selectSort");
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转可排序多选用户选择界面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "gridSelectdemo")
|
||||
public ModelAndView gridSelectdemo() {
|
||||
return new ModelAndView("com/jeecg/demo/gridSelectdemo");
|
||||
}
|
||||
|
||||
/**
|
||||
* 可排序多选界面查用户表放在Datagrid中
|
||||
* @param user
|
||||
* @param request
|
||||
* @param response
|
||||
* @param dataGrid
|
||||
* @throws ServletException
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping(params = "easyUIGrid", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void getEasyUIGrid(TSUser user,HttpServletRequest request,HttpServletResponse response,DataGrid dataGrid)throws Exception{
|
||||
CriteriaQuery cq = new CriteriaQuery(TSUser.class, dataGrid);
|
||||
//查询条件组装器
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, user);
|
||||
Short[] userstate = new Short[]{Globals.User_Normal, Globals.User_ADMIN, Globals.User_Forbidden};
|
||||
cq.in("status", userstate);
|
||||
cq.eq("deleteFlag", Globals.Delete_Normal);
|
||||
cq.add();
|
||||
this.systemService.getDataGridReturn(cq, true);
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
}
|
||||
|
||||
@RequestMapping(params = "ztreeDemo")
|
||||
public ModelAndView ztreeDemo(HttpServletRequest request) {
|
||||
return new ModelAndView("com/jeecg/demo/ztreeDemo");
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(params="getTreeDemoData",method ={RequestMethod.GET, RequestMethod.POST})
|
||||
@ResponseBody
|
||||
public AjaxJson getTreeDemoData(TSDepart depatr,HttpServletResponse response,HttpServletRequest request ){
|
||||
AjaxJson j = new AjaxJson();
|
||||
try{
|
||||
List<TSDepart> depatrList = new ArrayList<TSDepart>();
|
||||
StringBuffer hql = new StringBuffer(" from TSDepart t");
|
||||
depatrList = this.systemService.findHql(hql.toString());
|
||||
List<Map<String,Object>> dataList = new ArrayList<Map<String,Object>>();
|
||||
Map<String,Object> map = null;
|
||||
for (TSDepart tsdepart : depatrList) {
|
||||
map = new HashMap<String,Object>();
|
||||
map.put("chkDisabled",false);
|
||||
map.put("click", true);
|
||||
map.put("id", tsdepart.getId());
|
||||
map.put("name", tsdepart.getDepartname());
|
||||
map.put("nocheck", false);
|
||||
map.put("struct","TREE");
|
||||
map.put("title",tsdepart.getDepartname());
|
||||
if (tsdepart.getTSPDepart() != null) {
|
||||
map.put("parentId",tsdepart.getTSPDepart().getId());
|
||||
}else {
|
||||
map.put("parentId","0");
|
||||
}
|
||||
dataList.add(map);
|
||||
}
|
||||
j.setObj(dataList);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
* @param depart
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "del")
|
||||
@ResponseBody
|
||||
public AjaxJson del(TSDepart depart, HttpServletRequest request) {
|
||||
AjaxJson j = new AjaxJson();
|
||||
depart = systemService.getEntity(TSDepart.class, depart.getId());
|
||||
Long childCount = systemService.getCountForJdbc("select count(1) from t_s_depart where parentdepartid ='" + depart.getId() + "'");
|
||||
if(childCount>0){
|
||||
j.setSuccess(false);
|
||||
j.setMsg("有下级,不能删除");
|
||||
return j;
|
||||
}
|
||||
systemService.executeSql("delete from t_s_role_org where org_id=?", depart.getId());
|
||||
//systemService.delete();
|
||||
j.setMsg("删除成功");
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 多选项卡demo
|
||||
*/
|
||||
@RequestMapping(params = "tabsDemo")
|
||||
public ModelAndView tabsDemo(HttpServletRequest request) {
|
||||
logger.info("----多选项卡demo转入页面-----");
|
||||
return new ModelAndView("com/jeecg/demo/tabsDemo");
|
||||
}
|
||||
@RequestMapping(params = "tabDemo")
|
||||
public ModelAndView tabDemo(HttpServletRequest request) {
|
||||
logger.info("----选项卡demo转入页面-----");
|
||||
return new ModelAndView("com/jeecg/demo/tabDemo");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +1,42 @@
|
|||
package com.jeecg.demo.controller;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.StringReader;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.batik.transcoder.Transcoder;
|
||||
import org.apache.batik.transcoder.TranscoderException;
|
||||
import org.apache.batik.transcoder.TranscoderInput;
|
||||
import org.apache.batik.transcoder.TranscoderOutput;
|
||||
import org.apache.batik.transcoder.image.JPEGTranscoder;
|
||||
import org.apache.batik.transcoder.image.PNGTranscoder;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.fop.svg.PDFTranscoder;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jeecgframework.core.common.controller.BaseController;
|
||||
import org.jeecgframework.core.common.dao.jdbc.JdbcDao;
|
||||
import org.jeecgframework.core.common.exception.BusinessException;
|
||||
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
|
||||
import org.jeecgframework.core.common.model.json.AjaxJson;
|
||||
import org.jeecgframework.core.common.model.json.DataGrid;
|
||||
import org.jeecgframework.core.common.model.json.Highchart;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.util.DBTypeUtil;
|
||||
import org.jeecgframework.core.util.DateUtils;
|
||||
import org.jeecgframework.core.util.ExceptionUtil;
|
||||
import org.jeecgframework.core.util.JeecgDataAutorUtils;
|
||||
import org.jeecgframework.core.util.MyBeanUtils;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.minidao.pojo.MiniDaoPage;
|
||||
import org.jeecgframework.p3.core.util.oConvertUtils;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
|
@ -30,6 +45,7 @@ import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
|
|||
import org.jeecgframework.tag.core.easyui.TagUtil;
|
||||
import org.jeecgframework.web.system.pojo.base.TSDepart;
|
||||
import org.jeecgframework.web.system.pojo.base.TSLog;
|
||||
import org.jeecgframework.web.system.service.MutiLangServiceI;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -70,6 +86,9 @@ public class JeecgListDemoController extends BaseController {
|
|||
@Autowired
|
||||
private JeecgMinidaoDao jeecgMinidaoDao;
|
||||
|
||||
private static final String BROSWER_COUNT_ANALYSIS = "broswer.count.analysis";
|
||||
@Autowired
|
||||
private MutiLangServiceI mutiLangService;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -77,7 +96,6 @@ public class JeecgListDemoController extends BaseController {
|
|||
* @param request
|
||||
* @return
|
||||
*/
|
||||
//JeecgListDemoController.do?minidaoListDemo
|
||||
@RequestMapping(params = "minidaoListDemo")
|
||||
public ModelAndView minidaoListDemo(HttpServletRequest request) {
|
||||
return new ModelAndView("com/jeecg/demo/taglist_minidao");
|
||||
|
@ -86,7 +104,6 @@ public class JeecgListDemoController extends BaseController {
|
|||
/**
|
||||
* 行编辑列表
|
||||
*/
|
||||
//JeecgListDemoController.do?rowListDemo
|
||||
@RequestMapping(params = "rowListDemo")
|
||||
public ModelAndView rowListDemo(HttpServletRequest request) {
|
||||
return new ModelAndView("com/jeecg/demo/list_rowedtior");
|
||||
|
@ -101,15 +118,173 @@ public class JeecgListDemoController extends BaseController {
|
|||
public ModelAndView list(HttpServletRequest request) {
|
||||
return new ModelAndView("com/jeecg/demo/jeecgDemoList");
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(params = "multiHeaList")
|
||||
public ModelAndView multiHeaList(HttpServletRequest request) {
|
||||
return new ModelAndView("com/jeecg/demo/jeecgDemoList-multihead");
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义查询条件
|
||||
*/
|
||||
//JeecgListDemoController.do?mysearchListDemo
|
||||
@RequestMapping(params = "mysearchListDemo")
|
||||
public ModelAndView mysearchListDemo(HttpServletRequest request) {
|
||||
return new ModelAndView("com/jeecg/demo/taglist_mysearch");
|
||||
}
|
||||
|
||||
/**
|
||||
* 综合报表 页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "broswerStatisticTabs")
|
||||
public ModelAndView broswerStatisticTabs(HttpServletRequest request) {
|
||||
return new ModelAndView("com/jeecg/demo/reportDemo");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 综合报表 datagrid
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "listAllStatisticByJdbc")
|
||||
public void listAllStatisticByJdbc(HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
|
||||
List<Map<String,Object>> maplist=systemService.findForJdbc("select l.broswer broswer ,count(broswer) broswercount from t_s_log l group by l.broswer", null);
|
||||
Long countSutent = systemService.getCountForJdbc("select count(*) from t_s_log where 1=1");
|
||||
for(Map map:maplist){
|
||||
Long personcount = Long.parseLong(map.get("broswercount").toString());
|
||||
Double percentage = 0.0;
|
||||
if (personcount != null && personcount.intValue() != 0) {
|
||||
percentage = new Double(personcount)/countSutent;
|
||||
}
|
||||
|
||||
map.put("rate", String.format("%.2f", percentage*100)+"%");
|
||||
}
|
||||
Long count = 0L;
|
||||
if(JdbcDao.DATABSE_TYPE_SQLSERVER.equals(DBTypeUtil.getDBType())){
|
||||
count = systemService.getCountForJdbcParam("select count(0) from (select l.broswer broswer ,count(broswer) broswercount from t_s_log l group by l.broswer) as t( broswer, broswercount)",null);
|
||||
}else{
|
||||
count = systemService.getCountForJdbcParam("select count(0) from (select l.broswer broswer ,count(broswer) broswercount from t_s_log l group by l.broswer)t",null);
|
||||
}
|
||||
|
||||
dataGrid.setTotal(count.intValue());
|
||||
dataGrid.setResults(maplist);
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* highchart
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "broswerCount")
|
||||
@ResponseBody
|
||||
public List<Highchart> studentCount(HttpServletRequest request,String reportType, HttpServletResponse response) {
|
||||
List<Highchart> list = new ArrayList<Highchart>();
|
||||
Highchart hc = new Highchart();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("SELECT broswer as className ,count(broswer) FROM TSLog group by broswer");
|
||||
List userBroswerList = systemService.findByQueryString(sb.toString());
|
||||
Long count = systemService.getCountForJdbc("SELECT COUNT(1) FROM T_S_Log WHERE 1=1");
|
||||
List lt = new ArrayList();
|
||||
hc = new Highchart();
|
||||
hc.setName(mutiLangService.getLang(BROSWER_COUNT_ANALYSIS));
|
||||
hc.setType(reportType);
|
||||
Map<String, Object> map;
|
||||
if (userBroswerList.size() > 0) {
|
||||
for (Object object : userBroswerList) {
|
||||
map = new HashMap<String, Object>();
|
||||
Object[] obj = (Object[]) object;
|
||||
map.put("name", obj[0]);
|
||||
map.put("y", obj[1]);
|
||||
Long groupCount = (Long) obj[1];
|
||||
Double percentage = 0.0;
|
||||
if (count != null && count.intValue() != 0) {
|
||||
percentage = new Double(groupCount)/count;
|
||||
}
|
||||
map.put("percentage", percentage*100);
|
||||
lt.add(map);
|
||||
}
|
||||
}
|
||||
hc.setData(lt);
|
||||
list.add(hc);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 报表打印
|
||||
* @param request
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping(params = "export")
|
||||
public void export(HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
request.setCharacterEncoding("utf-8");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String type = request.getParameter("type");
|
||||
String svg = request.getParameter("svg");
|
||||
String filename = request.getParameter("filename");
|
||||
|
||||
filename = filename == null ? "chart" : filename;
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
try {
|
||||
if (null != type && null != svg) {
|
||||
svg = svg.replaceAll(":rect", "rect");
|
||||
String ext = "";
|
||||
Transcoder t = null;
|
||||
if (type.equals("image/png")) {
|
||||
ext = "png";
|
||||
t = new PNGTranscoder();
|
||||
} else if (type.equals("image/jpeg")) {
|
||||
ext = "jpg";
|
||||
t = new JPEGTranscoder();
|
||||
} else if (type.equals("application/pdf")) {
|
||||
ext = "pdf";
|
||||
t = (Transcoder) new PDFTranscoder();
|
||||
} else if (type.equals("image/svg+xml"))
|
||||
ext = "svg";
|
||||
response.addHeader("Content-Disposition",
|
||||
"attachment; filename=" + new String(filename.getBytes("GBK"),"ISO-8859-1") + "." + ext);
|
||||
response.addHeader("Content-Type", type);
|
||||
|
||||
if (null != t) {
|
||||
TranscoderInput input = new TranscoderInput(
|
||||
new StringReader(svg));
|
||||
TranscoderOutput output = new TranscoderOutput(out);
|
||||
|
||||
try {
|
||||
t.transcode(input, output);
|
||||
} catch (TranscoderException e) {
|
||||
out
|
||||
.print("Problem transcoding stream. See the web logs for more details.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (ext.equals("svg")) {
|
||||
// out.print(svg);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(out,
|
||||
"UTF-8");
|
||||
writer.append(svg);
|
||||
writer.close();
|
||||
} else
|
||||
out.print("Invalid type: " + type);
|
||||
} else {
|
||||
response.addHeader("Content-Type", "text/html");
|
||||
out
|
||||
.println("Usage:\n\tParameter [svg]: The DOM Element to be converted."
|
||||
+ "\n\tParameter [type]: The destination MIME type for the elment to be transcoded.");
|
||||
}
|
||||
} finally {
|
||||
if (out != null) {
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping(params = "minidaoDatagrid")
|
||||
|
@ -119,10 +294,13 @@ public class JeecgListDemoController extends BaseController {
|
|||
* 例如数据库表字段:{USER_NAME}
|
||||
* 转化实体对应字段:{userName}
|
||||
*/
|
||||
List<JeecgDemoEntity> list = jeecgMinidaoDao.getAllEntities(jeecgDemo, dataGrid.getPage(), dataGrid.getRows());
|
||||
Integer count = jeecgMinidaoDao.getCount();
|
||||
dataGrid.setTotal(count);
|
||||
dataGrid.setResults(list);
|
||||
|
||||
String authSql = JeecgDataAutorUtils.loadDataSearchConditonSQLString();
|
||||
MiniDaoPage<JeecgDemoEntity> list = jeecgMinidaoDao.getAllEntities(jeecgDemo, dataGrid.getPage(), dataGrid.getRows(),authSql);
|
||||
|
||||
dataGrid.setTotal(list.getTotal());
|
||||
dataGrid.setResults(list.getResults());
|
||||
|
||||
String total_salary = String.valueOf(jeecgMinidaoDao.getSumSalary());
|
||||
/*
|
||||
* 说明:格式为 字段名:值(可选,不写该值时为分页数据的合计) 多个合计 以 , 分割
|
||||
|
@ -158,7 +336,7 @@ public class JeecgListDemoController extends BaseController {
|
|||
* 说明:格式为 字段名:值(可选,不写该值时为分页数据的合计) 多个合计 以 , 分割
|
||||
*/
|
||||
//dataGrid.setFooter("salary:"+(total_salary.equalsIgnoreCase("null")?"0.0":total_salary)+",age,email:合计");
|
||||
List<JeecgDemoEntity> list=dataGrid.getResults();
|
||||
List<JeecgDemoEntity> list = dataGrid.getResults();
|
||||
Map<String,Map<String,Object>> extMap = new HashMap<String, Map<String,Object>>();
|
||||
for(JeecgDemoEntity temp:list){
|
||||
//此为针对原来的行数据,拓展的新字段
|
||||
|
@ -167,9 +345,8 @@ public class JeecgListDemoController extends BaseController {
|
|||
extMap.put(temp.getId(), m);
|
||||
}
|
||||
//dataGrid.setFooter("extField,salary,age,name:合计");
|
||||
TagUtil.datagrid(response, dataGrid,extMap);
|
||||
dataGrid.setFooter("salary,age,name:合计");
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
TagUtil.datagrid(response, dataGrid,extMap);
|
||||
}
|
||||
|
||||
@RequestMapping(params = "addTab")
|
||||
|
@ -396,7 +573,7 @@ public class JeecgListDemoController extends BaseController {
|
|||
List<JeecgDemoEntity> jeecgDemos = this.jeecgDemoService.getListByCriteriaQuery(cq,false);
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"jeecg_demo");
|
||||
modelMap.put(NormalExcelConstants.CLASS,JeecgDemoEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("jeecg_demo列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("jeecg_demo列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,jeecgDemos);
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
|
@ -411,7 +588,7 @@ public class JeecgListDemoController extends BaseController {
|
|||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"jeecg_demo");
|
||||
modelMap.put(NormalExcelConstants.CLASS,JeecgDemoEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("jeecg_demo列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("jeecg_demo列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
|
@ -557,4 +734,51 @@ public class JeecgListDemoController extends BaseController {
|
|||
req.setAttribute("logs",arr);
|
||||
return new ModelAndView("com/jeecg/demo/logrp-chart");
|
||||
}
|
||||
/**
|
||||
* 批量添加
|
||||
* @param request
|
||||
* @return
|
||||
* 2017年6月9日--下午4:33:30
|
||||
*/
|
||||
@RequestMapping(params = "jdbcBatchSave")
|
||||
@ResponseBody
|
||||
public AjaxJson jdbcBatchSave(HttpServletRequest request) {
|
||||
AjaxJson j = new AjaxJson();
|
||||
String message = "springjdbc 批处理添加测试用户成功";
|
||||
try{
|
||||
jeecgDemoService.jdbcBatchSave();
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "springjdbc 批处理添加测试用户失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
logger.info(message);
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用存储过程
|
||||
* @param request
|
||||
* @return
|
||||
* 2017年6月9日--下午4:33:43
|
||||
*/
|
||||
@RequestMapping(params = "jdbcProcedure")
|
||||
@ResponseBody
|
||||
public AjaxJson jdbcProcedure(HttpServletRequest request) {
|
||||
AjaxJson j = new AjaxJson();
|
||||
String message = "jdbc调用存储过程成功";
|
||||
try{
|
||||
jeecgDemoService.jdbcProcedure();
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "jdbc调用存储过程失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,438 @@
|
|||
package com.jeecg.demo.controller;
|
||||
import com.jeecg.demo.entity.MultiUploadEntity;
|
||||
import com.jeecg.demo.service.MultiUploadServiceI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.text.SimpleDateFormat;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import org.jeecgframework.core.common.controller.BaseController;
|
||||
import org.jeecgframework.core.common.exception.BusinessException;
|
||||
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
|
||||
import org.jeecgframework.core.common.model.common.TreeChildCount;
|
||||
import org.jeecgframework.core.common.model.json.AjaxJson;
|
||||
import org.jeecgframework.core.common.model.json.DataGrid;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.tag.core.easyui.TagUtil;
|
||||
import org.jeecgframework.web.system.pojo.base.TSDepart;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
import org.jeecgframework.core.util.MyBeanUtils;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import org.jeecgframework.core.util.BrowserUtils;
|
||||
import org.jeecgframework.poi.excel.ExcelExportUtil;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.poi.excel.entity.TemplateExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
|
||||
import org.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import java.io.IOException;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import org.jeecgframework.core.util.ExceptionUtil;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.jeecgframework.core.beanvalidator.BeanValidators;
|
||||
import java.util.Set;
|
||||
import javax.validation.ConstraintViolation;
|
||||
import javax.validation.Validator;
|
||||
import java.net.URI;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import org.jeecgframework.web.cgform.entity.upload.CgUploadEntity;
|
||||
import org.jeecgframework.web.cgform.service.config.CgFormFieldServiceI;
|
||||
import java.util.HashMap;
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: 测试多文件上传
|
||||
* @author onlineGenerator
|
||||
* @date 2017-07-17 10:50:36
|
||||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/multiUploadController")
|
||||
public class MultiUploadController extends BaseController {
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(MultiUploadController.class);
|
||||
|
||||
@Autowired
|
||||
private MultiUploadServiceI multiUploadService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
@Autowired
|
||||
private CgFormFieldServiceI cgFormFieldService;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 测试多文件上传列表 页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "list")
|
||||
public ModelAndView list(HttpServletRequest request) {
|
||||
return new ModelAndView("com/jeecg/demo/multiUploadList");
|
||||
}
|
||||
|
||||
/**
|
||||
* easyui AJAX请求数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param dataGrid
|
||||
* @param user
|
||||
*/
|
||||
@RequestMapping(params = "datagrid")
|
||||
public void datagrid(MultiUploadEntity multiUpload,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
|
||||
CriteriaQuery cq = new CriteriaQuery(MultiUploadEntity.class, dataGrid);
|
||||
//查询条件组装器
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, multiUpload, request.getParameterMap());
|
||||
try{
|
||||
//自定义追加查询条件
|
||||
}catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
cq.add();
|
||||
this.multiUploadService.getDataGridReturn(cq, true);
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除测试多文件上传
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(MultiUploadEntity multiUpload, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
multiUpload = systemService.getEntity(MultiUploadEntity.class, multiUpload.getId());
|
||||
message = "测试多文件上传删除成功";
|
||||
try{
|
||||
multiUploadService.delete(multiUpload);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "测试多文件上传删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除测试多文件上传
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doBatchDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "测试多文件上传删除成功";
|
||||
try{
|
||||
for(String id:ids.split(",")){
|
||||
MultiUploadEntity multiUpload = systemService.getEntity(MultiUploadEntity.class,
|
||||
id
|
||||
);
|
||||
multiUploadService.delete(multiUpload);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "测试多文件上传删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加测试多文件上传
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doAdd")
|
||||
@ResponseBody
|
||||
public AjaxJson doAdd(MultiUploadEntity multiUpload, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "测试多文件上传添加成功";
|
||||
try{
|
||||
multiUploadService.save(multiUpload);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "测试多文件上传添加失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
j.setObj(multiUpload);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新测试多文件上传
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson doUpdate(MultiUploadEntity multiUpload, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "测试多文件上传更新成功";
|
||||
MultiUploadEntity t = multiUploadService.get(MultiUploadEntity.class, multiUpload.getId());
|
||||
try {
|
||||
MyBeanUtils.copyBeanNotNull2Bean(multiUpload, t);
|
||||
multiUploadService.saveOrUpdate(t);
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "测试多文件上传更新失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试多文件上传新增页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goAdd")
|
||||
public ModelAndView goAdd(MultiUploadEntity multiUpload, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(multiUpload.getId())) {
|
||||
multiUpload = multiUploadService.getEntity(MultiUploadEntity.class, multiUpload.getId());
|
||||
req.setAttribute("multiUploadPage", multiUpload);
|
||||
}
|
||||
return new ModelAndView("com/jeecg/demo/multiUpload-add");
|
||||
}
|
||||
/**
|
||||
* 测试多文件上传编辑页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goUpdate")
|
||||
public ModelAndView goUpdate(MultiUploadEntity multiUpload, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(multiUpload.getId())) {
|
||||
multiUpload = multiUploadService.getEntity(MultiUploadEntity.class, multiUpload.getId());
|
||||
req.setAttribute("multiUploadPage", multiUpload);
|
||||
}
|
||||
return new ModelAndView("com/jeecg/demo/multiUpload-update");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入功能跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "upload")
|
||||
public ModelAndView upload(HttpServletRequest req) {
|
||||
req.setAttribute("controller_name","multiUploadController");
|
||||
return new ModelAndView("common/upload/pub_excel_upload");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXls")
|
||||
public String exportXls(MultiUploadEntity multiUpload,HttpServletRequest request,HttpServletResponse response
|
||||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
CriteriaQuery cq = new CriteriaQuery(MultiUploadEntity.class, dataGrid);
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, multiUpload, request.getParameterMap());
|
||||
List<MultiUploadEntity> multiUploads = this.multiUploadService.getListByCriteriaQuery(cq,false);
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"测试多文件上传");
|
||||
modelMap.put(NormalExcelConstants.CLASS,MultiUploadEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("测试多文件上传列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,multiUploads);
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
/**
|
||||
* 导出excel 使模板
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXlsByT")
|
||||
public String exportXlsByT(MultiUploadEntity multiUpload,HttpServletRequest request,HttpServletResponse response
|
||||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"测试多文件上传");
|
||||
modelMap.put(NormalExcelConstants.CLASS,MultiUploadEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("测试多文件上传列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
AjaxJson j = new AjaxJson();
|
||||
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile file = entity.getValue();// 获取上传文件对象
|
||||
ImportParams params = new ImportParams();
|
||||
params.setTitleRows(2);
|
||||
params.setHeadRows(1);
|
||||
params.setNeedSave(true);
|
||||
try {
|
||||
List<MultiUploadEntity> listMultiUploadEntitys = ExcelImportUtil.importExcel(file.getInputStream(),MultiUploadEntity.class,params);
|
||||
for (MultiUploadEntity multiUpload : listMultiUploadEntitys) {
|
||||
multiUploadService.save(multiUpload);
|
||||
}
|
||||
j.setMsg("文件导入成功!");
|
||||
} catch (Exception e) {
|
||||
j.setMsg("文件导入失败!");
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}finally{
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件附件信息
|
||||
*
|
||||
* @param id multiUpload主键id
|
||||
*/
|
||||
@RequestMapping(params = "getFiles")
|
||||
@ResponseBody
|
||||
public AjaxJson getFiles(String id){
|
||||
List<CgUploadEntity> uploadBeans = cgFormFieldService.findByProperty(CgUploadEntity.class, "cgformId", id);
|
||||
List<Map<String,Object>> files = new ArrayList<Map<String,Object>>(0);
|
||||
for(CgUploadEntity b:uploadBeans){
|
||||
String title = b.getAttachmenttitle();//附件名
|
||||
String fileKey = b.getId();//附件主键
|
||||
String path = b.getRealpath();//附件路径
|
||||
String field = b.getCgformField();//表单中作为附件控件的字段
|
||||
Map<String, Object> file = new HashMap<String, Object>();
|
||||
file.put("title", title);
|
||||
file.put("fileKey", fileKey);
|
||||
file.put("path", path);
|
||||
file.put("field", field==null?"":field);
|
||||
files.add(file);
|
||||
}
|
||||
AjaxJson j = new AjaxJson();
|
||||
j.setObj(files);
|
||||
return j;
|
||||
}
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public List<MultiUploadEntity> list() {
|
||||
List<MultiUploadEntity> listMultiUploads=multiUploadService.getList(MultiUploadEntity.class);
|
||||
return listMultiUploads;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> get(@PathVariable("id") String id) {
|
||||
MultiUploadEntity task = multiUploadService.get(MultiUploadEntity.class, id);
|
||||
if (task == null) {
|
||||
return new ResponseEntity(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return new ResponseEntity(task, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> create(@RequestBody MultiUploadEntity multiUpload, UriComponentsBuilder uriBuilder) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<MultiUploadEntity>> failures = validator.validate(multiUpload);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
//保存
|
||||
try{
|
||||
multiUploadService.save(multiUpload);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
//按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象.
|
||||
String id = multiUpload.getId();
|
||||
URI uri = uriBuilder.path("/rest/multiUploadController/" + id).build().toUri();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setLocation(uri);
|
||||
|
||||
return new ResponseEntity(headers, HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<?> update(@RequestBody MultiUploadEntity multiUpload) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<MultiUploadEntity>> failures = validator.validate(multiUpload);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
//保存
|
||||
try{
|
||||
multiUploadService.saveOrUpdate(multiUpload);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
//按Restful约定,返回204状态码, 无内容. 也可以返回200状态码.
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
public void delete(@PathVariable("id") String id) {
|
||||
multiUploadService.deleteEntityById(MultiUploadEntity.class, id);
|
||||
}
|
||||
}
|
|
@ -3,13 +3,12 @@ package com.jeecg.demo.dao;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jeecgframework.minidao.annotation.Arguments;
|
||||
import org.jeecgframework.minidao.annotation.MiniDao;
|
||||
import org.jeecgframework.minidao.annotation.ResultType;
|
||||
import org.jeecgframework.minidao.annotation.Sql;
|
||||
import com.jeecg.chat.entity.ChatMessageHistory;
|
||||
import org.jeecgframework.minidao.annotation.*;
|
||||
|
||||
import com.jeecg.demo.entity.JeecgDemoEntity;
|
||||
import com.jeecg.demo.entity.JeecgLogReport;
|
||||
import org.jeecgframework.minidao.pojo.MiniDaoPage;
|
||||
|
||||
/**
|
||||
* Minidao例子
|
||||
|
@ -24,13 +23,11 @@ public interface JeecgMinidaoDao {
|
|||
|
||||
@Sql("select ID,NAME,PID from t_s_region order by name_en")
|
||||
List<Map<String, String>> getAllRegions();
|
||||
|
||||
|
||||
@Arguments({"jeecgDemo", "page", "rows"})
|
||||
@ResultType(JeecgDemoEntity.class)
|
||||
public List<JeecgDemoEntity> getAllEntities(JeecgDemoEntity jeecgDemo, int page, int rows);
|
||||
|
||||
@Sql("SELECT count(*) FROM jeecg_demo")
|
||||
@ResultType(JeecgDemoEntity.class)
|
||||
public MiniDaoPage<JeecgDemoEntity> getAllEntities(@Param("jeecgDemo") JeecgDemoEntity jeecgDemo, @Param("page") int page, @Param("rows") int rows,@Param("authSql") String authSql);
|
||||
|
||||
@Sql("SELECT count(*) FROM jeecg_demo")
|
||||
Integer getCount();
|
||||
|
||||
@Sql("SELECT SUM(salary) FROM jeecg_demo")
|
||||
|
|
|
@ -0,0 +1,287 @@
|
|||
package com.jeecg.demo.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.lang.String;
|
||||
import java.lang.Double;
|
||||
import java.lang.Integer;
|
||||
import java.math.BigDecimal;
|
||||
import javax.xml.soap.Text;
|
||||
import java.sql.Blob;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
|
||||
/**
|
||||
* @Title: Entity
|
||||
* @Description: 测试多文件上传
|
||||
* @author onlineGenerator
|
||||
* @date 2017-07-17 10:50:36
|
||||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "jeecg_multi_upload", schema = "")
|
||||
@SuppressWarnings("serial")
|
||||
public class MultiUploadEntity implements java.io.Serializable {
|
||||
/**主键*/
|
||||
private java.lang.String id;
|
||||
/**创建人名称*/
|
||||
private java.lang.String createName;
|
||||
/**创建人登录名称*/
|
||||
private java.lang.String createBy;
|
||||
/**创建日期*/
|
||||
private java.util.Date createDate;
|
||||
/**更新人名称*/
|
||||
private java.lang.String updateName;
|
||||
/**更新人登录名称*/
|
||||
private java.lang.String updateBy;
|
||||
/**更新日期*/
|
||||
private java.util.Date updateDate;
|
||||
/**所属部门*/
|
||||
private java.lang.String sysOrgCode;
|
||||
/**所属公司*/
|
||||
private java.lang.String sysCompanyCode;
|
||||
/**流程状态*/
|
||||
private java.lang.String bpmStatus;
|
||||
/**测试文件1*/
|
||||
@Excel(name="测试文件1",width=15)
|
||||
private java.lang.String testFile1;
|
||||
/**测试文件2*/
|
||||
@Excel(name="测试文件2",width=15)
|
||||
private java.lang.String testFile2;
|
||||
/**测试文件3*/
|
||||
@Excel(name="测试文件3",width=15)
|
||||
private java.lang.String testFile3;
|
||||
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 主键
|
||||
*/
|
||||
@Id
|
||||
@GeneratedValue(generator = "paymentableGenerator")
|
||||
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
|
||||
|
||||
@Column(name ="ID",nullable=false,length=36)
|
||||
public java.lang.String getId(){
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 主键
|
||||
*/
|
||||
public void setId(java.lang.String id){
|
||||
this.id = id;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 创建人名称
|
||||
*/
|
||||
|
||||
@Column(name ="CREATE_NAME",nullable=true,length=50)
|
||||
public java.lang.String getCreateName(){
|
||||
return this.createName;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 创建人名称
|
||||
*/
|
||||
public void setCreateName(java.lang.String createName){
|
||||
this.createName = createName;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 创建人登录名称
|
||||
*/
|
||||
|
||||
@Column(name ="CREATE_BY",nullable=true,length=50)
|
||||
public java.lang.String getCreateBy(){
|
||||
return this.createBy;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 创建人登录名称
|
||||
*/
|
||||
public void setCreateBy(java.lang.String createBy){
|
||||
this.createBy = createBy;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.util.Date
|
||||
*@return: java.util.Date 创建日期
|
||||
*/
|
||||
|
||||
@Column(name ="CREATE_DATE",nullable=true,length=20)
|
||||
public java.util.Date getCreateDate(){
|
||||
return this.createDate;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.util.Date
|
||||
*@param: java.util.Date 创建日期
|
||||
*/
|
||||
public void setCreateDate(java.util.Date createDate){
|
||||
this.createDate = createDate;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 更新人名称
|
||||
*/
|
||||
|
||||
@Column(name ="UPDATE_NAME",nullable=true,length=50)
|
||||
public java.lang.String getUpdateName(){
|
||||
return this.updateName;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 更新人名称
|
||||
*/
|
||||
public void setUpdateName(java.lang.String updateName){
|
||||
this.updateName = updateName;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 更新人登录名称
|
||||
*/
|
||||
|
||||
@Column(name ="UPDATE_BY",nullable=true,length=50)
|
||||
public java.lang.String getUpdateBy(){
|
||||
return this.updateBy;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 更新人登录名称
|
||||
*/
|
||||
public void setUpdateBy(java.lang.String updateBy){
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.util.Date
|
||||
*@return: java.util.Date 更新日期
|
||||
*/
|
||||
|
||||
@Column(name ="UPDATE_DATE",nullable=true,length=20)
|
||||
public java.util.Date getUpdateDate(){
|
||||
return this.updateDate;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.util.Date
|
||||
*@param: java.util.Date 更新日期
|
||||
*/
|
||||
public void setUpdateDate(java.util.Date updateDate){
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 所属部门
|
||||
*/
|
||||
|
||||
@Column(name ="SYS_ORG_CODE",nullable=true,length=50)
|
||||
public java.lang.String getSysOrgCode(){
|
||||
return this.sysOrgCode;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 所属部门
|
||||
*/
|
||||
public void setSysOrgCode(java.lang.String sysOrgCode){
|
||||
this.sysOrgCode = sysOrgCode;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 所属公司
|
||||
*/
|
||||
|
||||
@Column(name ="SYS_COMPANY_CODE",nullable=true,length=50)
|
||||
public java.lang.String getSysCompanyCode(){
|
||||
return this.sysCompanyCode;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 所属公司
|
||||
*/
|
||||
public void setSysCompanyCode(java.lang.String sysCompanyCode){
|
||||
this.sysCompanyCode = sysCompanyCode;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 流程状态
|
||||
*/
|
||||
|
||||
@Column(name ="BPM_STATUS",nullable=true,length=32)
|
||||
public java.lang.String getBpmStatus(){
|
||||
return this.bpmStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 流程状态
|
||||
*/
|
||||
public void setBpmStatus(java.lang.String bpmStatus){
|
||||
this.bpmStatus = bpmStatus;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 测试文件1
|
||||
*/
|
||||
|
||||
@Column(name ="TEST_FILE_1",nullable=true,length=256)
|
||||
public java.lang.String getTestFile1(){
|
||||
return this.testFile1;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 测试文件1
|
||||
*/
|
||||
public void setTestFile1(java.lang.String testFile1){
|
||||
this.testFile1 = testFile1;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 测试文件2
|
||||
*/
|
||||
|
||||
@Column(name ="TEST_FILE_2",nullable=true,length=256)
|
||||
public java.lang.String getTestFile2(){
|
||||
return this.testFile2;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 测试文件2
|
||||
*/
|
||||
public void setTestFile2(java.lang.String testFile2){
|
||||
this.testFile2 = testFile2;
|
||||
}
|
||||
/**
|
||||
*方法: 取得java.lang.String
|
||||
*@return: java.lang.String 测试文件3
|
||||
*/
|
||||
|
||||
@Column(name ="TEST_FILE_3",nullable=true,length=256)
|
||||
public java.lang.String getTestFile3(){
|
||||
return this.testFile3;
|
||||
}
|
||||
|
||||
/**
|
||||
*方法: 设置java.lang.String
|
||||
*@param: java.lang.String 测试文件3
|
||||
*/
|
||||
public void setTestFile3(java.lang.String testFile3){
|
||||
this.testFile3 = testFile3;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.jeecg.demo.entity;
|
||||
// default package
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
import org.jeecgframework.web.system.pojo.base.TSAttachment;
|
||||
import org.jeecgframework.web.system.pojo.base.TSType;
|
||||
|
||||
/**
|
||||
* 文档下载,新闻,法规表
|
||||
* @author 张代浩
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "t_s_document")
|
||||
@PrimaryKeyJoinColumn(name = "id")
|
||||
public class TSDocument extends TSAttachment implements java.io.Serializable {
|
||||
private String documentTitle;//文档标题
|
||||
private byte[] pictureIndex;//焦点图导航
|
||||
private Short documentState;//状态:0未发布,1已发布
|
||||
private Short showHome;//是否首页显示
|
||||
private TSType TSType;//文档分类
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "typeid")
|
||||
public TSType getTSType() {
|
||||
return TSType;
|
||||
}
|
||||
public void setTSType(TSType tSType) {
|
||||
TSType = tSType;
|
||||
}
|
||||
@Column(name = "documenttitle", length = 100)
|
||||
public String getDocumentTitle() {
|
||||
return documentTitle;
|
||||
}
|
||||
public void setDocumentTitle(String documentTitle) {
|
||||
this.documentTitle = documentTitle;
|
||||
}
|
||||
@Column(name = "pictureindex",length=3000)
|
||||
public byte[] getPictureIndex() {
|
||||
return pictureIndex;
|
||||
}
|
||||
public void setPictureIndex(byte[] pictureIndex) {
|
||||
this.pictureIndex = pictureIndex;
|
||||
}
|
||||
@Column(name = "documentstate")
|
||||
public Short getDocumentState() {
|
||||
return documentState;
|
||||
}
|
||||
public void setDocumentState(Short documentState) {
|
||||
this.documentState = documentState;
|
||||
}
|
||||
@Column(name = "showhome")
|
||||
public Short getShowHome() {
|
||||
return showHome;
|
||||
}
|
||||
public void setShowHome(Short showHome) {
|
||||
this.showHome = showHome;
|
||||
}
|
||||
}
|
|
@ -11,7 +11,8 @@ public interface JeecgDemoServiceI extends CommonService{
|
|||
public Serializable save(JeecgDemoEntity entity) throws Exception;
|
||||
|
||||
public void saveOrUpdate(JeecgDemoEntity entity) throws Exception;
|
||||
public void jdbcBatchSave() throws Exception;
|
||||
|
||||
|
||||
|
||||
public void jdbcProcedure() throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.jeecg.demo.service;
|
||||
import org.jeecgframework.core.common.service.CommonService;
|
||||
|
||||
import com.jeecg.demo.entity.MultiUploadEntity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface MultiUploadServiceI extends CommonService{
|
||||
|
||||
public void delete(MultiUploadEntity entity) throws Exception;
|
||||
|
||||
public Serializable save(MultiUploadEntity entity) throws Exception;
|
||||
|
||||
public void saveOrUpdate(MultiUploadEntity entity) throws Exception;
|
||||
|
||||
}
|
|
@ -1,25 +1,38 @@
|
|||
package com.jeecg.demo.service.impl;
|
||||
import com.jeecg.demo.service.JeecgDemoServiceI;
|
||||
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
|
||||
import com.jeecg.demo.entity.JeecgDemoEntity;
|
||||
|
||||
import org.springframework.dao.support.DaoSupport;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jeecgframework.core.common.dao.jdbc.JdbcDao;
|
||||
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.jeecgframework.core.util.DateUtils;
|
||||
import org.jeecgframework.core.util.MyClassLoader;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.web.cgform.enhance.CgformEnhanceJavaInter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.jeecg.demo.entity.JeecgDemoEntity;
|
||||
import com.jeecg.demo.service.JeecgDemoServiceI;
|
||||
|
||||
@Service("jeecgDemoService")
|
||||
@Transactional
|
||||
public class JeecgDemoServiceImpl extends CommonServiceImpl implements JeecgDemoServiceI {
|
||||
private static final Logger logger = Logger.getLogger(JeecgDemoServiceImpl.class);
|
||||
@Autowired
|
||||
private JdbcDao jdbcDao;
|
||||
|
||||
|
||||
|
||||
public void delete(JeecgDemoEntity entity) throws Exception{
|
||||
super.delete(entity);
|
||||
//执行删除操作增强业务
|
||||
|
@ -134,4 +147,49 @@ public class JeecgDemoServiceImpl extends CommonServiceImpl implements JeecgDemo
|
|||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* JDBC批量添加
|
||||
*/
|
||||
@Override
|
||||
public void jdbcBatchSave() throws Exception {
|
||||
final List<JeecgDemoEntity> jeecgDemoList=new ArrayList<JeecgDemoEntity>();
|
||||
for(int i=0;i<1000;i++){
|
||||
JeecgDemoEntity jeecgDemo=new JeecgDemoEntity();
|
||||
jeecgDemo.setId(UUID.randomUUID().toString().replaceAll("-", ""));
|
||||
jeecgDemo.setName("批量测试"+i);
|
||||
jeecgDemo.setAge(10);
|
||||
jeecgDemoList.add(jeecgDemo);
|
||||
}
|
||||
String sql="insert into jeecg_demo (id,name,age,create_date) values (?,?,?,?)";
|
||||
logger.info("-------批处理sql ----"+ sql);
|
||||
jdbcDao.batchUpdate(sql, new BatchPreparedStatementSetter()
|
||||
{
|
||||
public void setValues(PreparedStatement ps,int i)throws SQLException
|
||||
{
|
||||
String id=jeecgDemoList.get(i).getId();
|
||||
String name=jeecgDemoList.get(i).getName();
|
||||
int age=jeecgDemoList.get(i).getAge();
|
||||
ps.setString(1, id);
|
||||
ps.setString(2, name);
|
||||
ps.setInt(3, age);
|
||||
ps.setString(4, DateUtils.date2Str(new SimpleDateFormat("yyyy-MM-dd HH:mm")));
|
||||
}
|
||||
public int getBatchSize()
|
||||
{
|
||||
return jeecgDemoList.size();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行存储过程
|
||||
*/
|
||||
@Override
|
||||
public void jdbcProcedure() throws Exception {
|
||||
String sql = "call delete_jeecgDemo_createDate('"+DateUtils.getDate("yyyy-MM-dd")+"')";
|
||||
logger.info("-------执行存储过程--sql ----"+ sql);
|
||||
jdbcDao.execute(sql);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
package com.jeecg.demo.service.impl;
|
||||
import com.jeecg.demo.entity.MultiUploadEntity;
|
||||
import com.jeecg.demo.service.MultiUploadServiceI;
|
||||
|
||||
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.io.Serializable;
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.jeecgframework.core.util.MyClassLoader;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.web.cgform.enhance.CgformEnhanceJavaInter;
|
||||
|
||||
@Service("multiUploadService")
|
||||
@Transactional
|
||||
public class MultiUploadServiceImpl extends CommonServiceImpl implements MultiUploadServiceI {
|
||||
|
||||
|
||||
public void delete(MultiUploadEntity entity) throws Exception{
|
||||
super.delete(entity);
|
||||
//执行删除操作增强业务
|
||||
this.doDelBus(entity);
|
||||
}
|
||||
|
||||
public Serializable save(MultiUploadEntity entity) throws Exception{
|
||||
Serializable t = super.save(entity);
|
||||
//执行新增操作增强业务
|
||||
this.doAddBus(entity);
|
||||
return t;
|
||||
}
|
||||
|
||||
public void saveOrUpdate(MultiUploadEntity entity) throws Exception{
|
||||
super.saveOrUpdate(entity);
|
||||
//执行更新操作增强业务
|
||||
this.doUpdateBus(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增操作增强业务
|
||||
* @param t
|
||||
* @return
|
||||
*/
|
||||
private void doAddBus(MultiUploadEntity t) throws Exception{
|
||||
}
|
||||
/**
|
||||
* 更新操作增强业务
|
||||
* @param t
|
||||
* @return
|
||||
*/
|
||||
private void doUpdateBus(MultiUploadEntity t) throws Exception{
|
||||
}
|
||||
/**
|
||||
* 删除操作增强业务
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
private void doDelBus(MultiUploadEntity t) throws Exception{
|
||||
}
|
||||
|
||||
private Map<String,Object> populationMap(MultiUploadEntity t){
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
map.put("id", t.getId());
|
||||
map.put("create_name", t.getCreateName());
|
||||
map.put("create_by", t.getCreateBy());
|
||||
map.put("create_date", t.getCreateDate());
|
||||
map.put("update_name", t.getUpdateName());
|
||||
map.put("update_by", t.getUpdateBy());
|
||||
map.put("update_date", t.getUpdateDate());
|
||||
map.put("sys_org_code", t.getSysOrgCode());
|
||||
map.put("sys_company_code", t.getSysCompanyCode());
|
||||
map.put("bpm_status", t.getBpmStatus());
|
||||
map.put("test_file_1", t.getTestFile1());
|
||||
map.put("test_file_2", t.getTestFile2());
|
||||
map.put("test_file_3", t.getTestFile3());
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换sql中的变量
|
||||
* @param sql
|
||||
* @param t
|
||||
* @return
|
||||
*/
|
||||
public String replaceVal(String sql,MultiUploadEntity t){
|
||||
sql = sql.replace("#{id}",String.valueOf(t.getId()));
|
||||
sql = sql.replace("#{create_name}",String.valueOf(t.getCreateName()));
|
||||
sql = sql.replace("#{create_by}",String.valueOf(t.getCreateBy()));
|
||||
sql = sql.replace("#{create_date}",String.valueOf(t.getCreateDate()));
|
||||
sql = sql.replace("#{update_name}",String.valueOf(t.getUpdateName()));
|
||||
sql = sql.replace("#{update_by}",String.valueOf(t.getUpdateBy()));
|
||||
sql = sql.replace("#{update_date}",String.valueOf(t.getUpdateDate()));
|
||||
sql = sql.replace("#{sys_org_code}",String.valueOf(t.getSysOrgCode()));
|
||||
sql = sql.replace("#{sys_company_code}",String.valueOf(t.getSysCompanyCode()));
|
||||
sql = sql.replace("#{bpm_status}",String.valueOf(t.getBpmStatus()));
|
||||
sql = sql.replace("#{test_file_1}",String.valueOf(t.getTestFile1()));
|
||||
sql = sql.replace("#{test_file_2}",String.valueOf(t.getTestFile2()));
|
||||
sql = sql.replace("#{test_file_3}",String.valueOf(t.getTestFile3()));
|
||||
sql = sql.replace("#{UUID}",UUID.randomUUID().toString());
|
||||
return sql;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行JAVA增强
|
||||
*/
|
||||
private void executeJavaExtend(String cgJavaType,String cgJavaValue,Map<String,Object> data) throws Exception {
|
||||
if(StringUtil.isNotEmpty(cgJavaValue)){
|
||||
Object obj = null;
|
||||
try {
|
||||
if("class".equals(cgJavaType)){
|
||||
//因新增时已经校验了实例化是否可以成功,所以这块就不需要再做一次判断
|
||||
obj = MyClassLoader.getClassByScn(cgJavaValue).newInstance();
|
||||
}else if("spring".equals(cgJavaType)){
|
||||
obj = ApplicationContextUtil.getContext().getBean(cgJavaValue);
|
||||
}
|
||||
if(obj instanceof CgformEnhanceJavaInter){
|
||||
CgformEnhanceJavaInter javaInter = (CgformEnhanceJavaInter) obj;
|
||||
javaInter.execute("multi_upload",data);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new Exception("执行JAVA增强出现异常!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,3 +23,6 @@ SELECT * FROM jeecg_demo WHERE 1=1
|
|||
<#if jeecgDemo.status ?exists && jeecgDemo.status ?length gt 0>
|
||||
and status = :jeecgDemo.status
|
||||
</#if>
|
||||
<#if authSql ?exists && authSql ?length gt 0>
|
||||
${authSql}
|
||||
</#if>
|
||||
|
|
|
@ -29,6 +29,6 @@ b.username as name,
|
|||
FROM
|
||||
t_s_log a join t_s_base_user b on b.id=a.userid
|
||||
GROUP BY
|
||||
a.userid
|
||||
a.userid,b.username
|
||||
ORDER BY
|
||||
ct DESC
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package com.jeecg.p3.demo.dao;
|
||||
|
||||
import org.jeecgframework.minidao.annotation.Param;
|
||||
import org.jeecgframework.minidao.annotation.ResultType;
|
||||
import org.jeecgframework.minidao.annotation.Sql;
|
||||
import org.jeecgframework.minidao.pojo.MiniDaoPage;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.jeecg.p3.demo.entity.JeecgP3demoEntity;
|
||||
|
||||
/**
|
||||
* 描述:P3测试表
|
||||
* @author:www.jeecg.org
|
||||
* @since:2017年05月15日 20时07分37秒 星期一
|
||||
* @version:1.0
|
||||
*/
|
||||
@Repository
|
||||
public interface JeecgP3demoDao{
|
||||
|
||||
/**
|
||||
* 查询返回Java对象
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Sql("SELECT * FROM jeecg_p3demo WHERE ID = :id")
|
||||
JeecgP3demoEntity get(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
* @param jeecgP3demo
|
||||
* @return
|
||||
*/
|
||||
int update(@Param("jeecgP3demo") JeecgP3demoEntity jeecgP3demo);
|
||||
|
||||
/**
|
||||
* 插入数据
|
||||
* @param act
|
||||
*/
|
||||
void insert(@Param("jeecgP3demo") JeecgP3demoEntity jeecgP3demo);
|
||||
|
||||
/**
|
||||
* 通用分页方法,支持(oracle、mysql、SqlServer、postgresql)
|
||||
* @param jeecgP3demo
|
||||
* @param page
|
||||
* @param rows
|
||||
* @return
|
||||
*/
|
||||
@ResultType(JeecgP3demoEntity.class)
|
||||
public MiniDaoPage<JeecgP3demoEntity> getAll(@Param("jeecgP3demo") JeecgP3demoEntity jeecgP3demo,@Param("page") int page,@Param("rows") int rows);
|
||||
|
||||
@Sql("DELETE from jeecg_p3demo WHERE ID = :jeecgP3demo.id")
|
||||
public void delete(@Param("jeecgP3demo") JeecgP3demoEntity jeecgP3demo);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.jeecg.p3.demo.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 描述:P3测试表
|
||||
* @author: www.jeecg.org
|
||||
* @since:2017年05月15日 20时07分37秒 星期一
|
||||
* @version:1.0
|
||||
*/
|
||||
public class JeecgP3demoEntity implements Serializable{
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
*id
*/
private String id;
/**
*创建人名称
*/
private String createName;
/**
*创建人登录名称
*/
private String createBy;
/**
*创建日期
*/
private Date createDate;
/**
*更新人名称
*/
private String updateName;
/**
*更新人登录名称
*/
private String updateBy;
/**
*更新日期
*/
private Date updateDate;
/**
*所属部门
*/
private String sysOrgCode;
/**
*所属公司
*/
private String sysCompanyCode;
/**
*流程状态
*/
private String bpmStatus;
/**
*姓名
*/
private String name;
/**
*性别
*/
private Integer sex;
/**
*年龄
*/
private Integer age;
/**
*地址
*/
private String address;
/**
*电话
*/
private String phone;
/**
*备注
*/
private String memo;
public String getId() {
return this.id;
}
public void setId(String id) {
this.id=id;
}
public String getCreateName() {
return this.createName;
}
public void setCreateName(String createName) {
this.createName=createName;
}
public String getCreateBy() {
return this.createBy;
}
public void setCreateBy(String createBy) {
this.createBy=createBy;
}
public Date getCreateDate() {
return this.createDate;
}
public void setCreateDate(Date createDate) {
this.createDate=createDate;
}
public String getUpdateName() {
return this.updateName;
}
public void setUpdateName(String updateName) {
this.updateName=updateName;
}
public String getUpdateBy() {
return this.updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy=updateBy;
}
public Date getUpdateDate() {
return this.updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate=updateDate;
}
public String getSysOrgCode() {
return this.sysOrgCode;
}
public void setSysOrgCode(String sysOrgCode) {
this.sysOrgCode=sysOrgCode;
}
public String getSysCompanyCode() {
return this.sysCompanyCode;
}
public void setSysCompanyCode(String sysCompanyCode) {
this.sysCompanyCode=sysCompanyCode;
}
public String getBpmStatus() {
return this.bpmStatus;
}
public void setBpmStatus(String bpmStatus) {
this.bpmStatus=bpmStatus;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name=name;
}
public Integer getSex() {
return this.sex;
}
public void setSex(Integer sex) {
this.sex=sex;
}
public Integer getAge() {
return this.age;
}
public void setAge(Integer age) {
this.age=age;
}
public String getAddress() {
return this.address;
}
public void setAddress(String address) {
this.address=address;
}
public String getPhone() {
return this.phone;
}
public void setPhone(String phone) {
this.phone=phone;
}
public String getMemo() {
return this.memo;
}
public void setMemo(String memo) {
this.memo=memo;
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.jeecg.p3.demo.service;
|
||||
|
||||
import org.jeecgframework.minidao.pojo.MiniDaoPage;
|
||||
|
||||
import com.jeecg.p3.demo.entity.JeecgP3demoEntity;
|
||||
|
||||
/**
|
||||
* 描述:P3测试表
|
||||
* @author: www.jeecg.org
|
||||
* @since:2017年05月15日 20时07分37秒 星期一
|
||||
* @version:1.0
|
||||
*/
|
||||
public interface JeecgP3demoService {
|
||||
|
||||
public JeecgP3demoEntity get(String id);
|
||||
|
||||
public int update(JeecgP3demoEntity jeecgP3demo);
|
||||
|
||||
public void insert(JeecgP3demoEntity jeecgP3demo);
|
||||
|
||||
public MiniDaoPage<JeecgP3demoEntity> getAll(JeecgP3demoEntity jeecgP3demo,int page,int rows);
|
||||
|
||||
public void delete(JeecgP3demoEntity jeecgP3demo);
|
||||
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.jeecg.p3.demo.service.impl;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.jeecgframework.minidao.pojo.MiniDaoPage;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.jeecg.p3.demo.dao.JeecgP3demoDao;
|
||||
import com.jeecg.p3.demo.entity.JeecgP3demoEntity;
|
||||
import com.jeecg.p3.demo.service.JeecgP3demoService;
|
||||
|
||||
/**
|
||||
* 描述:P3测试表
|
||||
* @author: www.jeecg.org
|
||||
* @since:2017年05月15日 20时07分37秒 星期一
|
||||
* @version:1.0
|
||||
*/
|
||||
|
||||
@Service("jeecgP3demoService")
|
||||
public class JeecgP3demoServiceImpl implements JeecgP3demoService {
|
||||
@Resource
|
||||
private JeecgP3demoDao jeecgP3demoDao;
|
||||
|
||||
@Override
|
||||
public JeecgP3demoEntity get(String id) {
|
||||
return jeecgP3demoDao.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(JeecgP3demoEntity jeecgP3demo) {
|
||||
return jeecgP3demoDao.update(jeecgP3demo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void insert(JeecgP3demoEntity jeecgP3demo) {
|
||||
jeecgP3demoDao.insert(jeecgP3demo);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public MiniDaoPage<JeecgP3demoEntity> getAll(JeecgP3demoEntity jeecgP3demo, int page, int rows) {
|
||||
return jeecgP3demoDao.getAll(jeecgP3demo, page, rows);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(JeecgP3demoEntity jeecgP3demo) {
|
||||
jeecgP3demoDao.delete(jeecgP3demo);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
<#if ( jeecgP3demo.createName )?? && jeecgP3demo.createName ?length gt 0>
|
||||
/* 创建人名称 */
|
||||
and jp.create_name = :jeecgP3demo.createName
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.createBy )?? && jeecgP3demo.createBy ?length gt 0>
|
||||
/* 创建人登录名称 */
|
||||
and jp.create_by = :jeecgP3demo.createBy
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.createDate )??>
|
||||
/* 创建日期 */
|
||||
and jp.create_date = :jeecgP3demo.createDate
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.updateName )?? && jeecgP3demo.updateName ?length gt 0>
|
||||
/* 更新人名称 */
|
||||
and jp.update_name = :jeecgP3demo.updateName
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.updateBy )?? && jeecgP3demo.updateBy ?length gt 0>
|
||||
/* 更新人登录名称 */
|
||||
and jp.update_by = :jeecgP3demo.updateBy
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.updateDate )??>
|
||||
/* 更新日期 */
|
||||
and jp.update_date = :jeecgP3demo.updateDate
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.sysOrgCode )?? && jeecgP3demo.sysOrgCode ?length gt 0>
|
||||
/* 所属部门 */
|
||||
and jp.sys_org_code = :jeecgP3demo.sysOrgCode
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.sysCompanyCode )?? && jeecgP3demo.sysCompanyCode ?length gt 0>
|
||||
/* 所属公司 */
|
||||
and jp.sys_company_code = :jeecgP3demo.sysCompanyCode
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.bpmStatus )?? && jeecgP3demo.bpmStatus ?length gt 0>
|
||||
/* 流程状态 */
|
||||
and jp.bpm_status = :jeecgP3demo.bpmStatus
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.name )?? && jeecgP3demo.name ?length gt 0>
|
||||
/* 姓名 */
|
||||
and jp.name = :jeecgP3demo.name
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.sex )?? && jeecgP3demo.sex ?length gt 0>
|
||||
/* 性别 */
|
||||
and jp.sex = :jeecgP3demo.sex
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.age )?? && jeecgP3demo.age ?length gt 0>
|
||||
/* 年龄 */
|
||||
and jp.age = :jeecgP3demo.age
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.address )?? && jeecgP3demo.address ?length gt 0>
|
||||
/* 地址 */
|
||||
and jp.address = :jeecgP3demo.address
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.phone )?? && jeecgP3demo.phone ?length gt 0>
|
||||
/* 电话 */
|
||||
and jp.phone = :jeecgP3demo.phone
|
||||
</#if>
|
||||
<#if ( jeecgP3demo.memo )?? && jeecgP3demo.memo ?length gt 0>
|
||||
/* 备注 */
|
||||
and jp.memo = :jeecgP3demo.memo
|
||||
</#if>
|
|
@ -0,0 +1,2 @@
|
|||
SELECT * FROM jeecg_p3demo jp where 1=1
|
||||
<#include "JeecgP3demoDao_condition.sql">
|
|
@ -0,0 +1,39 @@
|
|||
INSERT INTO
|
||||
jeecg_p3demo
|
||||
(
|
||||
id
|
||||
,create_name
|
||||
,create_by
|
||||
,create_date
|
||||
,update_name
|
||||
,update_by
|
||||
,update_date
|
||||
,sys_org_code
|
||||
,sys_company_code
|
||||
,bpm_status
|
||||
,name
|
||||
,sex
|
||||
,age
|
||||
,address
|
||||
,phone
|
||||
,memo
|
||||
)
|
||||
values
|
||||
(
|
||||
:jeecgP3demo.id
|
||||
,:jeecgP3demo.createName
|
||||
,:jeecgP3demo.createBy
|
||||
,:jeecgP3demo.createDate
|
||||
,:jeecgP3demo.updateName
|
||||
,:jeecgP3demo.updateBy
|
||||
,:jeecgP3demo.updateDate
|
||||
,:jeecgP3demo.sysOrgCode
|
||||
,:jeecgP3demo.sysCompanyCode
|
||||
,:jeecgP3demo.bpmStatus
|
||||
,:jeecgP3demo.name
|
||||
,:jeecgP3demo.sex
|
||||
,:jeecgP3demo.age
|
||||
,:jeecgP3demo.address
|
||||
,:jeecgP3demo.phone
|
||||
,:jeecgP3demo.memo
|
||||
)
|
|
@ -0,0 +1,48 @@
|
|||
UPDATE jeecg_p3demo
|
||||
SET
|
||||
<#if jeecgP3demo.createName ?exists>
|
||||
create_name = :jeecgP3demo.createName,
|
||||
</#if>
|
||||
<#if jeecgP3demo.createBy ?exists>
|
||||
create_by = :jeecgP3demo.createBy,
|
||||
</#if>
|
||||
<#if jeecgP3demo.createDate ?exists>
|
||||
create_date = :jeecgP3demo.createDate,
|
||||
</#if>
|
||||
<#if jeecgP3demo.updateName ?exists>
|
||||
update_name = :jeecgP3demo.updateName,
|
||||
</#if>
|
||||
<#if jeecgP3demo.updateBy ?exists>
|
||||
update_by = :jeecgP3demo.updateBy,
|
||||
</#if>
|
||||
<#if jeecgP3demo.updateDate ?exists>
|
||||
update_date = :jeecgP3demo.updateDate,
|
||||
</#if>
|
||||
<#if jeecgP3demo.sysOrgCode ?exists>
|
||||
sys_org_code = :jeecgP3demo.sysOrgCode,
|
||||
</#if>
|
||||
<#if jeecgP3demo.sysCompanyCode ?exists>
|
||||
sys_company_code = :jeecgP3demo.sysCompanyCode,
|
||||
</#if>
|
||||
<#if jeecgP3demo.bpmStatus ?exists>
|
||||
bpm_status = :jeecgP3demo.bpmStatus,
|
||||
</#if>
|
||||
<#if jeecgP3demo.name ?exists>
|
||||
name = :jeecgP3demo.name,
|
||||
</#if>
|
||||
<#if jeecgP3demo.sex ?exists>
|
||||
sex = :jeecgP3demo.sex,
|
||||
</#if>
|
||||
<#if jeecgP3demo.age ?exists>
|
||||
age = :jeecgP3demo.age,
|
||||
</#if>
|
||||
<#if jeecgP3demo.address ?exists>
|
||||
address = :jeecgP3demo.address,
|
||||
</#if>
|
||||
<#if jeecgP3demo.phone ?exists>
|
||||
phone = :jeecgP3demo.phone,
|
||||
</#if>
|
||||
<#if jeecgP3demo.memo ?exists>
|
||||
memo = :jeecgP3demo.memo,
|
||||
</#if>
|
||||
WHERE id = :jeecgP3demo.id
|
|
@ -0,0 +1,160 @@
|
|||
package com.jeecg.p3.demo.web;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.velocity.VelocityContext;
|
||||
import org.jeecgframework.minidao.pojo.MiniDaoPage;
|
||||
import org.jeecgframework.p3.core.common.utils.AjaxJson;
|
||||
import org.jeecgframework.p3.core.page.SystemTools;
|
||||
import org.jeecgframework.p3.core.util.plugin.ViewVelocity;
|
||||
import org.jeecgframework.p3.core.web.BaseController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.jeecg.p3.demo.entity.JeecgP3demoEntity;
|
||||
import com.jeecg.p3.demo.service.JeecgP3demoService;
|
||||
|
||||
/**
|
||||
* 描述:P3测试表
|
||||
* @author: www.jeecg.org
|
||||
* @since:2017年05月15日 20时07分37秒 星期一
|
||||
* @version:1.0
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/demo/jeecgP3demo")
|
||||
public class JeecgP3demoController extends BaseController{
|
||||
@Autowired
|
||||
private JeecgP3demoService jeecgP3demoService;
|
||||
|
||||
/**
|
||||
* 列表页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "list",method = {RequestMethod.GET,RequestMethod.POST})
|
||||
public void list(@ModelAttribute JeecgP3demoEntity query,HttpServletRequest request,HttpServletResponse response,
|
||||
@RequestParam(required = false, value = "pageNo", defaultValue = "1") int pageNo,
|
||||
@RequestParam(required = false, value = "pageSize", defaultValue = "10") int pageSize) throws Exception{
|
||||
try {
|
||||
LOG.info(request, " back list");
|
||||
//分页数据
|
||||
MiniDaoPage<JeecgP3demoEntity> list = jeecgP3demoService.getAll(query,pageNo,pageSize);
|
||||
VelocityContext velocityContext = new VelocityContext();
|
||||
velocityContext.put("jeecgP3demo",query);
|
||||
velocityContext.put("pageInfos",SystemTools.convertPaginatedList(list));
|
||||
String viewName = "demo/p3/jeecgP3demo-list.vm";
|
||||
ViewVelocity.view(request,response,viewName,velocityContext);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params="toDetail",method = RequestMethod.GET)
|
||||
public void jeecgP3demoDetail(@RequestParam(required = true, value = "id" ) String id,HttpServletResponse response,HttpServletRequest request)throws Exception{
|
||||
VelocityContext velocityContext = new VelocityContext();
|
||||
String viewName = "demo/p3/jeecgP3demo-detail.vm";
|
||||
JeecgP3demoEntity jeecgP3demo = jeecgP3demoService.get(id);
|
||||
velocityContext.put("jeecgP3demo",jeecgP3demo);
|
||||
ViewVelocity.view(request,response,viewName,velocityContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到添加页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "toAdd",method ={RequestMethod.GET, RequestMethod.POST})
|
||||
public void toAddDialog(HttpServletRequest request,HttpServletResponse response)throws Exception{
|
||||
VelocityContext velocityContext = new VelocityContext();
|
||||
String viewName = "demo/p3/jeecgP3demo-add.vm";
|
||||
ViewVelocity.view(request,response,viewName,velocityContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存信息
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doAdd",method ={RequestMethod.GET, RequestMethod.POST})
|
||||
@ResponseBody
|
||||
public AjaxJson doAdd(@ModelAttribute JeecgP3demoEntity jeecgP3demo){
|
||||
AjaxJson j = new AjaxJson();
|
||||
try {
|
||||
String randomSeed = UUID.randomUUID().toString().replaceAll("-", "").toUpperCase();
|
||||
jeecgP3demo.setId(randomSeed);
|
||||
jeecgP3demoService.insert(jeecgP3demo);
|
||||
j.setMsg("保存成功");
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
j.setSuccess(false);
|
||||
j.setMsg("保存失败");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到编辑页面
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params="toEdit",method = RequestMethod.GET)
|
||||
public void toEdit(@RequestParam(required = true, value = "id" ) String id,HttpServletResponse response,HttpServletRequest request) throws Exception{
|
||||
VelocityContext velocityContext = new VelocityContext();
|
||||
JeecgP3demoEntity jeecgP3demo = jeecgP3demoService.get(id);
|
||||
velocityContext.put("jeecgP3demo",jeecgP3demo);
|
||||
String viewName = "demo/p3/jeecgP3demo-edit.vm";
|
||||
ViewVelocity.view(request,response,viewName,velocityContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doEdit",method ={RequestMethod.GET, RequestMethod.POST})
|
||||
@ResponseBody
|
||||
public AjaxJson doEdit(@ModelAttribute JeecgP3demoEntity jeecgP3demo){
|
||||
AjaxJson j = new AjaxJson();
|
||||
try {
|
||||
jeecgP3demoService.update(jeecgP3demo);
|
||||
j.setMsg("编辑成功");
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
j.setSuccess(false);
|
||||
j.setMsg("编辑失败");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params="doDelete",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public AjaxJson doDelete(@RequestParam(required = true, value = "id" ) String id){
|
||||
AjaxJson j = new AjaxJson();
|
||||
try {
|
||||
JeecgP3demoEntity jeecgP3demo = new JeecgP3demoEntity();
|
||||
jeecgP3demo.setId(id);
|
||||
jeecgP3demoService.delete(jeecgP3demo);
|
||||
j.setMsg("删除成功");
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
j.setSuccess(false);
|
||||
j.setMsg("删除失败");
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package org.jeecgframework.core.annotation;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.jeecgframework.core.enums.Permission;
|
||||
|
||||
/**
|
||||
*jeecg权限认证注解
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE,ElementType.METHOD})
|
||||
@Documented
|
||||
public @interface JAuth {
|
||||
String value() default "";
|
||||
Permission auth() default Permission.NORMAL;
|
||||
}
|
|
@ -28,7 +28,7 @@ public boolean onSave(Object entity, Serializable id, Object[] state,
|
|||
String[] propertyNames, Type[] types) {
|
||||
TSUser currentUser = null;
|
||||
try {
|
||||
currentUser = ResourceUtil.getSessionUserName();
|
||||
currentUser = ResourceUtil.getSessionUser();
|
||||
} catch (RuntimeException e) {
|
||||
//logger.warn("当前session为空,无法获取用户");
|
||||
}
|
||||
|
@ -94,6 +94,15 @@ public boolean onSave(Object entity, Serializable id, Object[] state,
|
|||
}
|
||||
continue;
|
||||
}
|
||||
/*找到名为"流程状态"的属性*/
|
||||
else if (DataBaseConstant.BPM_STATUS.equals(propertyNames[index]))
|
||||
{
|
||||
/*使用拦截器将对象的"流程状态"属性赋上值*/
|
||||
if(oConvertUtils.isEmpty(state[index])){
|
||||
state[index] = String.valueOf(1);//1:未提交
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -107,7 +116,7 @@ public boolean onFlushDirty(Object entity, Serializable id,
|
|||
String[] propertyNames, Type[] types) {
|
||||
TSUser currentUser = null;
|
||||
try {
|
||||
currentUser = ResourceUtil.getSessionUserName();
|
||||
currentUser = ResourceUtil.getSessionUser();
|
||||
} catch (RuntimeException e1) {
|
||||
//logger.warn("当前session为空,无法获取用户");
|
||||
}
|
||||
|
|
|
@ -236,9 +236,11 @@ public interface IGenericBaseCommonDao {
|
|||
* @param isOffset
|
||||
* @return
|
||||
*/
|
||||
public DataGridReturn getDataGridReturn(final CriteriaQuery cq,
|
||||
|
||||
public void getDataGridReturn(CriteriaQuery cq,
|
||||
final boolean isOffset);
|
||||
|
||||
|
||||
/**
|
||||
* 执行SQL
|
||||
*/
|
||||
|
|
|
@ -106,7 +106,9 @@ public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGene
|
|||
@SuppressWarnings("unchecked")
|
||||
public Object uploadFile(UploadFile uploadFile) {
|
||||
Object object = uploadFile.getObject();
|
||||
if(uploadFile.getFileKey()!=null)
|
||||
|
||||
if(uploadFile.getFileKey()!=null && !"TSDocument".equals(object.getClass().getSimpleName()))
|
||||
|
||||
{
|
||||
updateEntitie(object);
|
||||
}
|
||||
|
|
|
@ -689,8 +689,9 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
/**
|
||||
* 返回easyui datagrid DataGridReturn模型对象
|
||||
*/
|
||||
public DataGridReturn getDataGridReturn(final CriteriaQuery cq,
|
||||
final boolean isOffset) {
|
||||
|
||||
public void getDataGridReturn(CriteriaQuery cq,final boolean isOffset) {
|
||||
|
||||
Criteria criteria = cq.getDetachedCriteria().getExecutableCriteria(getSession());
|
||||
CriteriaImpl impl = (CriteriaImpl) criteria;
|
||||
// 先把Projection和OrderBy条件取出来,清空两者来执行Count操作
|
||||
|
@ -741,10 +742,15 @@ public abstract class GenericBaseCommonDao<T, PK extends Serializable>
|
|||
}
|
||||
// DetachedCriteriaUtil.selectColumn(cq.getDetachedCriteria(),
|
||||
// cq.getField().split(","), cq.getClass1(), false);
|
||||
List list = criteria.list();
|
||||
List<?> list = criteria.list();
|
||||
cq.getDataGrid().setResults(list);
|
||||
cq.getDataGrid().setTotal(allCounts);
|
||||
return new DataGridReturn(allCounts, list);
|
||||
|
||||
cq.clear();
|
||||
cq = null;
|
||||
|
||||
//return new DataGridReturn(allCounts, list);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,8 +19,8 @@ import org.springframework.util.Assert;
|
|||
*
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class SimpleJdbcTemplate {
|
||||
|
||||
public class SimpleJdbcTemplate extends JdbcTemplate{
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
protected JdbcTemplate jdbcTemplate;
|
||||
|
|
|
@ -703,18 +703,21 @@ public class CriteriaQuery {
|
|||
public void clear(){
|
||||
criterionList.clear();
|
||||
jqcriterionList.clear();
|
||||
jqcriterionList.clear();
|
||||
map.clear();
|
||||
ordermap.clear();
|
||||
entityClass=null;
|
||||
alias.clear();
|
||||
dataGrid.clear();
|
||||
if(map!=null){map.clear();}
|
||||
if(ordermap!=null){ordermap.clear();}
|
||||
entityClass=null;
|
||||
|
||||
dataGrid = null;
|
||||
dataTables = null;
|
||||
detachedCriteria = null;
|
||||
|
||||
criterionList = null;
|
||||
jqcriterionList = null;
|
||||
jqcriterionList = null;
|
||||
map = null;
|
||||
ordermap = null;
|
||||
alias = null;
|
||||
dataGrid = null;
|
||||
field = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class UploadFile {
|
|||
private String extend = "extend";// 扩展名
|
||||
private boolean view = false;// 是否是预览
|
||||
private boolean rename =true;// 是否重命名
|
||||
private String swfpath;// 转换SWF
|
||||
private String swfpath;// 转换SWF(不设值则不转换)
|
||||
private String cusPath;// 文件物理路径自定义子目录
|
||||
private byte[] content;// 预览或下载时传入的文件二进制内容
|
||||
private Object object;// 文件对应实体对象
|
||||
|
@ -41,7 +41,12 @@ public class UploadFile {
|
|||
|
||||
public UploadFile(HttpServletRequest request, Object object) {
|
||||
String fileKey = oConvertUtils.getString(request.getParameter("fileKey"));// 文件ID
|
||||
if (StringUtil.isNotEmpty(fileKey)) {
|
||||
|
||||
if("TSDocument".equals(object.getClass().getSimpleName()) && StringUtil.isNotEmpty(fileKey)){
|
||||
this.fileKey = fileKey;
|
||||
this.multipartRequest =(MultipartHttpServletRequest) request;
|
||||
|
||||
}else if (StringUtil.isNotEmpty(fileKey)) {
|
||||
this.fileKey = fileKey;
|
||||
this.request = request;
|
||||
} else {
|
||||
|
|
|
@ -136,5 +136,9 @@ public class DataGrid {
|
|||
results.clear();
|
||||
results = null;
|
||||
}
|
||||
|
||||
field = null;
|
||||
treefield = null;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,9 +181,11 @@ public interface CommonService {
|
|||
* @param isOffset
|
||||
* @return
|
||||
*/
|
||||
public DataGridReturn getDataGridReturn(final CriteriaQuery cq,
|
||||
|
||||
public void getDataGridReturn(CriteriaQuery cq,
|
||||
final boolean isOffset);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* hqlQuery方式分页
|
||||
|
|
|
@ -240,9 +240,11 @@ public class CommonServiceImpl implements CommonService {
|
|||
* @param isOffset
|
||||
* @return
|
||||
*/
|
||||
public DataGridReturn getDataGridReturn(final CriteriaQuery cq,
|
||||
|
||||
public void getDataGridReturn(final CriteriaQuery cq,
|
||||
final boolean isOffset) {
|
||||
return commonDao.getDataGridReturn(cq, isOffset);
|
||||
commonDao.getDataGridReturn(cq, isOffset);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -127,6 +127,15 @@ public interface DataBaseConstant {
|
|||
* 更新日期时间
|
||||
*/
|
||||
public static final String UPDATE_TIME_TABLE = "update_time";
|
||||
|
||||
/**
|
||||
* 业务流程状态
|
||||
*/
|
||||
public static final String BPM_STATUS = "bpmStatus";
|
||||
/**
|
||||
* 业务流程状态
|
||||
*/
|
||||
public static final String BPM_STATUS_TABLE = "bpm_status";
|
||||
//*********系统建表标准字段****************************************
|
||||
//****************************************************************************************
|
||||
}
|
||||
|
|
|
@ -22,7 +22,10 @@ public enum OnlineGenerateEnum {
|
|||
ONLINE_ACE_SINGLE("ace.single","ACE风格表单","single","ext"),
|
||||
ONLINE_ACE_ONETOMANY("ace.onetomany","ACE风格表单","onetomany","ext"),
|
||||
ONLINE_DIV_SINGLE("div.single","DIV风格表单","single","ext"),
|
||||
ONLINE_NOPOP_SINGLE("nopop.single","NOPOP风格表单","single","ext");
|
||||
ONLINE_NOPOP_SINGLE("nopop.single","NOPOP风格表单","single","ext"),
|
||||
|
||||
ONLINE_ROW_SINGLE("rowedit.single","行编辑风格表单","single","ext");
|
||||
|
||||
// ONLINE_DEFAULT_SINGLE("default.single","用户扩展风格示例","single","ext"),
|
||||
// ONLINE_DEFAULT_ONETOMANY("default.onetomany","用户扩展风格示例","onetomany","ext");
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package org.jeecgframework.core.enums;
|
||||
|
||||
/**
|
||||
* 许可类型
|
||||
*
|
||||
*/
|
||||
public enum Permission {
|
||||
/**普通权限*/
|
||||
NORMAL("0","默认"),
|
||||
/**跳过认证*/
|
||||
SKIP_AUTH("1","跳过拦截");
|
||||
|
||||
private Permission(String key, String desc) {
|
||||
this.key = key;
|
||||
this.desc = desc;
|
||||
}
|
||||
private String key;
|
||||
private String desc;
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
public void setDesc(String desc) {
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package org.jeecgframework.core.enums;
|
||||
|
||||
import org.jeecgframework.core.util.oConvertUtils;
|
||||
|
||||
/**
|
||||
* 文件上传设置枚举类
|
||||
* @author sundonghui
|
||||
*
|
||||
*/
|
||||
public enum StoreUploadFilePathEnum {
|
||||
PHOTOSUCAI("photosucai", "upload/img/photosucai"),
|
||||
DEFAULT("default", "upload/files");
|
||||
|
||||
private String name;
|
||||
private String path;
|
||||
// 构造方法
|
||||
private StoreUploadFilePathEnum(String name, String path) {
|
||||
this.name = name;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
//获取路径
|
||||
public static String getPath(String name) {
|
||||
if(oConvertUtils.isNotEmpty(name)){
|
||||
for (StoreUploadFilePathEnum storePath : StoreUploadFilePathEnum.values()) {
|
||||
if (storePath.getName().equals(name)) {
|
||||
return storePath.path;
|
||||
}
|
||||
}
|
||||
}
|
||||
return DEFAULT.path;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -14,6 +14,7 @@ import javax.persistence.Column;
|
|||
|
||||
import org.apache.commons.beanutils.PropertyUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.hibernate.criterion.Disjunction;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.jeecgframework.core.annotation.query.QueryTimeFormat;
|
||||
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
|
||||
|
@ -26,6 +27,7 @@ import org.jeecgframework.core.util.JeecgDataAutorUtils;
|
|||
import org.jeecgframework.core.util.LogUtil;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.p3.core.util.oConvertUtils;
|
||||
import org.jeecgframework.web.system.pojo.base.TSDataRule;
|
||||
import org.springframework.util.NumberUtils;
|
||||
|
||||
|
@ -42,7 +44,18 @@ public class HqlGenerateUtil {
|
|||
private static final String END = "_end";
|
||||
private static final String BEGIN = "_begin";
|
||||
|
||||
private static final SimpleDateFormat time = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
private static final ThreadLocal<SimpleDateFormat> local = new ThreadLocal<SimpleDateFormat>();
|
||||
private static SimpleDateFormat getTime(){
|
||||
SimpleDateFormat time = local.get();
|
||||
if(time == null){
|
||||
time = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
local.set(time);
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
/**自定义sql表达式时rule_column的默认前缀*/
|
||||
private static final String SQL_RULES_COLUMN = "SQL_RULES_COLUMN";
|
||||
|
||||
/**
|
||||
* 自动生成查询条件HQL 模糊查询 不带有日期组合
|
||||
|
@ -99,6 +112,19 @@ public class HqlGenerateUtil {
|
|||
Map<String, TSDataRule> ruleMap,
|
||||
Map<String, String[]> parameterMap, String alias) {
|
||||
PropertyDescriptor origDescriptors[] = PropertyUtils.getPropertyDescriptors(searchObj);
|
||||
///直接拿到rulemap判断有没有key为xxx的直接循环组装cq
|
||||
|
||||
boolean addPreCondition = true;
|
||||
for (String c : ruleMap.keySet()) {
|
||||
if(oConvertUtils.isNotEmpty(c) && c.startsWith(SQL_RULES_COLUMN)){
|
||||
if(addPreCondition){
|
||||
cq.add(Restrictions.sqlRestriction("1=1"));
|
||||
addPreCondition = false;
|
||||
}
|
||||
cq.add(Restrictions.sqlRestriction("("+ruleMap.get(c).getRuleValue()+")"));
|
||||
}
|
||||
}
|
||||
|
||||
String aliasName, name, type;
|
||||
for (int i = 0; i < origDescriptors.length; i++) {
|
||||
aliasName = (alias.equals("") ? "" : alias + ".")+ origDescriptors[i].getName();
|
||||
|
@ -130,18 +156,33 @@ public class HqlGenerateUtil {
|
|||
|
||||
// for:查询拼装的替换
|
||||
if (value != null && !value.equals("")) {
|
||||
HqlRuleEnum rule = PageValueConvertRuleEnum.convert(value);
|
||||
|
||||
// if(HqlRuleEnum.LIKE.equals(rule)&&(!(value+"").contains("*"))&&!"class java.lang.Integer".contains(type)){
|
||||
// value="*%"+String.valueOf(value.toString())+"%*";
|
||||
// } else {
|
||||
// rule = HqlRuleEnum.EQ;
|
||||
// }
|
||||
|
||||
//checkbox多选查询
|
||||
if (null != value && value.toString().startsWith(",") && value.toString().endsWith(",")) {
|
||||
String[] vals = value.toString().replace(",,", ",").split(",");
|
||||
//Criteria.add(Restrictions.or(cq, Restrictions.or(Restrictions.or(lhs, rhs))));
|
||||
Disjunction dis = Restrictions.disjunction();//替代多个Restrictions.or
|
||||
for (String val : vals) {
|
||||
if (StringUtils.isNotBlank(val)) {
|
||||
dis.add(Restrictions.eq(name, val));
|
||||
}
|
||||
}
|
||||
cq.add(dis);
|
||||
}else{
|
||||
|
||||
value = PageValueConvertRuleEnum.replaceValue(rule,
|
||||
value);
|
||||
ObjectParseUtil.addCriteria(cq, aliasName, rule, value);
|
||||
HqlRuleEnum rule = PageValueConvertRuleEnum.convert(value);
|
||||
|
||||
// if(HqlRuleEnum.LIKE.equals(rule)&&(!(value+"").contains("*"))&&!"class java.lang.Integer".contains(type)){
|
||||
// value="*%"+String.valueOf(value.toString())+"%*";
|
||||
// } else {
|
||||
// rule = HqlRuleEnum.EQ;
|
||||
// }
|
||||
|
||||
|
||||
value = PageValueConvertRuleEnum.replaceValue(rule,value);
|
||||
ObjectParseUtil.addCriteria(cq, aliasName, rule, value);
|
||||
}
|
||||
|
||||
} else if (parameterMap != null) {
|
||||
|
||||
Object beginValue_=null , endValue_ =null;
|
||||
|
@ -191,19 +232,19 @@ public class HqlGenerateUtil {
|
|||
if (userDefined != null) {
|
||||
cq.ge(aliasName, userDefined.parse(beginValue));
|
||||
} else if (beginValue.length() == 19) {
|
||||
cq.ge(aliasName, time.parse(beginValue));
|
||||
cq.ge(aliasName, getTime().parse(beginValue));
|
||||
} else if (beginValue.length() == 10) {
|
||||
cq.ge(aliasName,time.parse(beginValue + " 00:00:00"));
|
||||
cq.ge(aliasName,getTime().parse(beginValue + " 00:00:00"));
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(endValue)) {
|
||||
if (userDefined != null) {
|
||||
cq.ge(aliasName, userDefined.parse(beginValue));
|
||||
} else if (endValue.length() == 19) {
|
||||
cq.le(aliasName, time.parse(endValue));
|
||||
cq.le(aliasName, getTime().parse(endValue));
|
||||
} else if (endValue.length() == 10) {
|
||||
// 对于"yyyy-MM-dd"格式日期,因时间默认为0,故此添加" 23:59:59"并使用time解析,以方便查询日期时间数据
|
||||
cq.le(aliasName, time.parse(endValue + " 23:59:59"));
|
||||
cq.le(aliasName, getTime().parse(endValue + " 23:59:59"));
|
||||
}
|
||||
}
|
||||
if (isNotEmpty(value)) {
|
||||
|
@ -341,7 +382,13 @@ public class HqlGenerateUtil {
|
|||
return ruleMap;
|
||||
}
|
||||
for (TSDataRule rule : list) {
|
||||
ruleMap.put(rule.getRuleColumn(), rule);
|
||||
|
||||
String column = rule.getRuleColumn();
|
||||
if(oConvertUtils.isEmpty(column)){
|
||||
column = SQL_RULES_COLUMN+rule.getId();
|
||||
}
|
||||
ruleMap.put(column, rule);
|
||||
|
||||
}
|
||||
}
|
||||
return ruleMap;
|
||||
|
|
|
@ -35,6 +35,12 @@ public class SysContextSqlConvert {
|
|||
return "";
|
||||
String sqlValue="";
|
||||
HqlRuleEnum ruleEnum=HqlRuleEnum.getByValue(dataRule.getRuleConditions());
|
||||
|
||||
if(ruleEnum == HqlRuleEnum.SQL_RULES){
|
||||
sqlValue +=" and ("+ dataRule.getRuleValue()+")";
|
||||
return sqlValue;
|
||||
}
|
||||
|
||||
//#{sys_user_code}%
|
||||
String ValueTemp = dataRule.getRuleValue();
|
||||
String moshi = "";
|
||||
|
|
|
@ -6,6 +6,7 @@ package org.jeecgframework.core.extend.hqlsearch.parse.vo;
|
|||
*/
|
||||
public enum HqlRuleEnum {
|
||||
|
||||
SQL_RULES("USE_SQL_RULES","自定义SQL表达式"),
|
||||
GT(">","大于"),
|
||||
GE(">=","大于等于"),
|
||||
LT("<","小于"),
|
||||
|
|
|
@ -21,6 +21,7 @@ public class ConStant {
|
|||
public static final String SWFTOOLS_BASE_DIR = "swftools";
|
||||
/**PDF-SWF*/
|
||||
public static final String SWFTOOLS_PDF2SWF_PATH ="pdf2swf.exe";
|
||||
public static final String SWFTOOLS_PDF2SWF="pdf2swf";
|
||||
/**GIF-SWF*/
|
||||
public static final String SWFTOOLS_GIF2SWF_PATH ="gif2swf.exe";
|
||||
/**PNG-SWF*/
|
||||
|
@ -65,4 +66,30 @@ public class ConStant {
|
|||
}
|
||||
return SWFTOOLS_HOME;
|
||||
}
|
||||
public static String getSWFToolsForLinux(String extend)
|
||||
{
|
||||
|
||||
SWFTOOLS_HOME="";
|
||||
if(extend.equals("pdf"))
|
||||
{
|
||||
SWFTOOLS_HOME+=SWFTOOLS_PDF2SWF;
|
||||
}
|
||||
if(extend.equals("gif"))
|
||||
{
|
||||
SWFTOOLS_HOME+=SWFTOOLS_GIF2SWF_PATH;
|
||||
}
|
||||
if(extend.equals("png"))
|
||||
{
|
||||
SWFTOOLS_HOME+=SWFTOOLS_PNG2SWF_PATH;
|
||||
}
|
||||
if(extend.equals("jpeg"))
|
||||
{
|
||||
SWFTOOLS_HOME+=SWFTOOLS_JPEG2SWF_PATH;
|
||||
}
|
||||
if(extend.equals("wav"))
|
||||
{
|
||||
SWFTOOLS_HOME+=SWFTOOLS_WAV2SWF_PATH;
|
||||
}
|
||||
return SWFTOOLS_HOME;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,9 +53,9 @@ public class SWFToolsSWFConverter implements SWFConverter {
|
|||
process = Runtime.getRuntime().exec(command);
|
||||
} else {
|
||||
//如果是linux系统,路径不能有空格,而且一定不能用双引号,否则无法创建进程
|
||||
String[] command = new String[3];
|
||||
command[0] = ConStant.getSWFToolsPath(extend);
|
||||
command[1] = inputFile;
|
||||
String[] command = new String[3];
|
||||
command[0] = ConStant.getSWFToolsForLinux(extend);
|
||||
command[1] = inputFile;
|
||||
command[2] = swfFile;
|
||||
//Runtime执行后返回创建的进程对象
|
||||
process = Runtime.getRuntime().exec(command);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package org.jeecgframework.core.interceptors;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -10,13 +12,15 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jeecgframework.core.annotation.JAuth;
|
||||
import org.jeecgframework.core.common.exception.GlobalExceptionResolver;
|
||||
import org.jeecgframework.core.common.model.json.AjaxJson;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.enums.Permission;
|
||||
import org.jeecgframework.core.extend.hqlsearch.SysContextSqlConvert;
|
||||
import org.jeecgframework.core.util.ContextHolderUtils;
|
||||
import org.jeecgframework.core.util.JeecgDataAutorUtils;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import org.jeecgframework.core.util.oConvertUtils;
|
||||
import org.jeecgframework.core.util.*;
|
||||
import org.jeecgframework.web.system.manager.ClientManager;
|
||||
import org.jeecgframework.web.system.pojo.base.Client;
|
||||
import org.jeecgframework.web.system.pojo.base.TSDataRule;
|
||||
|
@ -26,6 +30,7 @@ import org.jeecgframework.web.system.pojo.base.TSUser;
|
|||
import org.jeecgframework.web.system.service.SystemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.servlet.view.RedirectView;
|
||||
|
@ -42,6 +47,10 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
private static final Logger logger = Logger.getLogger(AuthInterceptor.class);
|
||||
private SystemService systemService;
|
||||
private List<String> excludeUrls;
|
||||
/**
|
||||
* 包含匹配(请求链接包含该配置链接,就进行过滤处理)
|
||||
*/
|
||||
private List<String> excludeContainUrls;
|
||||
|
||||
public List<String> getExcludeUrls() {
|
||||
return excludeUrls;
|
||||
|
@ -51,6 +60,14 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
this.excludeUrls = excludeUrls;
|
||||
}
|
||||
|
||||
public List<String> getExcludeContainUrls() {
|
||||
return excludeContainUrls;
|
||||
}
|
||||
|
||||
public void setExcludeContainUrls(List<String> excludeContainUrls) {
|
||||
this.excludeContainUrls = excludeContainUrls;
|
||||
}
|
||||
|
||||
public SystemService getSystemService() {
|
||||
return systemService;
|
||||
}
|
||||
|
@ -74,6 +91,27 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
* 在controller前拦截
|
||||
*/
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object object) throws Exception {
|
||||
|
||||
//判断是否被注解跳过权限认证 先判断类注解然后方法注解 都没有则走原来逻辑
|
||||
HandlerMethod handlerMethod=(HandlerMethod)object;
|
||||
JAuth jauthType =handlerMethod.getBean().getClass().getAnnotation(JAuth.class);
|
||||
if(jauthType!=null){
|
||||
if(jauthType.auth()==Permission.SKIP_AUTH){
|
||||
return true;
|
||||
}
|
||||
}else{
|
||||
//JAuthority jauthMethod =handlerMethod.getMethodAnnotation(JAuthority.class);
|
||||
JAuth jauthMethod =handlerMethod.getMethod().getAnnotation(JAuth.class);
|
||||
if(jauthMethod!=null){
|
||||
Permission permission=jauthMethod.auth();
|
||||
if(permission==Permission.SKIP_AUTH){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Boolean isAjax=isAjax(request,response);
|
||||
|
||||
String requestPath = ResourceUtil.getRequestPath(request);// 用户访问的资源地址
|
||||
//logger.info("-----authInterceptor----requestPath------"+requestPath);
|
||||
//步骤一: 判断是否是排除拦截请求,直接返回TRUE
|
||||
|
@ -84,6 +122,10 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
|
||||
if (excludeUrls.contains(requestPath)) {
|
||||
return true;
|
||||
|
||||
} else if(moHuContain(excludeContainUrls, requestPath)){
|
||||
return true;
|
||||
|
||||
} else {
|
||||
//步骤二: 权限控制,优先重组请求URL(考虑online请求前缀一致问题)
|
||||
String clickFunctionId = request.getParameter("clickFunctionId");
|
||||
|
@ -104,7 +146,13 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
|
||||
//步骤三: 根据重组请求URL,进行权限授权判断
|
||||
if((!hasMenuAuth(requestPath,clickFunctionId,currLoginUser)) && !currLoginUser.getUserName().equals("admin")){
|
||||
response.sendRedirect(request.getSession().getServletContext().getContextPath()+"/loginController.do?noAuth");
|
||||
|
||||
if(isAjax){
|
||||
processAjax(response);
|
||||
}else {
|
||||
response.sendRedirect(request.getSession().getServletContext().getContextPath()+"/loginController.do?noAuth");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -135,11 +183,28 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
|
||||
//Step.1 第一部分处理页面表单和列表的页面控件权限(页面表单字段+页面按钮等控件)
|
||||
if(!oConvertUtils.isEmpty(functionId)){
|
||||
//获取菜单对应的页面控制权限(包括表单字段和操作按钮)
|
||||
Set<String> operationCodes = systemService.getOperationCodesByUserIdAndFunctionId(currLoginUser.getId(), functionId);
|
||||
request.setAttribute(Globals.OPERATIONCODES, operationCodes);
|
||||
}
|
||||
if(!oConvertUtils.isEmpty(functionId)){
|
||||
|
||||
if(!currLoginUser.getUserName().equals("admin")){
|
||||
//获取菜单对应的页面控制权限(包括表单字段和操作按钮)
|
||||
|
||||
List<TSOperation> operations = systemService.getOperationsByUserIdAndFunctionId(currLoginUser.getId(), functionId);
|
||||
request.setAttribute(Globals.NOAUTO_OPERATIONCODES, operations);
|
||||
if(operations==null){
|
||||
request.setAttribute(Globals.OPERATIONCODES, null);
|
||||
}else{
|
||||
Set<String> operationCodes = new HashSet<String>();
|
||||
for (TSOperation operation : operations) {
|
||||
operationCodes.add(operation.getId());
|
||||
}
|
||||
request.setAttribute(Globals.OPERATIONCODES, operationCodes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Set<String> operationCodes = systemService.getOperationCodesByUserIdAndFunctionId(currLoginUser.getId(), functionId);
|
||||
//request.setAttribute(Globals.OPERATIONCODES, operationCodes);
|
||||
//}
|
||||
//if(!oConvertUtils.isEmpty(functionId)){
|
||||
|
||||
// List<TSOperation> allOperation=this.systemService.findByProperty(TSOperation.class, "TSFunction.id", functionId);
|
||||
// List<TSOperation> newall = new ArrayList<TSOperation>();
|
||||
|
@ -161,7 +226,7 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
// }
|
||||
// }
|
||||
// }
|
||||
List<TSOperation> newall = new ArrayList<TSOperation>();
|
||||
/*List<TSOperation> newall = new ArrayList<TSOperation>();
|
||||
String hasOperSql="SELECT operation FROM t_s_role_function fun, t_s_role_user role WHERE " +
|
||||
"fun.functionid='"+functionId+"' AND fun.operation is not null AND fun.roleid=role.roleid AND role.userid='"+currLoginUser.getId()+"' ";
|
||||
List<String> hasOperList = this.systemService.findListbySql(hasOperSql);
|
||||
|
@ -175,7 +240,8 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
}
|
||||
}
|
||||
}
|
||||
request.setAttribute(Globals.NOAUTO_OPERATIONCODES, newall);
|
||||
request.setAttribute(Globals.NOAUTO_OPERATIONCODES, newall);*/
|
||||
|
||||
|
||||
//Step.2 第二部分处理列表数据级权限 (菜单数据规则集合)
|
||||
List<TSDataRule> MENU_DATA_AUTHOR_RULES = new ArrayList<TSDataRule>();
|
||||
|
@ -184,14 +250,18 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
|
||||
//数据权限规则的查询
|
||||
//查询所有的当前这个用户所对应的角色和菜单的datarule的数据规则id
|
||||
Set<String> dataruleCodes = systemService.getOperationCodesByUserIdAndDataId(currLoginUser.getId(), functionId);
|
||||
request.setAttribute("dataRulecodes", dataruleCodes);
|
||||
for (String dataRuleId : dataruleCodes) {
|
||||
TSDataRule dataRule = systemService.getEntity(TSDataRule.class, dataRuleId);
|
||||
MENU_DATA_AUTHOR_RULES.add(dataRule);
|
||||
MENU_DATA_AUTHOR_RULE_SQL += SysContextSqlConvert.setSqlModel(dataRule);
|
||||
|
||||
}
|
||||
|
||||
if(!currLoginUser.getUserName().equals("admin")){
|
||||
//Globals.BUTTON_AUTHORITY_CHECK
|
||||
Set<String> dataruleCodes = systemService.getOperationCodesByUserIdAndDataId(currLoginUser.getId(), functionId);
|
||||
request.setAttribute("dataRulecodes", dataruleCodes);
|
||||
for (String dataRuleId : dataruleCodes) {
|
||||
TSDataRule dataRule = systemService.getEntity(TSDataRule.class, dataRuleId);
|
||||
MENU_DATA_AUTHOR_RULES.add(dataRule);
|
||||
MENU_DATA_AUTHOR_RULE_SQL += SysContextSqlConvert.setSqlModel(dataRule);
|
||||
}
|
||||
}
|
||||
|
||||
JeecgDataAutorUtils.installDataSearchConditon(request, MENU_DATA_AUTHOR_RULES);//菜单数据规则集合
|
||||
JeecgDataAutorUtils.installDataSearchConditon(request, MENU_DATA_AUTHOR_RULE_SQL);//菜单数据规则sql
|
||||
|
||||
|
@ -217,7 +287,9 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
String userid = currLoginUser.getId();
|
||||
|
||||
//step.1 先判断请求是否配置菜单,没有配置菜单默认不作权限控制
|
||||
String hasMenuSql = "select count(*) from t_s_function where functiontype = 0 and functionurl = '"+requestPath+"'";
|
||||
|
||||
String hasMenuSql = "select count(*) from t_s_function where functionurl = '"+requestPath+"'";
|
||||
|
||||
Long hasMenuCount = systemService.getCountForJdbc(hasMenuSql);
|
||||
if(hasMenuCount<=0){
|
||||
return true;
|
||||
|
@ -267,5 +339,44 @@ public class AuthInterceptor implements HandlerInterceptor {
|
|||
//request.getRequestDispatcher("loginController.do?login").forward(request, response);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 模糊匹配字符串
|
||||
* @param list
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
private boolean moHuContain(List<String> list,String key){
|
||||
for(String str : list){
|
||||
if(key.contains(str)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前请求是否为异步请求.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private boolean isAjax(HttpServletRequest request, HttpServletResponse response){
|
||||
return oConvertUtils.isNotEmpty(request.getHeader("X-Requested-With"));
|
||||
}
|
||||
|
||||
private void processAjax(HttpServletResponse response){
|
||||
AjaxJson json = new AjaxJson();
|
||||
json.setSuccess(false);
|
||||
json.setMsg("用户权限不足,请联系管理员!");
|
||||
PrintWriter pw = null;
|
||||
try {
|
||||
pw=response.getWriter();
|
||||
pw.write(JSONHelper.bean2json(json));
|
||||
pw.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
pw.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,7 +24,11 @@ public class DateConvertEditor extends PropertyEditorSupport {
|
|||
} else if (text.indexOf(":") > 0 && text.length() == 21) {
|
||||
text = text.replace(".0", "");
|
||||
setValue(this.datetimeFormat.parse(text));
|
||||
} else {
|
||||
|
||||
} else if (text.indexOf(":") > 0 && text.indexOf(".") > 0 && text.length() > 21) {
|
||||
text = text.substring(0, text.indexOf("."));
|
||||
setValue(this.datetimeFormat.parse(text));
|
||||
}else {
|
||||
throw new IllegalArgumentException(
|
||||
"Could not parse date, date format is error ");
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public class DataBaseCronTriggerBean extends CronTriggerBean{
|
|||
e.printStackTrace();
|
||||
}
|
||||
|
||||
DynamicTask.updateSpringMvcTaskXML(this,task.getCronExpression());
|
||||
//DynamicTask.updateSpringMvcTaskXML(this,task.getCronExpression());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,28 +1,29 @@
|
|||
package org.jeecgframework.core.timer;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.UnknownHostException;
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.Element;
|
||||
import org.dom4j.io.OutputFormat;
|
||||
import org.dom4j.io.SAXReader;
|
||||
import org.dom4j.io.XMLWriter;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.util.IpUtil;
|
||||
import org.jeecgframework.core.util.MyClassLoader;
|
||||
import org.jeecgframework.p3.core.common.utils.StringUtil;
|
||||
import org.jeecgframework.web.system.pojo.base.TSTimeTaskEntity;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
import org.jeecgframework.web.system.service.TimeTaskServiceI;
|
||||
import org.quartz.CronTrigger;
|
||||
import org.quartz.JobDetail;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.quartz.Trigger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.quartz.CronTriggerBean;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 动态任务,用以动态调整Spring的任务
|
||||
* @author JueYue
|
||||
|
@ -36,154 +37,164 @@ public class DynamicTask {
|
|||
|
||||
@Resource
|
||||
private Scheduler schedulerFactory;
|
||||
|
||||
@Autowired
|
||||
private TimeTaskServiceI timeTaskService;
|
||||
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
|
||||
|
||||
/**
|
||||
* 更新定时任务的触发表达式
|
||||
*
|
||||
* @param triggerName
|
||||
* 触发器名字
|
||||
* @param start
|
||||
* 触发表达式
|
||||
* @return 成功则返回true,否则返回false
|
||||
* 启动定时任务
|
||||
* @param task
|
||||
*/
|
||||
public boolean startOrStop(String triggerName,
|
||||
boolean start) {
|
||||
private boolean startTask(TSTimeTaskEntity task){
|
||||
try {
|
||||
CronTrigger trigger = (CronTrigger) getTrigger(triggerName,
|
||||
Scheduler.DEFAULT_GROUP);
|
||||
if(start){
|
||||
schedulerFactory.resumeTrigger(trigger.getName(), trigger.getGroup());
|
||||
logger.info("trigger the start successfully!!");
|
||||
}else{
|
||||
schedulerFactory.pauseTrigger(trigger.getName(), trigger.getGroup());
|
||||
logger.info("trigger the pause successfully!!");
|
||||
}
|
||||
return true;
|
||||
} catch (SchedulerException e) {
|
||||
logger.error("Fail to reschedule. " + e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新定时任务的触发表达式
|
||||
*
|
||||
* @param triggerName
|
||||
* 触发器名字
|
||||
* @param cronExpression
|
||||
* 触发表达式
|
||||
* @return 成功则返回true,否则返回false
|
||||
*/
|
||||
public boolean updateCronExpression(String triggerName,
|
||||
String cronExpression) {
|
||||
try {
|
||||
CronTrigger trigger = (CronTrigger) getTrigger(triggerName,
|
||||
Scheduler.DEFAULT_GROUP);
|
||||
if (trigger == null) {
|
||||
return false;
|
||||
}
|
||||
if (StringUtils.equals(trigger.getCronExpression(), cronExpression)) {
|
||||
logger.info("cronExpression is same with the running Schedule , no need to update.");
|
||||
return true;
|
||||
}
|
||||
trigger.setCronExpression(cronExpression);
|
||||
schedulerFactory.rescheduleJob(trigger.getName(), trigger.getGroup(),
|
||||
trigger);
|
||||
updateSpringMvcTaskXML(trigger,cronExpression);
|
||||
logger.info("Update the cronExpression successfully!!");
|
||||
/*
|
||||
//quartz 2.2
|
||||
JobDetailImpl jobDetail = new JobDetailImpl();
|
||||
jobDetail.setName(taskCode);
|
||||
jobDetail.setGroup(Scheduler.DEFAULT_GROUP);
|
||||
jobDetail.setJobClass(getClassByTask(task.getJob_class()));
|
||||
CronTriggerImpl cronTrigger = new CronTriggerImpl("cron_" + taskCode,Scheduler.DEFAULT_GROUP, jobDetail.getName(),Scheduler.DEFAULT_GROUP);
|
||||
cronTrigger.setCronExpression(cronExpress);
|
||||
*/
|
||||
//quartz 1.6
|
||||
JobDetail jobDetail = new JobDetail();
|
||||
jobDetail.setName(task.getId());
|
||||
jobDetail.setGroup(Scheduler.DEFAULT_GROUP);
|
||||
jobDetail.setJobClass(MyClassLoader.getClassByScn(task.getClassName()));
|
||||
CronTrigger cronTrigger = new CronTrigger("cron_" + task.getId(),Scheduler.DEFAULT_GROUP, jobDetail.getName(),Scheduler.DEFAULT_GROUP);
|
||||
cronTrigger.setCronExpression(task.getCronExpression());
|
||||
schedulerFactory.scheduleJob(jobDetail, cronTrigger);
|
||||
return true;
|
||||
} catch (ParseException e) {
|
||||
logger.error("The new cronExpression - " + cronExpression
|
||||
+ " not conform to the standard. " + e);
|
||||
return false;
|
||||
logger.error("startTask ParseException"+ e.getMessage());
|
||||
} catch (SchedulerException e) {
|
||||
logger.error("Fail to reschedule. " + e);
|
||||
return false;
|
||||
logger.error("startTask SchedulerException"+" cron_" + task.getId()+ e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束计划任务
|
||||
* @param task
|
||||
* @throws SchedulerException
|
||||
*/
|
||||
private boolean endTask(TSTimeTaskEntity task){
|
||||
|
||||
try{
|
||||
/*
|
||||
//quartz 2.2
|
||||
JobKey jobKey = new JobKey(taskName, Scheduler.DEFAULT_GROUP);
|
||||
schedulerFactory.deleteJob(jobKey);
|
||||
*/
|
||||
//quartz 1.6
|
||||
schedulerFactory.unscheduleJob("cron_" + task.getId(), Scheduler.DEFAULT_GROUP);
|
||||
return true;
|
||||
}catch (SchedulerException e) {
|
||||
logger.error("endTask SchedulerException" + " cron_" + task.getId() + e.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取触发器
|
||||
*
|
||||
* @param triggerName
|
||||
* 触发器名字
|
||||
* @param groupName
|
||||
* 触发器组名字
|
||||
* @return 对应Trigger
|
||||
* 开关定时任务
|
||||
* @param task
|
||||
* @param start
|
||||
* @return
|
||||
* @throws SchedulerException
|
||||
*/
|
||||
private Trigger getTrigger(String triggerName, String groupName) {
|
||||
Trigger trigger = null;
|
||||
if (StringUtils.isBlank(groupName)) {
|
||||
logger.warn("Schedule Job Group is empty!");
|
||||
return null;
|
||||
public boolean startOrStop(TSTimeTaskEntity task, boolean start){
|
||||
boolean isSuccess = start ? startTask(task) : endTask(task);
|
||||
if(isSuccess){
|
||||
task.setIsStart(start?"1":"0");
|
||||
timeTaskService.updateEntitie(task);
|
||||
systemService.addLog((start?"开启任务":"停止任务")+task.getTaskId(), Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||||
logger.info((start?"开启任务":"停止任务")+"-------TaskId:"+task.getTaskId()+"-------Describe:"+task.getTaskDescribe()+"-----ClassName:"+task.getClassName() );
|
||||
}
|
||||
if (StringUtils.isBlank(triggerName)) {
|
||||
logger.warn("Schedule trigger Name is empty!");
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
trigger = schedulerFactory.getTrigger(triggerName, groupName);
|
||||
} catch (SchedulerException e) {
|
||||
logger.warn("Fail to get the trigger (triggerName: " + triggerName
|
||||
+ ", groupName : " + groupName + ")");
|
||||
return null;
|
||||
}
|
||||
if (trigger == null) {
|
||||
logger.warn("Can not found the trigger of triggerName: "
|
||||
+ triggerName + ", groupName : " + groupName);
|
||||
}
|
||||
return trigger;
|
||||
return isSuccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新spring-mvc-timeTask.xml 配置文件
|
||||
* @param trigger
|
||||
* @param cronExpression
|
||||
* 更新触发规则
|
||||
* @param task
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public synchronized static void updateSpringMvcTaskXML(CronTrigger trigger, String cronExpression) {
|
||||
Document document = null;
|
||||
File file = null;
|
||||
SAXReader saxReader = new SAXReader();
|
||||
public boolean updateCronExpression(TSTimeTaskEntity task) {
|
||||
|
||||
try {
|
||||
URI url = DynamicTask.class.getClassLoader().getResource("spring-mvc-timeTask.xml").toURI();
|
||||
file = new File(url.getPath());
|
||||
document = saxReader.read(new FileInputStream(file));
|
||||
} catch (Exception e) {
|
||||
logger.error("读取系统中用到的SQL 语句XML出错");
|
||||
throw new RuntimeException("---------读取spring-mvc-timeTask.xml文件出错:" + e.getMessage());
|
||||
}
|
||||
Element root = document.getRootElement();
|
||||
List<Element> beans = root.elements();
|
||||
for (Element bean : beans) {
|
||||
if(bean.attribute("id")!=null&&
|
||||
bean.attribute("id").getValue().equals(trigger.getName())){
|
||||
beans = bean.elements();
|
||||
for (Element temp : beans) {
|
||||
if(temp.attribute("name")!=null&&
|
||||
temp.attribute("name").getValue().equals("cronExpression")){
|
||||
temp.attribute("value").setValue(cronExpression);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
String newExpression = task.getCronExpression();
|
||||
task = timeTaskService.get(TSTimeTaskEntity.class, task.getId());
|
||||
|
||||
//任务运行中
|
||||
if("1".equals(task.getIsStart())){
|
||||
CronTriggerBean trigger = (CronTriggerBean)schedulerFactory.getTrigger("cron_" + task.getId(), Scheduler.DEFAULT_GROUP);
|
||||
String originExpression = trigger.getCronExpression();
|
||||
//检查运行中的任务触发规则是否与新规则一致
|
||||
if (!originExpression.equalsIgnoreCase(newExpression)) {
|
||||
trigger.setCronExpression(newExpression);
|
||||
schedulerFactory.rescheduleJob("cron_" + task.getId(), Scheduler.DEFAULT_GROUP, trigger);
|
||||
}
|
||||
}
|
||||
}
|
||||
XMLWriter fileWriter = null;
|
||||
try {
|
||||
OutputFormat xmlFormat = OutputFormat.createPrettyPrint();
|
||||
xmlFormat.setEncoding("utf-8");
|
||||
fileWriter = new XMLWriter(new FileOutputStream(file),xmlFormat);
|
||||
fileWriter.write(document);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
try {
|
||||
fileWriter.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
//检查数据库中的任务触发规则与新规则是否一致
|
||||
if (!task.getCronExpression().equalsIgnoreCase(newExpression)) {
|
||||
task.setCronExpression(newExpression);
|
||||
timeTaskService.updateEntitie(task);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (SchedulerException e) {
|
||||
logger.error("updateCronExpression SchedulerException" + " cron_" + task.getId() + e.getMessage());
|
||||
} catch (ParseException e) {
|
||||
logger.error("updateCronExpression ParseException" + " cron_" + task.getId() + e.getMessage());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 系统初始加载任务
|
||||
* @throws UnknownHostException
|
||||
*/
|
||||
public void loadTask(){
|
||||
|
||||
//String serverIp = InetAddress.getLocalHost().getHostAddress();
|
||||
List<String> ipList = IpUtil.getLocalIPList();
|
||||
TSTimeTaskEntity timTask = new TSTimeTaskEntity();
|
||||
timTask.setIsEffect("1");
|
||||
timTask.setIsStart("1");
|
||||
List<TSTimeTaskEntity> tasks = (List<TSTimeTaskEntity>)timeTaskService.findByExample(TSTimeTaskEntity.class.getName(), timTask);
|
||||
logger.info(" register time task class num is ["+tasks.size()+"] ");
|
||||
if(tasks.size() > 0){
|
||||
for (TSTimeTaskEntity task : tasks) {
|
||||
//startTask(task);
|
||||
try {
|
||||
|
||||
String runServerIp = task.getRunServerIp();
|
||||
if(ipList.contains(runServerIp) || StringUtil.isEmpty(runServerIp) || "本地".equals(runServerIp)){//当前服务器IP匹配成功
|
||||
|
||||
//quartz 1.6
|
||||
JobDetail jobDetail = new JobDetail();
|
||||
jobDetail.setName(task.getId());
|
||||
jobDetail.setGroup(Scheduler.DEFAULT_GROUP);
|
||||
jobDetail.setJobClass(MyClassLoader.getClassByScn(task.getClassName()));
|
||||
CronTrigger cronTrigger = new CronTrigger("cron_" + task.getId(),Scheduler.DEFAULT_GROUP, jobDetail.getName(),Scheduler.DEFAULT_GROUP);
|
||||
cronTrigger.setCronExpression(task.getCronExpression());
|
||||
schedulerFactory.scheduleJob(jobDetail, cronTrigger);
|
||||
logger.info(" register time task class is { "+task.getClassName()+" } ");
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
logger.error("startTask ParseException"+ e.getMessage());
|
||||
} catch (SchedulerException e) {
|
||||
logger.error("startTask SchedulerException"+" cron_" + task.getId()+ e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package org.jeecgframework.core.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
/**
|
||||
* @ClassName: ContextHolderUtils
|
||||
* @Description: TODO(上下文工具类)
|
||||
|
@ -23,15 +25,41 @@ public class ContextHolderUtils {
|
|||
return request;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* SpringMvc下获取session
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static HttpSession getSession() {
|
||||
HttpSession session = getRequest().getSession();
|
||||
HttpServletRequest request = getRequest();
|
||||
String tempSessionId = request.getParameter("sessionId");
|
||||
HttpSession session = request.getSession();
|
||||
String sessionId = session.getId();
|
||||
if(StringUtil.isNotEmpty(tempSessionId) && !tempSessionId.equals(sessionId)){
|
||||
sessionId = tempSessionId;
|
||||
if(sessionMap.containsKey(sessionId)){
|
||||
session = sessionMap.get(sessionId);
|
||||
}
|
||||
}
|
||||
if(!sessionMap.containsKey(sessionId)){
|
||||
sessionMap.put(sessionId, session);
|
||||
}
|
||||
return session;
|
||||
}
|
||||
|
||||
|
||||
private static final Map<String, HttpSession> sessionMap = new HashMap<String, HttpSession>();
|
||||
|
||||
public static HttpSession getSession(String sessionId){
|
||||
HttpSession session = sessionMap.get(sessionId);
|
||||
return session == null ? getSession() : session;
|
||||
}
|
||||
|
||||
public static void removeSession(String sessionId){
|
||||
if(sessionMap.containsKey(sessionId)){
|
||||
sessionMap.remove(sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
package org.jeecgframework.core.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.dbcp.BasicDataSource;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jeecgframework.minidao.util.FreemarkerParseFactory;
|
||||
import org.jeecgframework.web.system.pojo.base.DynamicDataSourceEntity;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
|
||||
/**
|
||||
* Spring JDBC 实时数据库访问
|
||||
|
@ -51,6 +54,7 @@ public class DynamicDBUtil {
|
|||
* @param dynamicSourceEntity
|
||||
* @return JdbcTemplate
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private static JdbcTemplate getJdbcTemplate(DynamicDataSourceEntity dynamicSourceEntity) {
|
||||
BasicDataSource dataSource = getDataSource(dynamicSourceEntity);
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
|
@ -76,16 +80,30 @@ public class DynamicDBUtil {
|
|||
|
||||
return effectCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持miniDao语法操作的Update
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
public static int updateByHash(final String dbKey, String sql, HashMap<String, Object> data){
|
||||
int effectCount = 0;
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
||||
//根据模板获取sql
|
||||
sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate.getDataSource());
|
||||
effectCount = namedParameterJdbcTemplate.update(sql, data);
|
||||
return effectCount;
|
||||
}
|
||||
|
||||
|
||||
public static Object findOne(final String dbKey, String sql, Object... param) {
|
||||
List<Map<String, Object>> list;
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
||||
|
||||
if (ArrayUtils.isEmpty(param)) {
|
||||
list = jdbcTemplate.queryForList(sql);
|
||||
} else {
|
||||
list = jdbcTemplate.queryForList(sql, param);
|
||||
}
|
||||
|
||||
list = findList(dbKey, sql, param);
|
||||
|
||||
|
||||
if(ListUtils.isNullOrEmpty(list))
|
||||
{
|
||||
|
@ -99,7 +117,53 @@ public class DynamicDBUtil {
|
|||
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 支持miniDao语法操作的查询 返回HashMap
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
public static Object findOneByHash(final String dbKey, String sql, HashMap<String, Object> data){
|
||||
List<Map<String, Object>> list;
|
||||
list = findListByHash(dbKey, sql, data);
|
||||
if(ListUtils.isNullOrEmpty(list)){
|
||||
logger.error("Except one, but not find actually");
|
||||
}
|
||||
if(list.size() > 1){
|
||||
logger.error("Except one, but more than one actually");
|
||||
}
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接sql查询 根据clazz返回单个实例
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句
|
||||
* @param clazz 返回实例的Class
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Object findOne(final String dbKey, String sql, Class<T> clazz, Object... param) {
|
||||
Map<String, Object> map = (Map<String, Object>) findOne(dbKey, sql, param);
|
||||
return ReflectHelper.setAll(clazz, map);
|
||||
}
|
||||
/**
|
||||
* 支持miniDao语法操作的查询 返回单个实例
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param clazz 返回实例的Class
|
||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Object findOneByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data) {
|
||||
Map<String, Object> map = (Map<String, Object>) findOneByHash(dbKey, sql, data);
|
||||
return ReflectHelper.setAll(clazz, map);
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> findList(final String dbKey, String sql, Object... param) {
|
||||
List<Map<String, Object>> list;
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
||||
|
@ -112,6 +176,24 @@ public class DynamicDBUtil {
|
|||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持miniDao语法操作的查询
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> findListByHash(final String dbKey, String sql, HashMap<String, Object> data){
|
||||
List<Map<String, Object>> list;
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
||||
//根据模板获取sql
|
||||
sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate.getDataSource());
|
||||
list = namedParameterJdbcTemplate.queryForList(sql, data);
|
||||
return list;
|
||||
}
|
||||
|
||||
//此方法只能返回单列,不能返回实体类
|
||||
public static <T> List<T> findList(final String dbKey, String sql, Class<T> clazz,Object... param) {
|
||||
List<T> list;
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
||||
|
@ -124,15 +206,58 @@ public class DynamicDBUtil {
|
|||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 支持miniDao语法操作的查询 返回单列数据list
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param clazz 类型Long、String等
|
||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> findListByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data){
|
||||
List<T> list;
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dbKey);
|
||||
//根据模板获取sql
|
||||
sql = FreemarkerParseFactory.parseTemplateContent(sql, data);
|
||||
NamedParameterJdbcTemplate namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate.getDataSource());
|
||||
list = namedParameterJdbcTemplate.queryForList(sql, data, clazz);
|
||||
return list;
|
||||
}
|
||||
/**
|
||||
* 直接sql查询 返回实体类列表
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param clazz 返回实体类列表的class
|
||||
* @param param sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> findListEntrys(final String dbKey, String sql, Class<T> clazz, Object... param){
|
||||
List<Map<String,Object>> queryList = findList(dbKey, sql, param);
|
||||
return ReflectHelper.transList2Entrys(queryList, clazz);
|
||||
}
|
||||
/**
|
||||
* 支持miniDao语法操作的查询 返回实体类列表
|
||||
* @param dbKey 数据源标识
|
||||
* @param sql 执行sql语句,sql支持minidao语法逻辑
|
||||
* @param clazz 返回实体类列表的class
|
||||
* @param data sql语法中需要判断的数据及sql拼接注入中需要的数据
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> findListEntrysByHash(final String dbKey, String sql, Class<T> clazz, HashMap<String, Object> data){
|
||||
List<Map<String,Object>> queryList = findListByHash(dbKey, sql, data);
|
||||
return ReflectHelper.transList2Entrys(queryList, clazz);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static void main(String[] args) {
|
||||
DynamicDataSourceEntity dynamicSourceEntity = new DynamicDataSourceEntity();
|
||||
|
||||
String dbKey = "SAP_DB";
|
||||
String driverClassName = "oracle.jdbc.driver.OracleDriver";
|
||||
String url = "jdbc:oracle:thin:@10.10.0.59:1521:mid";
|
||||
String dbUser = "CRM";
|
||||
String dbPassword = "CRM2013";
|
||||
String driverClassName = "com.mysql.jdbc.Driver";
|
||||
String url = "jdbc:mysql://localhost:3306/jeecg";
|
||||
String dbUser = "root";
|
||||
String dbPassword = "root";
|
||||
|
||||
dynamicSourceEntity.setDbKey(dbKey);
|
||||
dynamicSourceEntity.setDriverClass(driverClassName);
|
||||
|
@ -140,11 +265,52 @@ public class DynamicDBUtil {
|
|||
dynamicSourceEntity.setDbUser(dbUser);
|
||||
dynamicSourceEntity.setDbPassword(dbPassword);
|
||||
|
||||
JdbcTemplate jdbcTemplate = getJdbcTemplate(dynamicSourceEntity);
|
||||
ResourceUtil.dynamicDataSourceMap.put(dbKey, dynamicSourceEntity);
|
||||
|
||||
String sql = "<#if nlevel gt 2> insert into GWYUTEST003(id, sname, nlevel) values ((select maxid from (select ifnull(max(id)+1,1) maxid from GWYUTEST003) a),"
|
||||
+ " :sname, :nlevel)</#if>";
|
||||
HashMap<String, Object> data = new HashMap<String, Object>();
|
||||
data.put("sname", "aaa");
|
||||
data.put("nlevel", 3);
|
||||
DynamicDBUtil.updateByHash(dbKey, sql, data);
|
||||
|
||||
sql = "SELECT * FROM GWYUTEST003 WHERE id = :id";data = new HashMap<String, Object>();
|
||||
data.put("id", 1);
|
||||
Map<String, Object> aaa = (Map<String, Object>) DynamicDBUtil.findOneByHash(dbKey, sql, data);
|
||||
System.out.println(aaa.get("sname"));
|
||||
|
||||
sql = "SELECT * FROM GWYUTEST003 WHERE id >= '${id}'";data = new HashMap<String, Object>();
|
||||
data.put("id", 2);
|
||||
List<GwyuTest> bbb = DynamicDBUtil.findListEntrysByHash(dbKey, sql, GwyuTest.class, data);
|
||||
System.out.println(bbb);
|
||||
|
||||
String sql = "select ak.VKBUR, ak.KUNNR, ak.BSTNK, ak.VBELN, ak.MAHDT, ak.BSTDK from VBAK ak where ak.VKORG = '6002'";
|
||||
//List<Map<String, Object>> list = DynamicDBUtil.getList(jdbcTemplate, sql);
|
||||
//System.out.println(list.size());
|
||||
}
|
||||
public static class GwyuTest{
|
||||
public GwyuTest(){}
|
||||
private long id;
|
||||
private String sname;
|
||||
private long nlevel;
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getSname() {
|
||||
return sname;
|
||||
}
|
||||
public void setSname(String sname) {
|
||||
this.sname = sname;
|
||||
}
|
||||
public long getNlevel() {
|
||||
return nlevel;
|
||||
}
|
||||
public void setNlevel(long nlevel) {
|
||||
this.nlevel = nlevel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,12 @@ import net.sf.ehcache.Element;
|
|||
*/
|
||||
public class EhcacheUtil {
|
||||
|
||||
//缓存NAME静态名称
|
||||
public static String DictCache = "dictCache";
|
||||
public static String EternalCache = "eternalCache";
|
||||
public static String TagCache = "tagCache";
|
||||
|
||||
|
||||
public static CacheManager manager = CacheManager.create();
|
||||
|
||||
public static Object get(String cacheName, Object key) {
|
||||
|
@ -38,6 +44,24 @@ public class EhcacheUtil {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空系统Ehcache缓存
|
||||
*/
|
||||
public static void clean() {
|
||||
Cache dictCache = manager.getCache(DictCache);
|
||||
Cache eternalCache = manager.getCache(EternalCache);
|
||||
Cache tagCache = manager.getCache(TagCache);
|
||||
if (dictCache != null) {
|
||||
dictCache.removeAll();
|
||||
}
|
||||
if (eternalCache != null) {
|
||||
eternalCache.removeAll();
|
||||
}
|
||||
if (tagCache != null) {
|
||||
tagCache.removeAll();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String key = "key";
|
||||
|
|
|
@ -0,0 +1,181 @@
|
|||
package org.jeecgframework.core.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* @author Link Xue
|
||||
* @version 2017年8月20日 上午11:03:13
|
||||
* 模拟HTTP请求获取返回值
|
||||
*/
|
||||
public class HttpRequest {
|
||||
|
||||
private static Logger logger = Logger.getLogger(HttpRequest.class);
|
||||
|
||||
/**
|
||||
* post请求
|
||||
* @param url url地址
|
||||
* @param param 请求参数
|
||||
* @param noNeedResponse 不需要返回结果
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws ClientProtocolException
|
||||
*/
|
||||
public static String httpPost(String url,String param, boolean noNeedResponse) throws ClientProtocolException, IOException{
|
||||
|
||||
url = URLDecoder.decode(url, "UTF-8");
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
String result = null;
|
||||
HttpPost method = new HttpPost(url);
|
||||
|
||||
RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(1000).setConnectTimeout(300).build();//设置请求和传输超时时间
|
||||
method.setConfig(requestConfig);
|
||||
|
||||
if (null != param) {
|
||||
StringEntity entity = new StringEntity(param, "utf-8");
|
||||
entity.setContentEncoding("UTF-8");
|
||||
entity.setContentType("application/x-www-form-urlencoded");
|
||||
method.setEntity(entity);
|
||||
}
|
||||
|
||||
HttpResponse resultRep = httpClient.execute(method);
|
||||
/**请求发送成功,并得到响应**/
|
||||
if (resultRep.getStatusLine().getStatusCode() == 200) {
|
||||
String str = "";
|
||||
/**读取服务器返回过来的json字符串数据**/
|
||||
str = EntityUtils.toString(resultRep.getEntity());
|
||||
if (noNeedResponse) {
|
||||
return null;
|
||||
}
|
||||
/**把json字符串转换成json对象**/
|
||||
//jsonResult = JSONObject.parseObject(str);
|
||||
result = str;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定URL发送GET方法的请求
|
||||
*
|
||||
* @param url
|
||||
* 发送请求的URL
|
||||
* @param param
|
||||
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @return URL 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendGet(String url, String param) {
|
||||
String result = "";
|
||||
BufferedReader in = null;
|
||||
try {
|
||||
String urlNameString = url + "?" + param;
|
||||
URL realUrl = new URL(urlNameString);
|
||||
// 打开和URL之间的连接
|
||||
URLConnection connection = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
connection.setRequestProperty("accept", "*/*");
|
||||
connection.setRequestProperty("connection", "Keep-Alive");
|
||||
connection.setRequestProperty("user-agent",
|
||||
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
// 建立实际的连接
|
||||
connection.connect();
|
||||
// 获取所有响应头字段
|
||||
Map<String, List<String>> map = connection.getHeaderFields();
|
||||
// 遍历所有的响应头字段
|
||||
for (String key : map.keySet()) {
|
||||
System.out.println(key + "--->" + map.get(key));
|
||||
}
|
||||
// 定义 BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader(new InputStreamReader(
|
||||
connection.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 使用finally块来关闭输入流
|
||||
finally {
|
||||
try {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定 URL 发送POST方法的请求
|
||||
*
|
||||
* @param url
|
||||
* 发送请求的 URL
|
||||
* @param param
|
||||
* 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
|
||||
* @return 所代表远程资源的响应结果
|
||||
*/
|
||||
public static String sendPost(String url, String param) {
|
||||
PrintWriter out = null;
|
||||
BufferedReader in = null;
|
||||
String result = "";
|
||||
try {
|
||||
URL realUrl = new URL(url);
|
||||
// 打开和URL之间的连接
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
// 设置通用的请求属性
|
||||
conn.setRequestProperty("accept", "*/*");
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
|
||||
// 发送POST请求必须设置如下两行
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
// 获取URLConnection对象对应的输出流
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
// 发送请求参数
|
||||
out.print(param);
|
||||
// flush输出流的缓冲
|
||||
out.flush();
|
||||
// 定义BufferedReader输入流来读取URL的响应
|
||||
in = new BufferedReader( new InputStreamReader(conn.getInputStream()));
|
||||
String line;
|
||||
while ((line = in.readLine()) != null) {
|
||||
result += line;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//使用finally块来关闭输出流、输入流
|
||||
finally{
|
||||
try{
|
||||
if(out!=null){
|
||||
out.close();
|
||||
}
|
||||
if(in!=null){
|
||||
in.close();
|
||||
}
|
||||
}catch(IOException ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,13 @@
|
|||
package org.jeecgframework.core.util;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class IpUtil {
|
||||
|
@ -26,4 +34,34 @@ public class IpUtil {
|
|||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本地IP列表(针对多网卡情况)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getLocalIPList() {
|
||||
List<String> ipList = new ArrayList<String>();
|
||||
try {
|
||||
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||
NetworkInterface networkInterface;
|
||||
Enumeration<InetAddress> inetAddresses;
|
||||
InetAddress inetAddress;
|
||||
String ip;
|
||||
while (networkInterfaces.hasMoreElements()) {
|
||||
networkInterface = networkInterfaces.nextElement();
|
||||
inetAddresses = networkInterface.getInetAddresses();
|
||||
while (inetAddresses.hasMoreElements()) {
|
||||
inetAddress = inetAddresses.nextElement();
|
||||
if (inetAddress != null && inetAddress instanceof Inet4Address) { // IPV4
|
||||
ip = inetAddress.getHostAddress();
|
||||
ipList.add(ip);
|
||||
//System.out.println("获取本机IP:"+ip);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SocketException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ipList;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -415,7 +415,9 @@ public class ListtoMenu {
|
|||
}
|
||||
menuString.append("<li iconCls=\"");
|
||||
menuString.append(icon);
|
||||
menuString.append("\"> <a onclick=\"addTab(\'");
|
||||
|
||||
menuString.append("\"> <a onclick=\"addTab4MenuId(\'");
|
||||
|
||||
menuString.append(getMutiLang(function.getFunctionName()));
|
||||
menuString.append("\',\'");
|
||||
menuString.append(function.getFunctionUrl());
|
||||
|
@ -434,6 +436,10 @@ public class ListtoMenu {
|
|||
|
||||
menuString.append("\',\'");
|
||||
menuString.append(icon);
|
||||
|
||||
menuString.append("\',\'");
|
||||
menuString.append(function.getId());
|
||||
|
||||
menuString.append("\')\" title=\"");
|
||||
menuString.append(getMutiLang(function.getFunctionName()));
|
||||
menuString.append("\" url=\"");
|
||||
|
@ -818,10 +824,10 @@ public class ListtoMenu {
|
|||
for (TSFunction function : list) {
|
||||
menuString.append("<li>");
|
||||
|
||||
if(function.getFunctionIconStyle()!=null&&!function.getFunctionIconStyle().trim().equals("")){
|
||||
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\""+function.getFunctionIconStyle()+"\"></i>");
|
||||
if(function.getFunctionIconStyle()!=null&&!function.getFunctionIconStyle().trim().equals("")){
|
||||
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\"fa "+function.getFunctionIconStyle()+"\"></i>");
|
||||
}else{
|
||||
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\""+SysACEIconEnum.toEnum(function.getTSIcon().getIconClas()).getThemes()+"\"></i>");
|
||||
menuString.append("<a href=\"#\" class=\"dropdown-toggle\" ><i class=\"fa fa-columns\"></i>");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package org.jeecgframework.core.util;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.qcloud.cos.COSClient;
|
||||
import com.qcloud.cos.ClientConfig;
|
||||
import com.qcloud.cos.request.*;
|
||||
import com.qcloud.cos.sign.Credentials;
|
||||
|
||||
public class QCloudUtils {
|
||||
private static long appId = 1251108935;
|
||||
private static String secretId = "AKIDeCYoxueSxIQW0PHzVqz3NhuwoYN34Y7W";
|
||||
private static String secretKey = "NkARfmtpcDnIgssupY7Zs0zpeMwCJJ9q";
|
||||
private static String bucketName="jeecg";
|
||||
private static Credentials cred=new Credentials(appId, secretId, secretKey);
|
||||
private static ClientConfig clientConfig = new ClientConfig();
|
||||
private static COSClient cosClient;
|
||||
static {
|
||||
|
||||
clientConfig.setRegion("tj");
|
||||
cosClient = new COSClient(clientConfig, cred);
|
||||
}
|
||||
/*上传文件*/
|
||||
public static JSONObject upload(String cosFilePath, String localFilePath1){
|
||||
UploadFileRequest uploadFileRequest =
|
||||
new UploadFileRequest(bucketName, cosFilePath, localFilePath1);
|
||||
uploadFileRequest.setEnableShaDigest(false);
|
||||
String uploadFileRet = cosClient.uploadFile(uploadFileRequest);
|
||||
return JSONObject.parseObject(uploadFileRet);
|
||||
}
|
||||
/*上传文件*/
|
||||
public static JSONObject upload(String cosFilePath, byte[] contentBuffer){
|
||||
UploadFileRequest uploadFileRequest =
|
||||
new UploadFileRequest(bucketName, cosFilePath, contentBuffer);
|
||||
uploadFileRequest.setEnableShaDigest(false);
|
||||
String uploadFileRet = cosClient.uploadFile(uploadFileRequest);
|
||||
return JSONObject.parseObject(uploadFileRet);
|
||||
}
|
||||
|
||||
/*下载文件*/
|
||||
public static JSONObject download(String cosFilePath,String localPathDown){
|
||||
GetFileLocalRequest getFileLocalRequest =
|
||||
new GetFileLocalRequest(bucketName, cosFilePath, localPathDown);
|
||||
getFileLocalRequest.setUseCDN(false);
|
||||
getFileLocalRequest.setReferer("*.myweb.cn");
|
||||
String getFileResult = cosClient.getFileLocal(getFileLocalRequest);
|
||||
return JSON.parseObject(getFileResult);
|
||||
}
|
||||
|
||||
/*list目录, 获取目录下的成员*/
|
||||
public static JSONObject listByFoler(String cosFolderPath){
|
||||
ListFolderRequest listFolderRequest = new ListFolderRequest(bucketName, cosFolderPath);
|
||||
String listFolderRet = cosClient.listFolder(listFolderRequest);
|
||||
return JSON.parseObject(listFolderRet);
|
||||
}
|
||||
|
||||
/*删除文件*/
|
||||
public static JSONObject delFile(String cosFilePath){
|
||||
DelFileRequest delFileRequest = new DelFileRequest(bucketName, cosFilePath);
|
||||
String delFileRet = cosClient.delFile(delFileRequest);
|
||||
return JSON.parseObject(delFileRet);
|
||||
}
|
||||
/*删除文件夹*/
|
||||
public static JSONObject delFolder(String cosFolderPath){
|
||||
DelFolderRequest delFolderRequest = new DelFolderRequest(bucketName, cosFolderPath);
|
||||
String delFolderRet = cosClient.delFolder(delFolderRequest);
|
||||
return JSON.parseObject(delFolderRet);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,7 +1,11 @@
|
|||
package org.jeecgframework.core.util;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
|
@ -10,6 +14,7 @@ import java.util.regex.Pattern;
|
|||
*/
|
||||
public class ReflectHelper {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private Class cls;
|
||||
/**
|
||||
* 传过来的对象
|
||||
|
@ -107,4 +112,65 @@ public class ReflectHelper {
|
|||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 把map中的内容全部注入到obj中
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public Object setAll(Map<String, Object> data){
|
||||
if(data == null || data.keySet().size() <= 0){
|
||||
return null;
|
||||
}
|
||||
for(Entry<String, Object> entry : data.entrySet()){
|
||||
this.setMethodValue(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
/**
|
||||
* 把map中的内容全部注入到obj中
|
||||
* @param o
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static Object setAll(Object o, Map<String, Object> data){
|
||||
ReflectHelper reflectHelper = new ReflectHelper(o);
|
||||
reflectHelper.setAll(data);
|
||||
return o;
|
||||
}
|
||||
/**
|
||||
* 把map中的内容全部注入到新实例中
|
||||
* @param clazz
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T setAll(Class<T> clazz, Map<String, Object> data){
|
||||
T o = null;
|
||||
try {
|
||||
o = clazz.newInstance();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
o = null;
|
||||
return o;
|
||||
}
|
||||
return (T) setAll(o, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据传入的class将mapList转换为实体类list
|
||||
* @param mapist
|
||||
* @param clazz
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> transList2Entrys(List<Map<String,Object>> mapist, Class<T> clazz){
|
||||
List<T> list = new ArrayList<T>();
|
||||
if(mapist != null && mapist.size() > 0){
|
||||
for(Map<String,Object> data : mapist){
|
||||
list.add(ReflectHelper.setAll(clazz, data));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
|
@ -69,7 +69,7 @@ public class ResourceUtil {
|
|||
public static final String getSessionattachmenttitle(String sessionName) {
|
||||
return bundle.getString(sessionName);
|
||||
}
|
||||
public static final TSUser getSessionUserName() {
|
||||
public static final TSUser getSessionUser() {
|
||||
HttpSession session = ContextHolderUtils.getSession();
|
||||
if(ClientManager.getInstance().getClient(session.getId())!=null){
|
||||
return ClientManager.getInstance().getClient(session.getId()).getUser();
|
||||
|
@ -101,7 +101,7 @@ public class ResourceUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获得请求路径
|
||||
* 获得请求路径【注意: 不通用】
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
|
@ -115,9 +115,14 @@ public class ResourceUtil {
|
|||
requestPath += "?" + queryString;
|
||||
}
|
||||
|
||||
if (requestPath.indexOf("&") > -1) {// 去掉其他参数
|
||||
if (requestPath.indexOf("&") > -1) {// 去掉其他参数(保留一个参数) 例如:loginController.do?login
|
||||
requestPath = requestPath.substring(0, requestPath.indexOf("&"));
|
||||
}
|
||||
|
||||
if(requestPath.indexOf("=")!=-1){
|
||||
requestPath = requestPath.substring(0,requestPath.indexOf(".do")+3);
|
||||
}
|
||||
|
||||
requestPath = requestPath.substring(request.getContextPath().length() + 1);// 去掉项目路径
|
||||
return requestPath;
|
||||
}
|
||||
|
@ -256,7 +261,7 @@ public class ResourceUtil {
|
|||
// ||
|
||||
if (key.equals(DataBaseConstant.SYS_USER_CODE)
|
||||
|| key.equals(DataBaseConstant.SYS_USER_CODE_TABLE)) {
|
||||
returnValue = getSessionUserName().getUserName();
|
||||
returnValue = getSessionUser().getUserName();
|
||||
}
|
||||
//替换为系统登录用户真实名字
|
||||
// if (key.equals(DataBaseConstant.CREATE_NAME)
|
||||
|
@ -266,19 +271,19 @@ public class ResourceUtil {
|
|||
if (key.equals(DataBaseConstant.SYS_USER_NAME)
|
||||
|| key.equals(DataBaseConstant.SYS_USER_NAME_TABLE)
|
||||
) {
|
||||
returnValue = getSessionUserName().getRealName();
|
||||
returnValue = getSessionUser().getRealName();
|
||||
}
|
||||
|
||||
//替换为系统登录用户的公司编码
|
||||
if (key.equals(DataBaseConstant.SYS_COMPANY_CODE)|| key.equals(DataBaseConstant.SYS_COMPANY_CODE_TABLE)) {
|
||||
|
||||
returnValue = getSessionUserName().getCurrentDepart().getOrgCode()
|
||||
returnValue = getSessionUser().getCurrentDepart().getOrgCode()
|
||||
.substring(0, Integer.valueOf(getOrgCodeLengthType()) + 1);
|
||||
|
||||
}
|
||||
//替换为系统用户登录所使用的机构编码
|
||||
if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) {
|
||||
returnValue = getSessionUserName().getCurrentDepart().getOrgCode();
|
||||
returnValue = getSessionUser().getCurrentDepart().getOrgCode();
|
||||
}
|
||||
//替换为当前系统时间(年月日)
|
||||
if (key.equals(DataBaseConstant.SYS_DATE)|| key.equals(DataBaseConstant.SYS_DATE_TABLE)) {
|
||||
|
@ -288,6 +293,10 @@ public class ResourceUtil {
|
|||
if (key.equals(DataBaseConstant.SYS_TIME)|| key.equals(DataBaseConstant.SYS_TIME_TABLE)) {
|
||||
returnValue = DateUtils.formatTime();
|
||||
}
|
||||
//流程状态默认值(默认未发起)
|
||||
if (key.equals(DataBaseConstant.BPM_STATUS_TABLE)|| key.equals(DataBaseConstant.BPM_STATUS_TABLE)) {
|
||||
returnValue = "1";
|
||||
}
|
||||
if(returnValue!=null){returnValue = returnValue + moshi;}
|
||||
return returnValue;
|
||||
}
|
||||
|
|
|
@ -358,6 +358,36 @@ public class StringUtil {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转化为String时过滤空
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
public static String formatEmpty(Object o){
|
||||
if(o == null){
|
||||
return "";
|
||||
}else{
|
||||
return o.toString();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 将多个对象拼接成一个String
|
||||
* @param objs
|
||||
* @return
|
||||
*/
|
||||
public static String concate(Object... objs){
|
||||
if(objs == null || objs.length <= 0){
|
||||
return "";
|
||||
}
|
||||
StringBuffer result = new StringBuffer();
|
||||
for(int i=0; i<objs.length; i++){
|
||||
result.append(formatEmpty(objs[i]));
|
||||
result.append("_");
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 自定义的分隔字符串函数 例如: 1,2,3 =>[1,2,3] 3个元素 ,2,3=>[,2,3] 3个元素 ,2,3,=>[,2,3,] 4个元素 ,,,=>[,,,] 4个元素
|
||||
*
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package org.jeecgframework.tag.core;
|
||||
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jeecgframework.core.util.EhcacheUtil;
|
||||
import org.jeecgframework.web.cgform.common.CgAutoListConstant;
|
||||
import org.jeecgframework.web.cgform.engine.TempletContext;
|
||||
import org.jeecgframework.web.system.controller.core.LoginController;
|
||||
/**
|
||||
* add-by--Author:yugwu Date:20170828 for:TASK #2258 【优化系统】jeecg的jsp页面,采用标签方式,每次都生成html,很慢---- --
|
||||
* @author yugw
|
||||
* Tag标签的父类,主要为做缓存使用
|
||||
*/
|
||||
public abstract class JeecgTag extends TagSupport {
|
||||
private Logger log = Logger.getLogger(LoginController.class);
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 获取缓存
|
||||
* @return
|
||||
*/
|
||||
public StringBuffer getTagCache(){
|
||||
//EhcacheUtil.remove(EhcacheUtil.TagCache, toString());
|
||||
|
||||
if(CgAutoListConstant.SYS_MODE_DEV.equalsIgnoreCase(TempletContext._sysMode)){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
//log.info("-----TagCache-----toString()-----"+toString());
|
||||
return (StringBuffer) EhcacheUtil.get(EhcacheUtil.TagCache, toString());
|
||||
}
|
||||
/**
|
||||
* 存放缓存
|
||||
* @param tagCache
|
||||
*/
|
||||
public void putTagCache(StringBuffer tagCache){
|
||||
EhcacheUtil.put(EhcacheUtil.TagCache, toString(), tagCache);
|
||||
}
|
||||
}
|
|
@ -1,25 +1,29 @@
|
|||
package org.jeecgframework.tag.core.easyui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import jodd.util.StringUtil;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jeecgframework.core.enums.SysThemesEnum;
|
||||
import org.jeecgframework.core.util.ContextHolderUtils;
|
||||
import org.jeecgframework.core.util.SysThemesUtil;
|
||||
import org.jeecgframework.core.util.oConvertUtils;
|
||||
|
||||
import org.jeecgframework.tag.core.JeecgTag;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 张代浩
|
||||
*
|
||||
*/
|
||||
public class BaseTag extends TagSupport {
|
||||
public class BaseTag extends JeecgTag {
|
||||
private Logger log = Logger.getLogger(BaseTag.class);
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected String type = "default";// 加载类型
|
||||
|
||||
|
@ -46,12 +50,43 @@ public class BaseTag extends TagSupport {
|
|||
|
||||
|
||||
public int doEndTag() throws JspException {
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// long start = System.currentTimeMillis();
|
||||
// log.info("================================ BaseTag 开始时间:"+sdf.format(new Date())+"==============================");
|
||||
JspWriter out = null;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String types[] = type.split(",");
|
||||
try {
|
||||
out = this.pageContext.getOut();
|
||||
/*// update-start--Author:longjb Date:20150408 for:手动设置指定属性主题优先
|
||||
out.print(end().toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(out!=null){
|
||||
try {
|
||||
|
||||
out.clearBuffer();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// long end = System.currentTimeMillis();
|
||||
// log.info("=============================== BaseTag 结束时间:"+sdf.format(new Date())+"==============================");
|
||||
// log.info("================================ BaseTag 耗时:"+(end-start)+"ms==============================");
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
||||
public StringBuffer end(){
|
||||
|
||||
StringBuffer sb = this.getTagCache();
|
||||
if(sb != null){
|
||||
return sb;
|
||||
}
|
||||
sb = new StringBuffer();
|
||||
|
||||
String types[] = type.split(",");
|
||||
/*// update-start--Author:longjb Date:20150408 for:手动设置指定属性主题优先
|
||||
//if (cssTheme == null) {//
|
||||
Cookie[] cookies = ((HttpServletRequest) super.pageContext
|
||||
.getRequest()).getCookies();
|
||||
|
@ -68,170 +103,122 @@ public class BaseTag extends TagSupport {
|
|||
if(cssTheme==null||"".equals(cssTheme)){
|
||||
cssTheme="default";
|
||||
}*/
|
||||
SysThemesEnum sysThemesEnum = null;
|
||||
if(StringUtil.isEmpty(cssTheme)||"null".equals(cssTheme)){
|
||||
sysThemesEnum = SysThemesUtil.getSysTheme((HttpServletRequest) super.pageContext.getRequest());
|
||||
}else{
|
||||
sysThemesEnum = SysThemesEnum.toEnum(cssTheme);
|
||||
}
|
||||
|
||||
//插入多语言脚本
|
||||
String lang = (String)((HttpServletRequest) this.pageContext.getRequest()).getSession().getAttribute("lang");
|
||||
String langjs = StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/mutiLang/{0}.js\"></script>", "{0}", lang);
|
||||
sb.append(langjs);
|
||||
SysThemesEnum sysThemesEnum = null;
|
||||
if(StringUtil.isEmpty(cssTheme)||"null".equals(cssTheme)){
|
||||
sysThemesEnum = SysThemesUtil.getSysTheme((HttpServletRequest) super.pageContext.getRequest());
|
||||
}else{
|
||||
sysThemesEnum = SysThemesEnum.toEnum(cssTheme);
|
||||
}
|
||||
|
||||
//插入多语言脚本
|
||||
String lang = (String)((HttpServletRequest) this.pageContext.getRequest()).getSession().getAttribute("lang");
|
||||
String langjs = StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/mutiLang/{0}.js\"></script>", "{0}", lang);
|
||||
sb.append(langjs);
|
||||
|
||||
if (oConvertUtils.isIn("jquery-webos", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/sliding/js/jquery-1.7.1.min.js\"></script>");
|
||||
|
||||
} else if (oConvertUtils.isIn("jquery", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery/jquery-1.8.3.js\"></script>");
|
||||
if (oConvertUtils.isIn("jquery-webos", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/sliding/js/jquery-1.7.1.min.js\"></script>");
|
||||
|
||||
} else if (oConvertUtils.isIn("jquery", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery/jquery-1.8.3.js\"></script>");
|
||||
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery/jquery.cookie.js\" ></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-plugs/storage/jquery.storageapi.min.js\" ></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery/jquery.cookie.js\" ></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-plugs/storage/jquery.storageapi.min.js\" ></script>");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (oConvertUtils.isIn("ckeditor", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/ckeditor/ckeditor.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/ckeditorTool.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("easyui", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/dataformat.js\"></script>");
|
||||
if (oConvertUtils.isIn("ckeditor", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/ckeditor/ckeditor.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/ckeditorTool.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("easyui", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/dataformat.js\"></script>");
|
||||
|
||||
// sb.append("<link id=\"easyuiTheme\" rel=\"stylesheet\" href=\"plug-in/easyui/themes/"+cssTheme+"/easyui.css\" type=\"text/css\"></link>");
|
||||
sb.append(SysThemesUtil.getEasyUiTheme(sysThemesEnum));
|
||||
sb.append(SysThemesUtil.getEasyUiMainTheme(sysThemesEnum));
|
||||
sb.append(SysThemesUtil.getEasyUiTheme(sysThemesEnum));
|
||||
sb.append(SysThemesUtil.getEasyUiMainTheme(sysThemesEnum));
|
||||
|
||||
sb.append(SysThemesUtil.getEasyUiIconTheme(sysThemesEnum));
|
||||
sb.append(SysThemesUtil.getEasyUiIconTheme(sysThemesEnum));
|
||||
// sb.append("<link rel=\"stylesheet\" href=\"plug-in/easyui/themes/icon.css\" type=\"text/css\"></link>");
|
||||
sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"plug-in/accordion/css/accordion.css\">");
|
||||
sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"plug-in/accordion/css/icons.css\">");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/jquery.easyui.min.1.3.2.js\"></script>");
|
||||
sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"plug-in/accordion/css/accordion.css\">");
|
||||
sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"plug-in/accordion/css/icons.css\">");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/jquery.easyui.min.1.3.2.js\"></script>");
|
||||
|
||||
// sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/locale/zh-cn.js\"></script>");
|
||||
sb.append(StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/easyui/locale/{0}.js\"></script>", "{0}", lang));
|
||||
sb.append(StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/easyui/locale/{0}.js\"></script>", "{0}", lang));
|
||||
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/syUtil.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/extends/datagrid-scrollview.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("DatePicker", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/My97DatePicker/WdatePicker.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("jqueryui", types)) {
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/jquery-ui/css/ui-lightness/jquery-ui-1.9.2.custom.min.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-ui/js/jquery-ui-1.9.2.custom.min.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("jqueryui-sortable", types)) {
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/jquery-ui/css/ui-lightness/jquery-ui-1.9.2.custom.min.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-ui/js/ui/jquery.ui.core.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-ui/js/ui/jquery.ui.widget.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-ui/js/ui/jquery.ui.mouse.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-ui/js/ui/jquery.ui.sortable.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("prohibit", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/prohibitutil.js\"></script>"); }
|
||||
if (oConvertUtils.isIn("designer", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/designer/easyui/jquery-1.7.2.min.js\"></script>");
|
||||
sb.append("<link id=\"easyuiTheme\" rel=\"stylesheet\" href=\"plug-in/designer/easyui/easyui.css\" type=\"text/css\"></link>");
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/designer/easyui/icon.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/designer/easyui/jquery.easyui.min.1.3.0.js\"></script>");
|
||||
|
||||
//加载easyui多语言
|
||||
sb.append(StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/designer/easyui/locale/{0}.js\"></script>", "{0}", lang));
|
||||
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/syUtil.js\"></script>");
|
||||
sb.append("<script type=\'text/javascript\' src=\'plug-in/jquery/jquery-autocomplete/lib/jquery.bgiframe.min.js\'></script>");
|
||||
sb.append("<script type=\'text/javascript\' src=\'plug-in/jquery/jquery-autocomplete/lib/jquery.ajaxQueue.js\'></script>");
|
||||
sb.append("<script type=\'text/javascript\' src=\'plug-in/jquery/jquery-autocomplete/jquery.autocomplete.min.js\'></script>");
|
||||
sb.append("<link href=\"plug-in/designer/designer.css\" type=\"text/css\" rel=\"stylesheet\" />");
|
||||
sb.append("<script src=\"plug-in/designer/draw2d/wz_jsgraphics.js\"></script>");
|
||||
sb.append("<script src=\'plug-in/designer/draw2d/mootools.js\'></script>");
|
||||
sb.append("<script src=\'plug-in/designer/draw2d/moocanvas.js\'></script>");
|
||||
sb.append("<script src=\'plug-in/designer/draw2d/draw2d.js\'></script>");
|
||||
sb.append("<script src=\"plug-in/designer/MyCanvas.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/ResizeImage.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/event/Start.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/event/End.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/connection/MyInputPort.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/connection/MyOutputPort.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/connection/DecoratedConnection.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/task/Task.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/task/UserTask.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/task/ManualTask.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/task/ServiceTask.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/gateway/ExclusiveGateway.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/gateway/ParallelGateway.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/boundaryevent/TimerBoundary.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/boundaryevent/ErrorBoundary.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/subprocess/CallActivity.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/task/ScriptTask.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/task/MailTask.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/task/ReceiveTask.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/task/BusinessRuleTask.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/designer.js\"></script>");
|
||||
sb.append("<script src=\"plug-in/designer/mydesigner.js\"></script>");
|
||||
|
||||
}
|
||||
if (oConvertUtils.isIn("tools", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/syUtil.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/extends/datagrid-scrollview.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("DatePicker", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/My97DatePicker/WdatePicker.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("jqueryui", types)) {
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/jquery-ui/css/ui-lightness/jquery-ui-1.9.2.custom.min.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-ui/js/jquery-ui-1.9.2.custom.min.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("jqueryui-sortable", types)) {
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/jquery-ui/css/ui-lightness/jquery-ui-1.9.2.custom.min.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-ui/js/ui/jquery.ui.core.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-ui/js/ui/jquery.ui.widget.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-ui/js/ui/jquery.ui.mouse.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-ui/js/ui/jquery.ui.sortable.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("prohibit", types)) {
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/prohibitutil.js\"></script>"); }
|
||||
if (oConvertUtils.isIn("tools", types)) {
|
||||
|
||||
// sb.append("<link rel=\"stylesheet\" href=\"plug-in/tools/css/"+("metro".equals(cssTheme)?"metro/":"")+"common.css\" type=\"text/css\"></link>");
|
||||
sb.append(SysThemesUtil.getCommonTheme(sysThemesEnum));
|
||||
sb.append(SysThemesUtil.getCommonTheme(sysThemesEnum));
|
||||
|
||||
// sb.append("<script type=\"text/javascript\" src=\"plug-in/lhgDialog/lhgdialog.min.js"+("metro".equals(cssTheme)?"?skin=metro":"")+"\"></script>");
|
||||
sb.append(SysThemesUtil.getLhgdialogTheme(sysThemesEnum));
|
||||
sb.append(SysThemesUtil.getBootstrapTabTheme(sysThemesEnum));
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/layer/layer.js\"></script>");
|
||||
sb.append(StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/tools/curdtools_{0}.js\"></script>", "{0}", lang));
|
||||
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/easyuiextend.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-plugs/hftable/jquery-hftable.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/json2.js\" ></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("toptip", types)) {
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/toptip/css/css.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/toptip/manhua_msgTips.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("autocomplete", types)) {
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/jquery/jquery-autocomplete/jquery.autocomplete.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery/jquery-autocomplete/jquery.autocomplete.min.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("jeasyuiextensions", types)) {
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/release/jquery.jdirk.min.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<link href=\"plug-in/jquery-extensions/icons/icon-all.css\" rel=\"stylesheet\" type=\"text/css\" />");
|
||||
sb.append("<link href=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.css\" rel=\"stylesheet\" type=\"text/css\" />");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.linkbutton.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.menu.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.panel.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.window.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.dialog.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.datagrid.js\" type=\"text/javascript\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("ztree", types)) {
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/ztree/css/zTreeStyle.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/ztree/js/jquery.ztree.core-3.5.min.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/ztree/js/jquery.ztree.excheck-3.5.min.js\"></script>");
|
||||
}
|
||||
out.print(sb.toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(out!=null){
|
||||
try {
|
||||
|
||||
out.clearBuffer();
|
||||
sb.setLength(0);
|
||||
sb = null;
|
||||
types = null;
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
sb.append(SysThemesUtil.getLhgdialogTheme(sysThemesEnum));
|
||||
sb.append(SysThemesUtil.getBootstrapTabTheme(sysThemesEnum));
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/layer/layer.js\"></script>");
|
||||
sb.append(StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/tools/curdtools_{0}.js\"></script>", "{0}", lang));
|
||||
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/easyuiextend.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery-plugs/hftable/jquery-hftable.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/json2.js\" ></script>");
|
||||
}
|
||||
return EVAL_PAGE;
|
||||
if (oConvertUtils.isIn("toptip", types)) {
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/toptip/css/css.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/toptip/manhua_msgTips.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("autocomplete", types)) {
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/jquery/jquery-autocomplete/jquery.autocomplete.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/jquery/jquery-autocomplete/jquery.autocomplete.min.js\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("jeasyuiextensions", types)) {
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/release/jquery.jdirk.min.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<link href=\"plug-in/jquery-extensions/icons/icon-all.css\" rel=\"stylesheet\" type=\"text/css\" />");
|
||||
sb.append("<link href=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.css\" rel=\"stylesheet\" type=\"text/css\" />");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.linkbutton.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.menu.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.panel.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.window.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.dialog.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"plug-in/jquery-extensions/jeasyui-extensions/jeasyui.extensions.datagrid.js\" type=\"text/javascript\"></script>");
|
||||
}
|
||||
if (oConvertUtils.isIn("ztree", types)) {
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/ztree/css/zTreeStyle.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/ztree/js/jquery.ztree.core-3.5.min.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/ztree/js/jquery.ztree.excheck-3.5.min.js\"></script>");
|
||||
}
|
||||
types = null;
|
||||
|
||||
this.putTagCache(sb);
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new StringBuffer().append("BaseTag [type=").append(type)
|
||||
.append(",sysTheme=").append(SysThemesUtil.getSysTheme(ContextHolderUtils.getRequest()).getStyle())
|
||||
.append(",brower_type=").append(ContextHolderUtils.getSession().getAttribute("brower_type"))
|
||||
.append(",cssTheme=").append(cssTheme)
|
||||
.append("]").toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.jeecgframework.tag.core.easyui;
|
||||
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.tagext.Tag;
|
||||
|
@ -57,6 +58,26 @@ public class DataGridColumnTag extends TagSupport {
|
|||
|
||||
private String defaultVal = "";//列默认值
|
||||
|
||||
protected String showMode;//表单元素,查询表单中显示样式,默认样式select
|
||||
|
||||
protected boolean newColumn = false;//是否新起一行
|
||||
|
||||
public boolean isNewColumn() {
|
||||
return newColumn;
|
||||
}
|
||||
|
||||
public void setNewColumn(boolean newColumn) {
|
||||
this.newColumn = newColumn;
|
||||
}
|
||||
|
||||
public String getShowMode() {
|
||||
return showMode;
|
||||
}
|
||||
|
||||
public void setShowMode(String showMode) {
|
||||
this.showMode = showMode;
|
||||
}
|
||||
|
||||
public String getEditor() {
|
||||
return editor;
|
||||
}
|
||||
|
@ -69,7 +90,9 @@ public class DataGridColumnTag extends TagSupport {
|
|||
|
||||
Tag t = findAncestorWithClass(this, DataGridTag.class);
|
||||
DataGridTag parent = (DataGridTag) t;
|
||||
parent.setColumn(title,field,width,showLen,rowspan,colspan,align,sortable,checkbox,formatter,formatterjs,hidden,replace,treefield,image,imageSize,query,url,funname,arg,queryMode, dictionary,popup,frozenColumn,extend,style,downloadName,autocomplete,extendParams,editor,defaultVal);
|
||||
|
||||
parent.setColumn(title,field,width,showLen,rowspan,colspan,align,sortable,checkbox,formatter,formatterjs,hidden,replace,treefield,image,imageSize,query,url,funname,arg,queryMode, dictionary,popup,frozenColumn,extend,style,downloadName,autocomplete,extendParams,editor,defaultVal,showMode,newColumn);
|
||||
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
||||
|
@ -202,6 +225,11 @@ public class DataGridColumnTag extends TagSupport {
|
|||
}
|
||||
|
||||
public void setExtendParams(String extendParams) {
|
||||
|
||||
if(StringUtil.isNotEmpty(extendParams) && !extendParams.endsWith(",")){
|
||||
extendParams = extendParams + ",";
|
||||
}
|
||||
|
||||
this.extendParams = extendParams;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,7 +21,9 @@ public class DataGridToolBarTag extends TagSupport {
|
|||
private String height;
|
||||
private String operationCode;//按钮的操作Code
|
||||
private String langArg;//按钮的操作Code
|
||||
|
||||
|
||||
private String id;//控件ID
|
||||
|
||||
|
||||
public int doStartTag() throws JspTagException {
|
||||
return EVAL_PAGE;
|
||||
|
@ -31,7 +33,7 @@ public class DataGridToolBarTag extends TagSupport {
|
|||
|
||||
Tag t = findAncestorWithClass(this, DataGridTag.class);
|
||||
DataGridTag parent = (DataGridTag) t;
|
||||
parent.setToolbar(url, title, icon, exp,onclick, funname,operationCode,width,height);
|
||||
parent.setToolbar(url, title, icon, exp,onclick, funname,operationCode,width,height,id);
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
||||
|
@ -71,4 +73,11 @@ public class DataGridToolBarTag extends TagSupport {
|
|||
public void setLangArg(String langArg) {
|
||||
this.langArg = langArg;
|
||||
}
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -137,6 +137,7 @@ public class DictSelectTag extends TagSupport {
|
|||
if (!StringUtils.isBlank(this.id)) {
|
||||
sb.append(" id=\"" + id + "\"");
|
||||
}
|
||||
this.datatype(sb);
|
||||
sb.append(">");
|
||||
select("common.please.select", "", sb);
|
||||
for (Map<String, Object> map : list) {
|
||||
|
@ -335,7 +336,7 @@ public class DictSelectTag extends TagSupport {
|
|||
+ " as text from " + dictTable;
|
||||
|
||||
if(dictCondition!=null){
|
||||
sql+=dictCondition;
|
||||
sql+=" "+dictCondition+" ";
|
||||
}
|
||||
|
||||
systemService = ApplicationContextUtil.getContext().getBean(
|
||||
|
|
|
@ -5,18 +5,20 @@ import java.io.IOException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import org.jeecgframework.core.enums.SysThemesEnum;
|
||||
import org.jeecgframework.core.util.ContextHolderUtils;
|
||||
import org.jeecgframework.core.util.EhcacheUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.core.util.SysThemesUtil;
|
||||
import org.jeecgframework.tag.core.JeecgTag;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 张代浩
|
||||
*
|
||||
*/
|
||||
public class FormValidationTag extends TagSupport {
|
||||
public class FormValidationTag extends JeecgTag {
|
||||
private static final long serialVersionUID = 8360534826228271024L;
|
||||
protected String formid = "formobj";// 表单FORM ID
|
||||
protected Boolean refresh = true;
|
||||
|
@ -79,13 +81,38 @@ public class FormValidationTag extends TagSupport {
|
|||
this.action = action;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据key获取缓存
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public StringBuffer getTagCache(String key){
|
||||
return (StringBuffer) EhcacheUtil.get(EhcacheUtil.TagCache, key);
|
||||
}
|
||||
/**
|
||||
* 存放缓存
|
||||
* @param key
|
||||
* @param tagCache
|
||||
*/
|
||||
public void putTagCache(String key, StringBuffer tagCache){
|
||||
EhcacheUtil.put(EhcacheUtil.TagCache, key, tagCache);
|
||||
}
|
||||
|
||||
|
||||
public int doStartTag() throws JspException {
|
||||
JspWriter out = null;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
StringBuffer sb = this.getTagCache("doStartTag"+"_"+toString());
|
||||
try {
|
||||
out = this.pageContext.getOut();
|
||||
/*// if(cssTheme==null){//手工设置值优先
|
||||
if(sb != null){
|
||||
out.print(sb.toString());
|
||||
out.flush();
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
||||
sb = new StringBuffer();
|
||||
/*// if(cssTheme==null){//手工设置值优先
|
||||
Cookie[] cookies = ((HttpServletRequest) super.pageContext
|
||||
.getRequest()).getCookies();
|
||||
for (Cookie cookie : cookies) {
|
||||
|
@ -112,6 +139,9 @@ public class FormValidationTag extends TagSupport {
|
|||
sb.append(" action=\"" + action + "\" name=\"" + formid + "\" method=\"post\">");
|
||||
if ("btn_sub".equals(btnsub) && dialog)
|
||||
sb.append("<input type=\"hidden\" id=\"" + btnsub + "\" class=\"" + btnsub + "\"/>");
|
||||
|
||||
this.putTagCache("doStartTag"+"_"+toString(), sb);
|
||||
|
||||
out.print(sb.toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
|
@ -119,8 +149,6 @@ public class FormValidationTag extends TagSupport {
|
|||
}finally{
|
||||
try {
|
||||
out.clearBuffer();
|
||||
sb.setLength(0);
|
||||
sb = null;
|
||||
} catch (Exception e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
|
@ -130,17 +158,25 @@ public class FormValidationTag extends TagSupport {
|
|||
|
||||
|
||||
public int doEndTag() throws JspException {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String lang = (String)((HttpServletRequest) this.pageContext.getRequest()).getSession().getAttribute("lang");
|
||||
|
||||
StringBuffer sb = this.getTagCache("doEndTag"+"_"+lang+"_"+toString());
|
||||
JspWriter out = null;
|
||||
try {
|
||||
String lang = (String)((HttpServletRequest) this.pageContext.getRequest()).getSession().getAttribute("lang");
|
||||
out = this.pageContext.getOut();
|
||||
if(sb != null){
|
||||
out.print(sb.toString());
|
||||
out.flush();
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
||||
SysThemesEnum sysThemesEnum = null;
|
||||
if(StringUtil.isEmpty(cssTheme)||"null".equals(cssTheme)){
|
||||
sysThemesEnum = SysThemesUtil.getSysTheme((HttpServletRequest) super.pageContext.getRequest());
|
||||
}else{
|
||||
sysThemesEnum = SysThemesEnum.toEnum(cssTheme);
|
||||
}
|
||||
out = this.pageContext.getOut();
|
||||
sb = new StringBuffer();
|
||||
if (layout.equals("div")) {
|
||||
|
||||
// if("metro".equals(cssTheme)){
|
||||
|
@ -182,9 +218,12 @@ public class FormValidationTag extends TagSupport {
|
|||
sb.append("<script src=\"plug-in/layer/layer.js\"></script>");
|
||||
|
||||
sb.append("<script type=\"text/javascript\">");
|
||||
|
||||
sb.append("var subDlgIndex = null;");
|
||||
|
||||
sb.append("$(function(){");
|
||||
sb.append("$(\"#" + formid + "\").Validform({");
|
||||
if(this.getTiptype()!=null && !"".equals(this.getTiptype())){
|
||||
if(this.getTiptype()!=null && !"".equals(this.getTiptype())){
|
||||
|
||||
if(tiptype.equals("1")){
|
||||
sb.append("tiptype:function(msg,o,cssctl){");
|
||||
|
@ -195,7 +234,9 @@ public class FormValidationTag extends TagSupport {
|
|||
sb.append("content:msg,icon:5,shift:6,btn:false,shade:false,time:5000,");
|
||||
|
||||
sb.append("cancel:function(index){o.obj.focus();layer.close(index);},");
|
||||
sb.append("yes:function(index){o.obj.focus();layer.close(index);},");
|
||||
|
||||
sb.append("yes:function(index){o.obj.focus();layer.close(index);}");
|
||||
|
||||
sb.append("})");
|
||||
sb.append("}},");
|
||||
}else{
|
||||
|
@ -232,12 +273,25 @@ public class FormValidationTag extends TagSupport {
|
|||
sb.append("ajaxPost:true,");
|
||||
if (beforeSubmit != null) {
|
||||
sb.append("beforeSubmit:function(curform){var tag=false;");
|
||||
sb.append("return " + beforeSubmit );
|
||||
|
||||
sb.append("tag = " + beforeSubmit );
|
||||
if(beforeSubmit.indexOf("(") < 0){
|
||||
sb.append("(curform);");
|
||||
}else if(!beforeSubmit.endsWith(";")){
|
||||
sb.append(";");
|
||||
}
|
||||
sb.append("},");
|
||||
sb.append("if(tag){");
|
||||
|
||||
submitLoading(sb);
|
||||
|
||||
sb.append("}else{ return false;}");
|
||||
|
||||
}else{
|
||||
sb.append("beforeSubmit:function(curform){var tag=false;");
|
||||
submitLoading(sb);
|
||||
}
|
||||
sb.append("},");
|
||||
|
||||
if (usePlugin != null) {
|
||||
StringBuffer passsb = new StringBuffer();
|
||||
if (usePlugin.indexOf("password") >= 0) {
|
||||
|
@ -278,6 +332,12 @@ public class FormValidationTag extends TagSupport {
|
|||
sb.append("},");
|
||||
}
|
||||
sb.append("callback:function(data){");
|
||||
|
||||
sb.append("if(subDlgIndex && subDlgIndex != null){");
|
||||
sb.append("$('#infoTable-loading').hide();");
|
||||
sb.append("subDlgIndex.close();");
|
||||
sb.append("}");
|
||||
|
||||
if (dialog) {
|
||||
if(callback!=null&&callback.contains("@Override")){//复写默认callback
|
||||
sb.append(callback.replaceAll("@Override", "") + "(data);");
|
||||
|
@ -318,6 +378,9 @@ public class FormValidationTag extends TagSupport {
|
|||
}
|
||||
sb.append("</div></div>");
|
||||
}
|
||||
|
||||
this.putTagCache("doEndTag"+"_"+lang+"_"+toString(), sb);
|
||||
|
||||
out.print(sb.toString());
|
||||
out.flush();
|
||||
} catch (IOException e) {
|
||||
|
@ -325,8 +388,8 @@ public class FormValidationTag extends TagSupport {
|
|||
}finally{
|
||||
try {
|
||||
|
||||
sb.setLength(0);
|
||||
sb = null;
|
||||
// sb.setLength(0);
|
||||
// sb = null;
|
||||
|
||||
out.clearBuffer();
|
||||
} catch (Exception e2) {
|
||||
|
@ -335,6 +398,27 @@ public class FormValidationTag extends TagSupport {
|
|||
return EVAL_PAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加显示加载图层
|
||||
* @param sb
|
||||
*/
|
||||
private void submitLoading(StringBuffer sb) {
|
||||
sb.append("subDlgIndex = $.dialog({");
|
||||
sb.append("content: '正在加载中'");
|
||||
sb.append(",zIndex:19910320");
|
||||
sb.append(",lock:true");
|
||||
sb.append(",width:100");
|
||||
sb.append(",height:50");
|
||||
sb.append(",opacity:0.3");
|
||||
sb.append(",title:'提示'");
|
||||
sb.append(",cache:false");
|
||||
sb.append("");
|
||||
sb.append("});");
|
||||
sb.append("var infoTable = subDlgIndex.DOM.t.parent().parent().parent();");
|
||||
sb.append("infoTable.parent().append('<div id=\"infoTable-loading\" style=\"text-align:center;\"><img src=\"plug-in/layer/skin/default/loading-0.gif\"/></div>');");
|
||||
sb.append("infoTable.css('display','none');");
|
||||
}
|
||||
|
||||
public void setUsePlugin(String usePlugin) {
|
||||
this.usePlugin = usePlugin;
|
||||
}
|
||||
|
@ -358,5 +442,25 @@ public class FormValidationTag extends TagSupport {
|
|||
public void setTiptype(String tiptype) {
|
||||
this.tiptype = tiptype;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("FormValidationTag [formid=").append(formid)
|
||||
.append(", refresh=").append(refresh).append(", callback=")
|
||||
.append(callback).append(", beforeSubmit=")
|
||||
.append(beforeSubmit).append(", btnsub=").append(btnsub)
|
||||
.append(", btnreset=").append(btnreset).append(", layout=")
|
||||
.append(layout).append(", usePlugin=").append(usePlugin)
|
||||
.append(", dialog=").append(dialog).append(", action=")
|
||||
.append(action).append(", tabtitle=").append(tabtitle)
|
||||
.append(", tiptype=").append(tiptype).append(", styleClass=")
|
||||
.append(styleClass).append(", cssTheme=").append(cssTheme)
|
||||
.append(",sysTheme=").append(SysThemesUtil.getSysTheme(ContextHolderUtils.getRequest()).getStyle())
|
||||
.append(",brower_type=").append(ContextHolderUtils.getSession().getAttribute("brower_type"))
|
||||
.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class HasPermissionTag extends TagSupport{
|
|||
}
|
||||
|
||||
public boolean showTagBody(String code) {
|
||||
if(ResourceUtil.getSessionUserName().getUserName().equals("admin")|| !Globals.BUTTON_AUTHORITY_CHECK){
|
||||
if(ResourceUtil.getSessionUser().getUserName().equals("admin")|| !Globals.BUTTON_AUTHORITY_CHECK){
|
||||
return false;
|
||||
}else{
|
||||
//权限判断;
|
||||
|
|
|
@ -3,14 +3,14 @@ package org.jeecgframework.tag.core.easyui;
|
|||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import org.jeecgframework.tag.core.JeecgTag;
|
||||
import org.jeecgframework.web.system.pojo.base.TSFunction;
|
||||
|
||||
import org.jeecgframework.core.util.ContextHolderUtils;
|
||||
import org.jeecgframework.core.util.ListtoMenu;
|
||||
import org.jeecgframework.core.util.SysThemesUtil;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ import org.jeecgframework.core.util.ListtoMenu;
|
|||
* @date: 日期:2012-12-7 时间:上午10:17:45
|
||||
* @version 1.0
|
||||
*/
|
||||
public class MenuTag extends TagSupport {
|
||||
public class MenuTag extends JeecgTag {
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected String style="easyui";//菜单样式
|
||||
protected List<TSFunction> parentFun;//一级菜单
|
||||
|
@ -43,10 +43,12 @@ public class MenuTag extends TagSupport {
|
|||
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
StringBuffer endString = null;
|
||||
try {
|
||||
|
||||
out = this.pageContext.getOut();
|
||||
out.print(end().toString());
|
||||
endString = end();
|
||||
out.print(endString.toString());
|
||||
out.flush();
|
||||
// String menu = (String) this.pageContext.getSession().getAttribute("leftMenuCache"+style);
|
||||
// if(menu!=null){
|
||||
|
@ -64,7 +66,11 @@ public class MenuTag extends TagSupport {
|
|||
}finally{
|
||||
try {
|
||||
out.clearBuffer();
|
||||
end().setLength(0);
|
||||
//添加缓存后,不需要清空,并且清空后会对缓存造成影响
|
||||
// if(endString != null){
|
||||
// endString.setLength(0);
|
||||
// }
|
||||
//end().setLength(0);
|
||||
} catch (Exception e2) {
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +78,12 @@ public class MenuTag extends TagSupport {
|
|||
}
|
||||
|
||||
public StringBuffer end() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
StringBuffer sb = this.getTagCache();
|
||||
if(sb != null){
|
||||
return sb;
|
||||
}
|
||||
sb = new StringBuffer();
|
||||
|
||||
if (style.equals("easyui")) {
|
||||
sb.append("<ul id=\"nav\" class=\"easyui-tree tree-lines\" fit=\"true\" border=\"false\">");
|
||||
|
@ -114,6 +125,9 @@ public class MenuTag extends TagSupport {
|
|||
if(style.equals("hplus")){
|
||||
sb.append(ListtoMenu.getHplusMultistageTree(menuFun));
|
||||
}
|
||||
|
||||
this.putTagCache(sb);
|
||||
|
||||
return sb;
|
||||
}
|
||||
public void setStyle(String style) {
|
||||
|
@ -124,6 +138,18 @@ public class MenuTag extends TagSupport {
|
|||
this.menuFun = menuFun;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("MenuTag [style=").append(style);
|
||||
builder.append(",sessionid=").append(ContextHolderUtils.getSession().getId());
|
||||
builder.append(",sysTheme=").append(SysThemesUtil.getSysTheme(ContextHolderUtils.getRequest()).getStyle())
|
||||
.append(",brower_type=").append(ContextHolderUtils.getSession().getAttribute("brower_type"))
|
||||
.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -98,6 +98,7 @@ public class SelectZTreeTag extends TagSupport {
|
|||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/ztree/css/zTreeStyle.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/ztree/js/jquery.ztree.core-3.5.min.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/ztree/js/jquery.ztree.excheck-3.5.min.js\"></script>");
|
||||
|
||||
sb.append("<script type=\"text/javascript\">"
|
||||
+"function beforeClick(treeId, treeNode) {"
|
||||
+ " var zTree = $.fn.zTree.getZTreeObj('treeDemo');"
|
||||
|
@ -112,12 +113,12 @@ public class SelectZTreeTag extends TagSupport {
|
|||
+ " v += nodes[i].name + ',';"
|
||||
+ " }"
|
||||
+ " if (v.length > 0 ) v = v.substring(0, v.length-1);"
|
||||
+ " var cityObj = $("+id+");"
|
||||
+ " var cityObj = $('#"+id+"');"
|
||||
+ " cityObj.attr('value', v);"
|
||||
+ "} "
|
||||
+ " function showMenu() {"
|
||||
+ " var cityObj = $("+id+");"
|
||||
+ " var cityOffset = $("+id+").offset();"
|
||||
+ " var cityObj = $('#"+id+"');"
|
||||
+ " var cityOffset = $('#"+id+"').offset();"
|
||||
+ " $('#menuContent').css({left:cityOffset.left + 'px', top:cityOffset.top + cityObj.outerHeight() + 'px'}).slideDown('fast');"
|
||||
+ " $('body').bind('mousedown', onBodyDown);"
|
||||
+ "} "
|
||||
|
@ -164,6 +165,7 @@ public class SelectZTreeTag extends TagSupport {
|
|||
+ " );"
|
||||
+ "});"
|
||||
+ "</script>");
|
||||
|
||||
sb.append(" <input id=\""+id+"\" name=\""+id+"\" type=\"text\" readonly value=\"\" style=\"width:"+windowWidth+";height:"+windowHeight+"\" class=\"form-control\" onclick=\"showMenu();\" />");
|
||||
sb.append("<div id=\"menuContent\" class=\"menuContent\" style=\"display:none; position: absolute;\" >");
|
||||
sb.append(" <ul id=\"treeDemo\" class=\"ztree\" style=\"margin-top:0; width:100%;background-color:#f9f9f9\"></ul>");
|
||||
|
|
|
@ -3,12 +3,12 @@ package org.jeecgframework.tag.core.easyui;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import org.jeecgframework.core.util.ContextHolderUtils;
|
||||
import org.jeecgframework.core.util.SysThemesUtil;
|
||||
import org.jeecgframework.core.util.oConvertUtils;
|
||||
import org.jeecgframework.tag.core.JeecgTag;
|
||||
import org.jeecgframework.tag.vo.easyui.Tab;
|
||||
|
||||
|
||||
|
@ -20,7 +20,8 @@ import org.jeecgframework.tag.vo.easyui.Tab;
|
|||
* @date: 日期:2012-12-7 时间:上午10:17:45
|
||||
* @version 1.0
|
||||
*/
|
||||
public class TabsTag extends TagSupport {
|
||||
public class TabsTag extends JeecgTag {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String id;// 容器ID
|
||||
private String width;// 宽度
|
||||
private String heigth;// 高度
|
||||
|
@ -113,7 +114,13 @@ public class TabsTag extends TagSupport {
|
|||
}
|
||||
|
||||
public StringBuffer end() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
StringBuffer sb = this.getTagCache();
|
||||
if(sb != null){
|
||||
return sb;
|
||||
}
|
||||
sb = new StringBuffer();
|
||||
|
||||
if (iframe) {
|
||||
sb.append("<script type=\"text/javascript\">");
|
||||
sb.append("$(function(){");
|
||||
|
@ -152,7 +159,7 @@ public class TabsTag extends TagSupport {
|
|||
sb.append("function createFrame" + id + "(id)");
|
||||
sb.append("{");
|
||||
|
||||
sb.append("var s = \'<iframe id=\"+id+\" scrolling=\"no\" frameborder=\"0\" src=\"about:jeecg\" width=\""+oConvertUtils.getString(width, "100%")+"\" height=\""+oConvertUtils.getString(heigth, "99.5%")+"\"></iframe>\';");
|
||||
sb.append("var s = \'<iframe id=\"+id+\" scrolling=\"no\" frameborder=\"0\" src=\"about:blank\" width=\""+oConvertUtils.getString(width, "100%")+"\" height=\""+oConvertUtils.getString(heigth, "99.5%")+"\"></iframe>\';");
|
||||
|
||||
sb.append("return s;");
|
||||
sb.append("}");
|
||||
|
@ -165,9 +172,9 @@ public class TabsTag extends TagSupport {
|
|||
if (!iframe) {
|
||||
for (Tab tab : tabList) {
|
||||
if (tab.getHref() != null) {
|
||||
sb.append("<div title=\"" + tab.getTitle() + "\" href=\"" + tab.getHref() + "\" style=\"margin:0px;padding:0px;overflow-x:hidden;overflow-y:auto;width=auto;\"></div>");
|
||||
sb.append("<div title=\"" + tab.getTitle() + "\" " + (tab.getIcon() != null ? ("iconCls=\"" + tab.getIcon() + "\" ") : "") + " href=\"" + tab.getHref() + "\" style=\"margin:0px;padding:0px;overflow-x:hidden;overflow-y:auto;width=auto;\"></div>");
|
||||
} else {
|
||||
sb.append("<div title=\"" + tab.getTitle() + "\" style=\"margin:0px;padding:0px;overflow-x:hidden;overflow-y:auto;width=auto;\">");
|
||||
sb.append("<div " + (tab.getIcon() != null ? ("iconCls=\"" + tab.getIcon() + "\" ") : "") + " title=\"" + tab.getTitle() + "\" style=\"margin:0px;padding:0px;overflow-x:hidden;overflow-y:auto;width=auto;\">");
|
||||
|
||||
sb.append("<iframe id=\""+tab.getId()+"\" scrolling=\"no\" frameborder=\"0\" src=\""+tab.getIframe()+"\" width=\""+oConvertUtils.getString(tab.getWidth(), "100%")+"\" height=\""+oConvertUtils.getString(tab.getHeigth(), "99.5%")+"\"></iframe>");
|
||||
|
||||
|
@ -177,8 +184,10 @@ public class TabsTag extends TagSupport {
|
|||
}
|
||||
}
|
||||
sb.append("</div>");
|
||||
|
||||
}
|
||||
|
||||
this.putTagCache(sb);
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
@ -197,4 +206,37 @@ public class TabsTag extends TagSupport {
|
|||
tabList.add(tab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("TabsTag [id=").append(id).append(", width=")
|
||||
.append(width).append(", heigth=").append(heigth)
|
||||
.append(", plain=").append(plain).append(", fit=").append(fit)
|
||||
.append(", border=").append(border)
|
||||
.append(", scrollIncrement=").append(scrollIncrement)
|
||||
.append(", scrollDuration=").append(scrollDuration)
|
||||
.append(", tools=").append(tools).append(", tabs=")
|
||||
.append(tabs).append(", iframe=").append(iframe)
|
||||
.append(", tabPosition=").append(tabPosition);
|
||||
builder.append(",tabList=[");
|
||||
for(Tab tab : tabList){
|
||||
builder.append(tab.getId()+",");
|
||||
builder.append(tab.getIframe()+",");
|
||||
builder.append(tab.getTitle()+",");
|
||||
builder.append(tab.getHeigth()+",");
|
||||
builder.append(tab.getWidth()+",");
|
||||
builder.append(tab.getIcon()+",");
|
||||
builder.append(tab.getContent()+",");
|
||||
builder.append(tab.isCache()+",");
|
||||
builder.append(tab.isClosable()+",");
|
||||
builder.append(tab.getHref()+";");
|
||||
}
|
||||
builder.append("]");
|
||||
builder.append(",sysTheme=").append(SysThemesUtil.getSysTheme(ContextHolderUtils.getRequest()).getStyle())
|
||||
.append(",brower_type=").append(ContextHolderUtils.getSession().getAttribute("brower_type"))
|
||||
.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -485,6 +485,7 @@ public class TagUtil {
|
|||
object = null;
|
||||
dg.clear();
|
||||
dg = null;
|
||||
System.gc();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -516,6 +517,10 @@ public class TagUtil {
|
|||
|
||||
object.clear();
|
||||
|
||||
dg.clear();
|
||||
dg = null;
|
||||
System.gc();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -551,6 +556,11 @@ public class TagUtil {
|
|||
|
||||
object.clear();
|
||||
|
||||
dg.clear();
|
||||
dg = null;
|
||||
System.gc();
|
||||
extMap = null;
|
||||
|
||||
} catch (Exception e2) {
|
||||
// TODO: handle exception
|
||||
}
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
package org.jeecgframework.tag.core.easyui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
import javax.servlet.jsp.JspWriter;
|
||||
import javax.servlet.jsp.tagext.TagSupport;
|
||||
|
||||
import org.jeecgframework.core.util.ContextHolderUtils;
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
import org.jeecgframework.core.util.SysThemesUtil;
|
||||
import org.jeecgframework.tag.core.JeecgTag;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -16,7 +20,7 @@ import org.jeecgframework.core.util.MutiLangUtil;
|
|||
* @date: 日期:2012-12-7 时间:上午10:17:45
|
||||
* @version 1.0
|
||||
*/
|
||||
public class UploadTag extends TagSupport {
|
||||
public class UploadTag extends JeecgTag {
|
||||
private static final long serialVersionUID = 1L;
|
||||
protected String id;// ID
|
||||
protected String uploader;//url
|
||||
|
@ -33,8 +37,16 @@ public class UploadTag extends TagSupport {
|
|||
protected boolean view=false;//生成查看删除链接
|
||||
|
||||
protected String formId;//参数名称
|
||||
|
||||
private boolean outhtml = true;
|
||||
|
||||
|
||||
public boolean isOuthtml() {
|
||||
return outhtml;
|
||||
}
|
||||
public void setOuthtml(boolean outhtml) {
|
||||
this.outhtml = outhtml;
|
||||
}
|
||||
|
||||
public String getFormId() {
|
||||
return formId;
|
||||
}
|
||||
|
@ -82,7 +94,16 @@ public class UploadTag extends TagSupport {
|
|||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public int doStartTag() throws JspTagException {
|
||||
|
||||
List<String> idList = (List<String>) pageContext.getRequest().getAttribute("nameList");
|
||||
if(idList == null || idList.isEmpty()){
|
||||
idList = new ArrayList<String>();
|
||||
}
|
||||
idList.add(id);
|
||||
pageContext.getRequest().setAttribute("nameList", idList);
|
||||
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
public int doEndTag() throws JspTagException {
|
||||
|
@ -102,19 +123,31 @@ public class UploadTag extends TagSupport {
|
|||
}
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public StringBuffer end() {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
StringBuffer sb = this.getTagCache();
|
||||
if(sb != null){
|
||||
return sb;
|
||||
}
|
||||
sb = new StringBuffer();
|
||||
|
||||
if("pic".equals(extend))
|
||||
{
|
||||
extend="*.jpg;*,jpeg;*.png;*.gif;*.bmp;*.ico;*.tif";
|
||||
extend="*.jpg;*.jpeg;*.png;*.gif;*.bmp;*.ico;*.tif";
|
||||
}
|
||||
if(extend.equals("office"))
|
||||
{
|
||||
extend="*.doc;*.docx;*.txt;*.ppt;*.xls;*.xlsx;*.html;*.htm";
|
||||
}
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/uploadify/css/uploadify.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");
|
||||
|
||||
if(outhtml){
|
||||
sb.append("<link rel=\"stylesheet\" href=\"plug-in/uploadify/css/uploadify.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");
|
||||
}
|
||||
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/Map.js\"></script>");
|
||||
|
||||
sb.append("<script type=\"text/javascript\">"
|
||||
+"var flag = false;"
|
||||
+"var fileitem=\"\";"
|
||||
|
@ -140,11 +173,22 @@ public class UploadTag extends TagSupport {
|
|||
String[] paramnames=formData.split(",");
|
||||
for (int i = 0; i < paramnames.length; i++) {
|
||||
String paramname=paramnames[i];
|
||||
sb.append("var "+paramname+"=$(\'#"+paramname+"\').val();");
|
||||
|
||||
String fieldName = paramname;
|
||||
if(paramname.indexOf("_")> -1 ){
|
||||
fieldName = paramname.substring(0, paramname.indexOf("_"));
|
||||
}
|
||||
sb.append("var "+fieldName+"=$(\'#"+paramname+"\').val();");
|
||||
|
||||
}
|
||||
sb.append("$(\'#"+id+"\').uploadify(\"settings\", \"formData\", {");
|
||||
for (int i = 0; i < paramnames.length; i++) {
|
||||
String paramname=paramnames[i];
|
||||
|
||||
if(paramname.indexOf("_")> -1 ){
|
||||
paramname = paramname.substring(0, paramname.indexOf("_"));
|
||||
}
|
||||
|
||||
if (i==paramnames.length-1) {
|
||||
sb.append("'"+paramname+"':"+paramname+"");
|
||||
}else{
|
||||
|
@ -176,6 +220,14 @@ public class UploadTag extends TagSupport {
|
|||
sb.append("var win = frameElement.api.opener;"
|
||||
+"win.reloadTable();"
|
||||
+"win.tip(serverMsg);"
|
||||
|
||||
+"if(subDlgIndex && $('#infoTable-loading')){"
|
||||
+"$('#infoTable-loading').hide();"
|
||||
|
||||
+"if(!subDlgIndex.closed)subDlgIndex.close();"
|
||||
|
||||
+"}"
|
||||
|
||||
+"frameElement.api.close();");
|
||||
}
|
||||
else
|
||||
|
@ -232,22 +284,36 @@ public class UploadTag extends TagSupport {
|
|||
//+"tip('<span>文件上传成功:'+totalBytesUploaded/1024 + ' KB 已上传 ,总数' + totalBytesTotal/1024 + ' KB.</span>');"
|
||||
+"}"
|
||||
+"});"
|
||||
+"});"
|
||||
+"function upload() {"
|
||||
+" $(\'#"+id+"\').uploadify('upload', '*');"
|
||||
+" return flag;"
|
||||
+"}"
|
||||
+"function cancel() {"
|
||||
+"$(\'#"+id+"\').uploadify('cancel', '*');"
|
||||
+"}"
|
||||
+"</script>");
|
||||
+"});");
|
||||
|
||||
if(outhtml){
|
||||
List<String> idList = (List<String>) pageContext.getRequest().getAttribute("nameList");
|
||||
sb.append("function upload() {");
|
||||
for (int i = 0; i < idList.size(); i++) {
|
||||
String tempId = idList.get(i);
|
||||
sb.append(" $(\'#"+tempId+"\').uploadify('upload', '*');");
|
||||
|
||||
}
|
||||
sb.append("return flag;");
|
||||
sb.append("}");
|
||||
sb.append("function cancel() {");
|
||||
for (int i = 0; i < idList.size(); i++) {
|
||||
String tempId = idList.get(i);
|
||||
sb.append("$(\'#"+tempId+"\').uploadify('cancel', '*');");
|
||||
}
|
||||
sb.append("}");
|
||||
}
|
||||
sb.append("</script>");
|
||||
|
||||
sb.append("<span id=\""+id+"span\"><input type=\"file\" name=\""+name+"\" id=\""+id+"\" /></span>");
|
||||
if(view)
|
||||
{
|
||||
sb.append("<span id=\"viewmsg\"></span>");
|
||||
sb.append("<input type=\"hidden\" name=\"fileKey\" id=\"fileKey\" />");
|
||||
}
|
||||
|
||||
|
||||
this.putTagCache(sb);
|
||||
|
||||
return sb;
|
||||
}
|
||||
|
||||
|
@ -269,6 +335,27 @@ public class UploadTag extends TagSupport {
|
|||
this.extend = extend;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("UploadTag [id=").append(id).append(", uploader=")
|
||||
.append(uploader).append(", name=").append(name)
|
||||
.append(", formData=").append(formData).append(", extend=")
|
||||
.append(extend).append(", buttonText=").append(buttonText)
|
||||
.append(", multi=").append(multi).append(", queueID=")
|
||||
.append(queueID).append(", dialog=").append(dialog)
|
||||
.append(", callback=").append(callback).append(", auto=")
|
||||
.append(auto).append(", onUploadSuccess=")
|
||||
.append(onUploadSuccess).append(", view=").append(view)
|
||||
.append(", formId=").append(formId).append(", outhtml=")
|
||||
.append(outhtml).append(", fileSizeLimit=").append(fileSizeLimit)
|
||||
.append(",sysTheme=").append(SysThemesUtil.getSysTheme(ContextHolderUtils.getRequest()).getStyle())
|
||||
.append(",brower_type=").append(ContextHolderUtils.getSession().getAttribute("brower_type"))
|
||||
.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,9 @@ public class UserSelectTag extends TagSupport {
|
|||
private String inputWidth; //输入框宽度
|
||||
private String windowWidth; //弹出窗口宽度
|
||||
private String windowHeight; //弹出窗口高度
|
||||
|
||||
|
||||
private String callback;//自定义回掉函数
|
||||
|
||||
|
||||
public String getUserIdsDefalutVal() {
|
||||
return userIdsDefalutVal;
|
||||
|
@ -102,10 +104,22 @@ public class UserSelectTag extends TagSupport {
|
|||
public void setUserNamesDefalutVal(String userNamesDefalutVal) {
|
||||
this.userNamesDefalutVal = userNamesDefalutVal;
|
||||
}
|
||||
|
||||
public String getCallback() {
|
||||
if(oConvertUtils.isEmpty(callback)){
|
||||
callback = "callbackUserSelect";
|
||||
}
|
||||
return callback;
|
||||
}
|
||||
public void setCallback(String callback) {
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
public int doStartTag() throws JspTagException {
|
||||
return EVAL_PAGE;
|
||||
}
|
||||
|
||||
|
||||
public int doEndTag() throws JspTagException {
|
||||
JspWriter out = null;
|
||||
try {
|
||||
|
@ -167,11 +181,14 @@ public class UserSelectTag extends TagSupport {
|
|||
|
||||
sb.append("<script type=\"text/javascript\">");
|
||||
sb.append("function openUserSelect() {");
|
||||
sb.append(" $.dialog.setting.zIndex = 9999; ");
|
||||
sb.append(" $.dialog({content: 'url:userController.do?userSelect', zIndex: 2100, title: '" + title + "', lock: true, width: '" + windowWidth + "', height: '" + windowHeight + "', opacity: 0.4, button: [");
|
||||
sb.append(" {name: '" + commonConfirm + "', callback: callbackUserSelect, focus: true},");
|
||||
|
||||
sb.append(" $.dialog({content: 'url:userController.do?userSelect', zIndex: getzIndex(), title: '" + title + "', lock: true, width: '" + windowWidth + "', height: '" + windowHeight + "', opacity: 0.4, button: [");
|
||||
|
||||
sb.append(" {name: '" + commonConfirm + "', callback: "+getCallback()+", focus: true},");
|
||||
|
||||
sb.append(" {name: '" + commonCancel + "', callback: function (){}}");
|
||||
sb.append(" ]}).zindex();");
|
||||
sb.append(" ]});");
|
||||
|
||||
sb.append("}");
|
||||
|
||||
sb.append("function callbackUserSelect() {");
|
||||
|
|
|
@ -8,6 +8,7 @@ import javax.servlet.jsp.tagext.TagSupport;
|
|||
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.core.util.oConvertUtils;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -31,7 +32,11 @@ public class WebUploaderTag extends TagSupport {
|
|||
private String buttonText;//控件按钮显示文本
|
||||
private String extensions;//允许的文件后缀,不带点,多个用逗号分割
|
||||
private String extendParams;//类似css写法 这是文件上传时候需要传递的参数
|
||||
private String dataType;//只要该属性有值,均视之为不为空
|
||||
private String nullMsg;//空的时候的提示信息,默认会根据当前控件的类型提示,文件类则提示“请选择文件”;图片类则提示“请选择图片”.
|
||||
private String readOnly="false";//保留字段
|
||||
private String bizType;//业务类型,根据该类型确定上传路径
|
||||
private boolean displayTxt=true;//是否显示上传列表[默认显示]true显示false隐藏
|
||||
//private static String imgexts="gif,jpg,jpeg,bmp,png";
|
||||
public int doStartTag() throws JspTagException {
|
||||
return EVAL_PAGE;
|
||||
|
@ -67,28 +72,29 @@ public class WebUploaderTag extends TagSupport {
|
|||
sb.append("<script type=\"text/javascript\" src=\"plug-in/webuploader/webuploader.min.js\"></script>");
|
||||
sb.append("<div id='"+name+"uploader' class='wu-example'><div id='"+name+"thelist' class='uploader-list'></div><div class='btns'><div id='"+name+"picker'>"+getButtonText()+"</div>");
|
||||
sb.append("</div></div>");
|
||||
if("image".equals(type)&&(null==showImgDiv||"".equals(showImgDiv.trim()))){
|
||||
if("image".equals(type)&&oConvertUtils.isEmpty(showImgDiv)){
|
||||
showImgDiv="tempdiv_"+name;
|
||||
sb.append("<div id='"+showImgDiv+"'></div>");
|
||||
}
|
||||
//不要在sb中拼写<%=basePath%>,传到前台直接乱码
|
||||
sb.append("<script type=\"text/javascript\">Array.prototype.removeItem = function(val){var index = this.indexOf(val);if (index > -1) {this.splice(index, 1);}};"
|
||||
+ "var exsitPathArr_"+name+" =new Array();"
|
||||
+"$(function() { var state = 'pending';var $list=$('#"+ name +"thelist');"
|
||||
+"var uploader = WebUploader.create({"
|
||||
+"swf: '<%=basePath%>/plug-in/webuploader/Uploader.swf',"
|
||||
+"swf: 'plug-in/webuploader/Uploader.swf',"
|
||||
+"server :\'"+url+"\',"//getUrl()
|
||||
+" pick: '#"+ name +"picker',duplicate: "+duplicate+",resize: false,"
|
||||
+"auto:"+auto+","
|
||||
+"fileVal:'"+fileVal+"',"
|
||||
+"fileNumLimit:"+fileNumLimit+","
|
||||
+"fileSingleSizeLimit:"+fileSingleSizeLimit);
|
||||
if(null!=extensions&&!"".equals(extensions)){
|
||||
if(oConvertUtils.isNotEmpty(extensions)){
|
||||
sb.append(",accept:{extensions:'"+extensions+"'}");
|
||||
}
|
||||
if(null==extendParams||"".equals(extendParams)){
|
||||
sb.append(",formData:{isup:'1'}});");
|
||||
if(oConvertUtils.isEmpty(extendParams)){
|
||||
sb.append(",formData:{isup:'1',bizType:'"+bizType+"'}});");
|
||||
}else{
|
||||
sb.append(",formData:{isup:'1',"+extendParams+"}});");
|
||||
sb.append(",formData:{isup:'1',bizType:'"+bizType+"',"+extendParams+"}});");
|
||||
}
|
||||
if(!auto){
|
||||
sb.append("\r\nvar upbtnrdo4=\"<div id='"+name+"ctlBtn' class='upbtn btn-blue "+btnCss+"'>开始上传</div>\";$('#"+name+"picker').find('div:eq(0)').after(upbtnrdo4);upbtnrdo4='';\r\n");
|
||||
|
@ -120,7 +126,11 @@ public class WebUploaderTag extends TagSupport {
|
|||
sb.append("img+=xpath==0?' style=\"display:none;\"' :' ';");
|
||||
sb.append("img+=' class=\"titledown\">'+xpath+'</span></div></li>';$('#"+showImgDiv+"').find('ul').append(img);}}\r\n");
|
||||
//添加table文字显示上传文件
|
||||
sb.append("var addtrFile=function(id,name,text,downsrc,delflag){var trhtml='<tr class=\"item\" id=\"'+id+'\"><td>'+name+'</td><td class=\"state\">'+text+'</td><td class=\"icontd\"><span';");
|
||||
String tipTableStyle="";
|
||||
if(!displayTxt){
|
||||
tipTableStyle=" style=\"display:none\" ";
|
||||
}
|
||||
sb.append("var addtrFile=function(id,name,text,downsrc,delflag){var trhtml='<tr "+tipTableStyle+" class=\"item\" id=\"'+id+'\"><td>'+name+'</td><td class=\"state\">'+text+'</td><td class=\"icontd\"><span';");
|
||||
sb.append("trhtml+=downsrc==0?' style=\"display:none;\"' :' ';");
|
||||
sb.append("trhtml+=' class=\"down icon-down\">'+downsrc+'</span></td><td class=\"icontd\"><span';");
|
||||
if("true".equals(readOnly)||"readOnly".equals(readOnly)){
|
||||
|
@ -129,17 +139,22 @@ public class WebUploaderTag extends TagSupport {
|
|||
sb.append("trhtml+=' class=\"del icon-cha\">'+delflag+'</span></td><td></td></tr>';$list.children('table').append(trhtml);}");
|
||||
//获取文件名
|
||||
sb.append("\r\nvar mygetFileName=function(filepath){if(filepath.lastIndexOf('\\\\')>0){return filepath.substring(filepath.lastIndexOf('\\\\')+1);\r\n}else if(filepath.lastIndexOf('/')>0){return filepath.substring(filepath.lastIndexOf('/')+1);}else{return filepath;}}");
|
||||
//如果dataType有值
|
||||
if(oConvertUtils.isNotEmpty(dataType)){
|
||||
sb.append("\r\n$('#"+name+"uploader').find('div.btns').append('<input nullMsg=\""+getNullMsg()+"\" dataType=\"*\" type=\"hidden\" id= \""+name+"dataTypeInp\" />');");
|
||||
}
|
||||
sb.append("\r\nvar reset_"+name+"_dataTypeInpVal=function(addOrdel){var obj = $(\"#" + name + "dataTypeInp\");if(obj.length>0){var objval=obj.val()||'';\r\nif (addOrdel == 1) {if(objval==''){obj.val('1');}else{obj.val(objval.toString()+(parseInt(objval.length)+1));}}else{if(objval.length <=1){obj.val('');}else{obj.val(objval.substr(0,objval.length-1));\r\n}\r\n}obj.blur();}}");
|
||||
//设置默认值
|
||||
if(null!=pathValues&&!"".equals(pathValues)){
|
||||
if(oConvertUtils.isNotEmpty(pathValues)){
|
||||
sb.append("\r\n$list.append( '<div class=\"fordel\"><input type=\"hidden\" name=\""+name+"\" value=\""+pathValues.replace("\\","\\\\")+"\" /></div>' );\r\n");
|
||||
if("image".equals(type)){
|
||||
sb.append("var pvs='"+pathValues.replace("\\","\\\\")+"';exsitPathArr_"+name+"=pvs.split(',');for(var a = 0; a< exsitPathArr_"+name+".length; a++){\r\nvar singlePath=exsitPathArr_"+name+"[a];\r\nif(''!=singlePath){var singleSrc=\""+showAndDownUrl+"\"+singlePath;"+name+"addImgli(singleSrc,'name'+a,singlePath,1);}}");
|
||||
sb.append("var pvs='"+pathValues.replace("\\","\\\\")+"';exsitPathArr_"+name+"=pvs.split(',');for(var a = 0; a< exsitPathArr_"+name+".length; a++){\r\nvar singlePath=exsitPathArr_"+name+"[a];\r\nif(''!=singlePath){reset_"+name+"_dataTypeInpVal(1);var singleSrc=\""+showAndDownUrl+"\"+singlePath;"+name+"addImgli(singleSrc,'name'+a,singlePath,1);}}");
|
||||
}else{
|
||||
sb.append("var pvs='"+pathValues.replace("\\","\\\\")+"';exsitPathArr_"+name+"=pvs.split(',');for(var a = 0; a< exsitPathArr_"+name+".length; a++){\r\nvar singlePath=exsitPathArr_"+name+"[a];\r\nif(''!=singlePath){var rf6=randomFor(6);addtrFile('id'+a+rf6,mygetFileName(singlePath),'--历史上传文件--',singlePath,singlePath);}}");
|
||||
sb.append("var pvs='"+pathValues.replace("\\","\\\\")+"';exsitPathArr_"+name+"=pvs.split(',');for(var a = 0; a< exsitPathArr_"+name+".length; a++){\r\nvar singlePath=exsitPathArr_"+name+"[a];\r\nif(''!=singlePath){reset_"+name+"_dataTypeInpVal(1);var rf6=randomFor(6);addtrFile('id'+a+rf6,mygetFileName(singlePath),'--历史上传文件--',singlePath,singlePath);}}");
|
||||
}
|
||||
}
|
||||
//删除请求
|
||||
sb.append("\r\nvar imgDelReq=function(delpath,spanobj){$.post('"+url+"',{path:delpath,isdel:\"1\"},function(aj){var data=JSON.parse(aj);if(data.success){exsitPathArr_"+name+".removeItem(delpath);$list.children('.fordel').children('input').val(exsitPathArr_"+name+".join(','));var myimgli=$(spanobj).closest('li');myimgli.off().find('.hidetitle').off().end().remove();}});}\r\n");
|
||||
sb.append("\r\nvar imgDelReq=function(delpath,spanobj){$.post('"+url+"',{path:delpath,isdel:\"1\"},function(aj){var data=JSON.parse(aj);if(data.success){reset_"+name+"_dataTypeInpVal(0);exsitPathArr_"+name+".removeItem(delpath);$list.children('.fordel').children('input').val(exsitPathArr_"+name+".join(','));var myimgli=$(spanobj).closest('li');myimgli.off().find('.hidetitle').off().end().remove();}});}\r\n");
|
||||
sb.append("var "+name+"addFile=function(file,filepath){\r\nuploader.makeThumb(file, function(error,src) {\r\nif(error){return false;}\r\nif(isSupportBase64()){if(filepath==''){"+name+"addImgli(src,file.id,0,0);}\r\n}else if(filepath!=''){\r\nvar actSrc=\""+showAndDownUrl+"\"+filepath;\r\n"+name+"addImgli(actSrc,file.id,0,0);}}, thumbnailWidth, thumbnailHeight );}");
|
||||
sb.append("\r\nvar updatetdState=function(id,content){$list.children('table').find('#"+name+"'+id).find('.state').text('--'+content+'--');}\r\n");
|
||||
//当文件被加入队列以后触发。
|
||||
|
@ -149,7 +164,7 @@ public class WebUploaderTag extends TagSupport {
|
|||
//上传过程中触发,携带上传进度。
|
||||
sb.append(" uploader.on( 'uploadProgress', function( file, percentage ) {var $li = $('#"+name+"'+file.id+' td:last'),$percent = $li.find('.progress .progress-bar');if ( !$percent.length ) {$percent = $('<div class=\"progress progress-striped active\"><div class=\"progress-bar\" role=\"progressbar\" style=\"width: 0%\"></div></div>').appendTo($li).find('.progress-bar');}updatetdState(file.id,'上传中');$percent.css( 'width', percentage * 100 + '%' );});");
|
||||
//当文件上传成功时触发,会给表单增加一个input赋值 filePath
|
||||
sb.append("uploader.on( 'uploadSuccess', function(file,response) {if(response.success){updatetdState(file.id,'上传成功');"
|
||||
sb.append("uploader.on( 'uploadSuccess', function(file,response) {if(response.success){updatetdState(file.id,'上传成功');reset_"+name+"_dataTypeInpVal(1);"
|
||||
+"var filepath=response['"+name+"']||response.obj;$('#"+name+"'+file.id+' td:first').append('<input type=\"hidden\" name=\""+name+"\" value=\"'+filepath+'\" />');"+name+"addFile(file, filepath);}else{updatetdState(file.id,'上传出错'+response.msg);}});\r\n");
|
||||
//上传失败
|
||||
sb.append("uploader.on( 'uploadError', function( file,reason ) {updatetdState(file.id,'上传出错-code:'+reason);});");
|
||||
|
@ -175,7 +190,7 @@ public class WebUploaderTag extends TagSupport {
|
|||
//删除
|
||||
sb.append("$list.on(\"click\", \".del\", function () {var delspantext=$(this).text();var itemObj=$(this).closest(\".item\");var id=itemObj.attr(\"id\").substring("+name.length()+");var delpath=itemObj.find(\"input[name='"+name+"']\").val();if(undefined==delpath||null==delpath){delpath=delspantext;if(delspantext==0){itemObj.remove();uploader.removeFile(id);var myimgli=$('#"+showImgDiv+"').find(\"img[name='\"+id+\"img']\").closest('li');myimgli.off().find('.hidetitle').off().end().remove();\r\nreturn false;}}");
|
||||
//sb.append("$list.on(\"click\", \".del\", function () {var delspantext=$(this).text();var itemObj=$(this).closest(\".item\");var id=itemObj.attr(\"id\").substring("+name.length()+");var delpath=itemObj.find(\"input[name='"+name+"']\").val();if((undefined==delpath||null==delpath) && delspantext==1){itemObj.remove();var fordelInput=$list.children('.fordel').children('input');if($(this).text()==0){uploader.removeFile(id);var myimgli=$('#"+showImgDiv+"').find(\"img[name='\"+id+\"img']\").closest('li');myimgli.off().find('.hidetitle').off().end().remove();}\r\nif(fordelInput.length>0){fordelInput.val(exsitPathArr_"+name+".join(','));}return false;}");
|
||||
sb.append("$.post('"+url+"',{path:delpath,isdel:\"1\"},function(aj){var data=JSON.parse(aj);if(data.success){var fordelInput = $list.children('.fordel').children('input');itemObj.remove();if(delspantext==0){uploader.removeFile(id);var myimgli=$('#"+showImgDiv+"').find(\"img[name='\"+id+\"img']\").closest('li');\r\nmyimgli.off().find('.hidetitle').off().end().remove();}else if(fordelInput.length > 0) {exsitPathArr_"+name+".removeItem(delpath);fordelInput.val(exsitPathArr_"+name+".join(','));\r\n}\r\n}\r\n});\r\n});");
|
||||
sb.append("$.post('"+url+"',{path:delpath,isdel:\"1\"},function(aj){var data=JSON.parse(aj);if(data.success){reset_"+name+"_dataTypeInpVal(0);var fordelInput = $list.children('.fordel').children('input');itemObj.remove();if(delspantext==0){uploader.removeFile(id);var myimgli=$('#"+showImgDiv+"').find(\"img[name='\"+id+\"img']\").closest('li');\r\nmyimgli.off().find('.hidetitle').off().end().remove();}else if(fordelInput.length > 0) {exsitPathArr_"+name+".removeItem(delpath);fordelInput.val(exsitPathArr_"+name+".join(','));\r\n}\r\n}\r\n});\r\n});");
|
||||
sb.append("if(location.href.indexOf('load=detail')!=-1){$('#"+name+"uploader').find('.btns').css('display','none');");
|
||||
if("image".equals(type)){
|
||||
sb.append("$('#"+showImgDiv+"').find('.titledel').css('display','none');");
|
||||
|
@ -201,7 +216,7 @@ public class WebUploaderTag extends TagSupport {
|
|||
this.auto = auto;
|
||||
}
|
||||
public String getButtonStyle() {
|
||||
if(null==buttonStyle||"".equals(buttonStyle)){
|
||||
if(oConvertUtils.isEmpty(buttonStyle)){
|
||||
buttonStyle="btn-green btn-S";
|
||||
}
|
||||
return buttonStyle;
|
||||
|
@ -259,6 +274,11 @@ public class WebUploaderTag extends TagSupport {
|
|||
return extendParams;
|
||||
}
|
||||
public void setExtendParams(String extendParams) {
|
||||
|
||||
if(StringUtil.isNotEmpty(extendParams) && !extendParams.endsWith(",")){
|
||||
extendParams = extendParams + ",";
|
||||
}
|
||||
|
||||
this.extendParams = extendParams;
|
||||
}
|
||||
public String getPathValues() {
|
||||
|
@ -287,7 +307,7 @@ public class WebUploaderTag extends TagSupport {
|
|||
this.type = type;
|
||||
}
|
||||
public String getButtonText() {
|
||||
if(null==buttonText||"".equals(buttonText)){
|
||||
if(oConvertUtils.isEmpty(buttonText)){
|
||||
buttonText="选择文件";
|
||||
}
|
||||
return buttonText;
|
||||
|
@ -301,7 +321,33 @@ public class WebUploaderTag extends TagSupport {
|
|||
public void setExtensions(String extensions) {
|
||||
this.extensions = extensions;
|
||||
}
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
public String getNullMsg() {
|
||||
if(oConvertUtils.isEmpty(nullMsg)){
|
||||
this.nullMsg="请选择"+("file".equals(type)?"文件!":"图片!");
|
||||
}
|
||||
return nullMsg;
|
||||
}
|
||||
public void setNullMsg(String nullMsg) {
|
||||
this.nullMsg = nullMsg;
|
||||
}
|
||||
public String getBizType() {
|
||||
return bizType;
|
||||
}
|
||||
public void setBizType(String bizType) {
|
||||
this.bizType = bizType;
|
||||
}
|
||||
public boolean isDisplayTxt() {
|
||||
return displayTxt;
|
||||
}
|
||||
public void setDisplayTxt(boolean displayTxt) {
|
||||
this.displayTxt = displayTxt;
|
||||
}
|
||||
//根据上传文件的后缀重置type
|
||||
/*private void typeResetByext(String ext){
|
||||
if(null!=ext&&!"".equals(ext)){
|
||||
|
|
|
@ -33,4 +33,10 @@ public class ColumnValue {
|
|||
this.value = value;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return new StringBuffer().append("ColumnValue [name=").append(name)
|
||||
.append(",text=").append(text)
|
||||
.append(",value=").append(value)
|
||||
.append("]").toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,26 @@ public class DataGridColumn {
|
|||
|
||||
private String defaultVal = "";//列默认值
|
||||
|
||||
protected String showMode;//表单元素,查询表单中显示样式,默认样式select
|
||||
|
||||
protected boolean newColumn;
|
||||
|
||||
public boolean isNewColumn() {
|
||||
return newColumn;
|
||||
}
|
||||
|
||||
public void setNewColumn(boolean newColumn) {
|
||||
this.newColumn = newColumn;
|
||||
}
|
||||
|
||||
public String getShowMode() {
|
||||
return showMode;
|
||||
}
|
||||
|
||||
public void setShowMode(String showMode) {
|
||||
this.showMode = showMode;
|
||||
}
|
||||
|
||||
public String getEditor() {
|
||||
return editor;
|
||||
}
|
||||
|
@ -298,6 +317,15 @@ public class DataGridColumn {
|
|||
this.defaultVal = defaultVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DataGridColumn [title=" + title + ", field=" + field + ", width=" + width + ", showLen=" + showLen + ", rowspan=" + rowspan + ", colspan=" + colspan +
|
||||
", align=" + align + ", sortable=" + sortable + ", checkbox=" + checkbox + ", formatter=" + formatter + ", formatterjs=" + formatterjs + ", hidden=" + hidden +
|
||||
", treefield=" + treefield + ", image=" + image + ", query=" + query + ", queryMode=" + queryMode + ", autoLoadData=" + autoLoadData + ", frozenColumn=" + frozenColumn +
|
||||
", url=" + url + ", funname=" + funname + ", arg=" + arg + ", dictionary=" + dictionary + ", popup=" + popup + ", replace=" + replace + ", extend=" + extend +
|
||||
", style=" + style + ", imageSize=" + imageSize + ", downloadName=" + downloadName + ", autocomplete=" + autocomplete + ", extendParams="
|
||||
+ extendParams + ", editor=" + editor + ", defaultVal=" + defaultVal + ", showMode=" + showMode + ", newColumn=" + newColumn + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@ public class DataGridUrl {
|
|||
private String urlclass;//按钮样式
|
||||
private String urlfont;//按钮图标
|
||||
|
||||
private String id;
|
||||
|
||||
private String operationCode;//按钮的操作Code
|
||||
public String getOnclick() {
|
||||
return onclick;
|
||||
}
|
||||
|
@ -74,6 +77,14 @@ public class DataGridUrl {
|
|||
return type;
|
||||
}
|
||||
|
||||
public String getOperationCode() {
|
||||
return operationCode;
|
||||
}
|
||||
|
||||
public void setOperationCode(String operationCode) {
|
||||
this.operationCode = operationCode;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
@ -129,18 +140,34 @@ public class DataGridUrl {
|
|||
return urlStyle;
|
||||
}
|
||||
|
||||
public String getUrlclass() {
|
||||
return urlclass;
|
||||
}
|
||||
public void setUrlclass(String urlclass) {
|
||||
this.urlclass = urlclass;
|
||||
}
|
||||
public String getUrlfont() {
|
||||
return urlfont;
|
||||
}
|
||||
public void setUrlfont(String urlfont) {
|
||||
this.urlfont = urlfont;
|
||||
}
|
||||
public String getUrlclass() {
|
||||
return urlclass;
|
||||
}
|
||||
public void setUrlclass(String urlclass) {
|
||||
this.urlclass = urlclass;
|
||||
}
|
||||
public String getUrlfont() {
|
||||
return urlfont;
|
||||
}
|
||||
public void setUrlfont(String urlfont) {
|
||||
this.urlfont = urlfont;
|
||||
}
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DataGridUrl [url=" + url + ", title=" + title + ", icon=" + icon + ", value=" + value + ", width=" + width + ", height=" + height +
|
||||
", type=" + type + ", isbtn=" + isbtn + ", message=" + message + ", exp=" + exp + ", funname=" + funname + ", isRadio=" + isRadio +
|
||||
", onclick=" + onclick + ", urlStyle=" + urlStyle + ", urlclass=" + urlclass + ", urlfont=" + urlfont
|
||||
+ ", id=" + id + ", operationCode=" + operationCode + "]";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
|
|||
import org.jeecgframework.core.common.model.json.AjaxJson;
|
||||
import org.jeecgframework.core.common.model.json.DataGrid;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.util.IpUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.p3.core.util.plugin.ViewVelocity;
|
||||
import org.jeecgframework.tag.core.easyui.TagUtil;
|
||||
|
@ -110,6 +111,7 @@ public class CgDynamGraphConfigHeadController extends BaseController {
|
|||
try{
|
||||
cgDynamGraphConfigHeadService.delMain(cgDynamGraphConfigHead);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online移动图表删除]["+cgDynamGraphConfigHead.getCode()+"]"+message);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "动态报表配置抬头删除失败";
|
||||
|
@ -135,6 +137,7 @@ public class CgDynamGraphConfigHeadController extends BaseController {
|
|||
CgDynamGraphConfigHeadEntity cgDynamGraphConfigHead = systemService.getEntity(CgDynamGraphConfigHeadEntity.class, id);
|
||||
cgDynamGraphConfigHeadService.delMain(cgDynamGraphConfigHead);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online移动图表批量删除]["+cgDynamGraphConfigHead.getCode()+"]"+message);
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
|
@ -162,6 +165,7 @@ public class CgDynamGraphConfigHeadController extends BaseController {
|
|||
try{
|
||||
cgDynamGraphConfigHeadService.addMain(cgDynamGraphConfigHead, cgDynamGraphConfigItemList,cgDynamGraphConfigParamList);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online移动图表录入]["+cgDynamGraphConfigHead.getCode()+"]"+message);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "动态报表配置抬头添加失败";
|
||||
|
@ -187,6 +191,7 @@ public class CgDynamGraphConfigHeadController extends BaseController {
|
|||
try{
|
||||
cgDynamGraphConfigHeadService.updateMain(cgDynamGraphConfigHead, cgDynamGraphConfigItemList, cgDynamGraphConfigParamList);
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online移动图表更新]["+cgDynamGraphConfigHead.getCode()+"]"+message);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "更新动态报表配置抬头失败";
|
||||
|
|
|
@ -13,7 +13,28 @@
|
|||
<link rel="stylesheet" type="text/css" href="plug-in/accordion/css/icons.css">
|
||||
<link rel="stylesheet" href="plug-in/jquery-ui/css/ui-lightness/jquery-ui-1.9.2.custom.min.css">
|
||||
<link rel="stylesheet" href="plug-in/ichart/css/gallery.css">
|
||||
|
||||
<!-- //update--begin--author:yugwu date:20170618 for:[TASK #2138] 【ie8兼容】移动报表,功能测试乱码 -->
|
||||
<!--[if gte IE 6]>
|
||||
<!--[if lte IE 8]>
|
||||
<script type="text/javascript" src="plug-in/html5ie/js/html5.js"></script>
|
||||
<script type="text/javascript" src="plug-in/html5ie/js/excanvas.compiled.js"></script>
|
||||
<style type="text/css">
|
||||
#canvasDiv{
|
||||
behavior: url(/plug-in/html5ie/css/ie-css3.htc);
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
document.createElement("section");
|
||||
document.createElement("article");
|
||||
document.createElement("footer");
|
||||
document.createElement("header");
|
||||
document.createElement("hgroup");
|
||||
document.createElement("nav");
|
||||
document.createElement("menu");
|
||||
</script>
|
||||
<![endif]-->
|
||||
<![endif]-->
|
||||
<!-- //update--end--author:yugwu date:20170618 for:[TASK #2138] 【ie8兼容】移动报表,功能测试乱码 -->
|
||||
<script type="text/javascript" src="plug-in/jquery/jquery-1.8.3.js"></script>
|
||||
<script type="text/javascript" src="plug-in/easyui/jquery.easyui.min.1.3.2.js"></script>
|
||||
<script type="text/javascript" src="plug-in/easyui/locale/zh-cn.js"></script>
|
||||
|
|
|
@ -46,6 +46,8 @@ public class CgAutoListConstant {
|
|||
public static final String FIELD_TITLE = "field_title";
|
||||
/** 字段是否显示 */
|
||||
public static final String FIELD_ISSHOW = "field_isShow";
|
||||
/** 字段是否允许为空 */
|
||||
public static final String FIELD_IS_NULL = "field_isNull";
|
||||
/** 字段是否查询 */
|
||||
public static final String FIELD_ISQUERY = "field_isQuery";
|
||||
/** 字段查询模式 */
|
||||
|
|
|
@ -284,8 +284,8 @@ public class FormHtmlUtil {
|
|||
private static String getFileFormHtml(CgFormFieldEntity cgFormFieldEntity){
|
||||
StringBuilder html = new StringBuilder("");
|
||||
|
||||
html.append("<link rel=\"stylesheet\" href=\"plug-in/uploadify/css/uploadify.css\" type=\"text/css\"></link>");
|
||||
html.append("<script type=\"text/javascript\" src=\"plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");
|
||||
// html.append("<link rel=\"stylesheet\" href=\"plug-in/uploadify/css/uploadify.css\" type=\"text/css\"></link>");
|
||||
// html.append("<script type=\"text/javascript\" src=\"plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");
|
||||
|
||||
html.append("<table>");
|
||||
html.append("<#list filesList as fileB>");
|
||||
|
@ -305,8 +305,8 @@ public class FormHtmlUtil {
|
|||
|
||||
//html.append("fileTypeExts:'*.rar;*.zip;*.doc;*.docx;*.txt;*.ppt;*.xls;*.xlsx;*.html;*.htm;*.pdf;*.jpg;*.gif;*.png',");
|
||||
|
||||
html.append("fileSizeLimit:'15MB',swf:'plug-in/uploadify/uploadify.swf',");
|
||||
html.append("uploader:'cgUploadController.do?saveFiles&jsessionid='+\\$(\"#sessionUID\").val()+'',");
|
||||
html.append("fileSizeLimit:'15MB',swf:'\\${basePath}/plug-in/uploadify/uploadify.swf',");
|
||||
html.append("uploader:'\\${basePath}/cgUploadController.do?saveFiles&jsessionid='+\\$(\"#sessionUID\").val()+'',");
|
||||
html.append("onUploadStart : function(file) { ");
|
||||
html.append("var cgFormId=\\$(\"input[name='id']\").val();");
|
||||
html.append("\\$('#").append(cgFormFieldEntity.getFieldName()).append("').uploadify(\"settings\", \"formData\", {'cgFormId':cgFormId,'cgFormName':'").append(cgFormFieldEntity.getTable().getTableName()).append("','cgFormField':'").append(cgFormFieldEntity.getFieldName()).append("'});} ,");
|
||||
|
@ -317,13 +317,13 @@ public class FormHtmlUtil {
|
|||
html.append("</div><div class=\"form\" id=\"filediv_").append(cgFormFieldEntity.getFieldName()).append("\"> </div>");
|
||||
|
||||
html.append("<script type=\"text/javascript\">");
|
||||
html.append("function uploadFile(data){");
|
||||
html.append("if(!\\$(\"input[name='id']\").val()){");
|
||||
html.append("if(data.obj != null && data.obj != 'undefined'){\\$(\"input[name='id']\").val(data.obj.id);}}");
|
||||
html.append("if(\\$(\".uploadify-queue-item\").length > 0){upload();}else{if (neibuClickFlag){alert(data.msg); neibuClickFlag = false;}else {var win = frameElement.api.opener; win.reloadTable(); win.tip(data.msg); frameElement.api.close();}}}");
|
||||
// html.append("function uploadFile(data){");
|
||||
// html.append("if(!\\$(\"input[name='id']\").val()){");
|
||||
// html.append("if(data.obj != null && data.obj != 'undefined'){\\$(\"input[name='id']\").val(data.obj.id);}}");
|
||||
// html.append("if(\\$(\".uploadify-queue-item\").length > 0){upload();}else{if (neibuClickFlag){alert(data.msg); neibuClickFlag = false;}else {var win = frameElement.api.opener; win.reloadTable(); win.tip(data.msg); frameElement.api.close();}}}");
|
||||
html.append("function upload() {\\$('#").append(cgFormFieldEntity.getFieldName()).append("').uploadify('upload', '\\*');}");
|
||||
html.append("function cancel() {\\$('#").append(cgFormFieldEntity.getFieldName()).append("').uploadify('cancel', '\\*');}");
|
||||
html.append("var neibuClickFlag = false;function neibuClick() {neibuClickFlag = true;\\$('#btn_sub').trigger('click');}");
|
||||
// html.append("var neibuClickFlag = false;function neibuClick() {neibuClickFlag = true;\\$('#btn_sub').trigger('click');}");
|
||||
html.append("</script>");
|
||||
|
||||
return html.toString();
|
||||
|
|
|
@ -270,42 +270,39 @@ public class OfficeHtmlUtil {
|
|||
pattern = Pattern.compile(regEx_attr8,Pattern.CASE_INSENSITIVE);
|
||||
matcher = pattern.matcher(htmlStr);
|
||||
htmlStr = matcher.replaceAll("");
|
||||
|
||||
|
||||
//include
|
||||
StringBuilder ls_include = new StringBuilder("");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/jquery/jquery-1.8.3.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/tools/dataformat.js\"></script>");
|
||||
ls_include.append("<link id=\"easyuiTheme\" rel=\"stylesheet\" href=\"plug-in/easyui/themes/default/easyui.css\" type=\"text/css\"></link>");
|
||||
ls_include.append("<link rel=\"stylesheet\" href=\"plug-in/easyui/themes/icon.css\" type=\"text/css\"></link>");
|
||||
ls_include.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"plug-in/accordion/css/accordion.css\"></link>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/easyui/jquery.easyui.min.1.3.2.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/easyui/locale/zh-cn.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/tools/syUtil.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/My97DatePicker/WdatePicker.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/lhgDialog/lhgdialog.min.js\"></script>");
|
||||
|
||||
ls_include.append("<script type=\"text/javascript\">$(function(){$(\"#formobj\").Validform({tiptype:4,");
|
||||
ls_include.append("btnSubmit:\"#btn_sub\",btnReset:\"#btn_reset\",ajaxPost:true,usePlugin:{passwordstrength:");
|
||||
ls_include.append("{minLen:6,maxLen:18,trigger:function(obj,error){if(error){obj.parent().next().");
|
||||
ls_include.append("find(\".Validform_checktip\").show();obj.find(\".passwordStrength\").hide();}");
|
||||
ls_include.append("else{$(\".passwordStrength\").show();obj.parent().next().find(\".Validform_checktip\")");
|
||||
ls_include.append(".hide();}}}},callback:function(data){if(data.success");
|
||||
ls_include.append("==true){if(!neibuClickFlag){var win = frameElement.api.opener;frameElement.api.close();win.tip(data.msg);win.reloadTable();}else {alert(data.msg)}}else{if(data.responseText==''||");
|
||||
ls_include.append("data.responseText==undefined)$(\"#formobj\").html(data.msg);else $(\"#formobj\")");
|
||||
ls_include.append(".html(data.responseText); return false;}if(!neibuClickFlag){var win = frameElement.api.opener;win.reloadTable();}}});});</script>");
|
||||
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/layer/layer.js\"></script>");
|
||||
ls_include.append("<base href=\"${basePath}/\" />");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/jquery/jquery-1.8.3.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/tools/dataformat.js\"></script>");
|
||||
ls_include.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"${basePath}/plug-in/accordion/css/accordion.css\"></link>");
|
||||
ls_include.append("<link id=\"easyuiTheme\" rel=\"stylesheet\" href=\"${basePath}/plug-in/easyui/themes/default/easyui.css\" type=\"text/css\"></link>");
|
||||
ls_include.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/easyui/themes/icon.css\" type=\"text/css\"></link>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/easyui/jquery.easyui.min.1.3.2.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/easyui/locale/zh-cn.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/tools/syUtil.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/My97DatePicker/WdatePicker.js\"></script>");
|
||||
ls_include.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/tools/css/metrole/common.css\" type=\"text/css\"></link>");
|
||||
ls_include.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/ace/css/font-awesome.css\" type=\"text/css\"></link>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/lhgDialog/lhgdialog.min.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/layer/layer.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/tools/curdtools_zh-cn.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/tools/easyuiextend.js\"></script>");
|
||||
ls_include.append("<link id=\"easyuiTheme\" rel=\"stylesheet\" href=\"${basePath}/plug-in/easyui/themes/metrole/main.css\" type=\"text/css\"></link>");
|
||||
ls_include.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/uploadify/css/uploadify.css\" type=\"text/css\"></link>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/tools/Map.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/Validform/js/Validform_Datatype_zh-cn.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/Validform/js/datatype_zh-cn.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/Validform/plugin/passwordStrength/passwordStrength-min.js\"></script>");
|
||||
ls_include.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/Validform/css/metrole/style.css\" type=\"text/css\"/>");
|
||||
ls_include.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/Validform/css/metrole/tablefrom.css\" type=\"text/css\"/>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/ueditor/ueditor.config.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/ueditor/ueditor.all.js\"></script>");
|
||||
|
||||
ls_include.append(StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/tools/curdtools_{0}.js\"></script>", "{0}", lang));
|
||||
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/tools/easyuiextend.js\"></script>");
|
||||
ls_include.append("<link rel=\"stylesheet\" href=\"plug-in/Validform/css/style.css\" type=\"text/css\"/>");
|
||||
ls_include.append("<link rel=\"stylesheet\" href=\"plug-in/Validform/css/tablefrom.css\" type=\"text/css\"/>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/Validform/js/Validform_Datatype_zh-cn.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/Validform/js/datatype_zh-cn.js\"></script>");
|
||||
ls_include.append("<script type=\"text/javascript\" src=\"plug-in/Validform/plugin/passwordStrength/passwordStrength-min.js\"></script>");
|
||||
//ls_include.append("<script type=\"text/javascript\">$(function(){$(\"#formobj\").Validform({tiptype:4,btnSubmit:\"#btn_sub\",btnReset:\"#btn_reset\",ajaxPost:true,usePlugin:{passwordstrength:{minLen:6,maxLen:18,trigger:function(obj,error){if(error){obj.parent().next().find(\".Validform_checktip\").show();obj.find(\".passwordStrength\").hide();}else{$(\".passwordStrength\").show();obj.parent().next().find(\".Validform_checktip\").hide();}}}},callback:function(data){var win = frameElement.api.opener;if(data.success==true){frameElement.api.close();win.tip(data.msg);}else{if(data.responseText==''||data.responseText==undefined)$(\"#formobj\").html(data.msg);else $(\"#formobj\").html(data.responseText); return false;}win.reloadTable();}});});</script>");
|
||||
ls_include.append("<style>");
|
||||
ls_include.append("body{font-size:12px;}");
|
||||
ls_include.append("table{border: 1px solid #000000;padding:0; margin:0 auto;border-collapse: collapse;width:100%;align:right;}");
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- update begin online代码生成器支持 自定义word改造 -->
|
||||
<!-- FreeMarker 自定义word代码生成器 -->
|
||||
<bean id="freemarkerWord" class="freemarker.template.Configuration">
|
||||
<property name="templateLoader" ref="templetLoaderWord" />
|
||||
|
@ -38,6 +40,7 @@
|
|||
</map>
|
||||
</property>
|
||||
</bean>
|
||||
<!-- update end online代码生成器支持 自定义word改造 -->
|
||||
|
||||
<!-- 拦截器 -->
|
||||
<mvc:interceptors>
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.jeecgframework.core.constant.Globals;
|
|||
import org.jeecgframework.core.enums.SysThemesEnum;
|
||||
import org.jeecgframework.core.online.util.FreemarkerHelper;
|
||||
import org.jeecgframework.core.util.ContextHolderUtils;
|
||||
import org.jeecgframework.core.util.IpUtil;
|
||||
import org.jeecgframework.core.util.JeecgDataAutorUtils;
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
|
@ -99,7 +100,10 @@ public class CgAutoListController extends BaseController{
|
|||
paras.put("_olstylecode",template);
|
||||
}
|
||||
paras.put("this_olstylecode",template);
|
||||
CgformTemplateEntity entity=cgformTemplateService.findByCode(template);
|
||||
|
||||
paras.put("brower_type", ContextHolderUtils.getSession().getAttribute("brower_type"));
|
||||
|
||||
CgformTemplateEntity entity=cgformTemplateService.findByCode(template);
|
||||
String html = viewEngine.parseTemplate(TemplateUtil.getTempletPath(entity,0, TemplateUtil.TemplateType.LIST), paras);
|
||||
|
||||
PrintWriter writer = null;
|
||||
|
@ -209,7 +213,15 @@ public class CgAutoListController extends BaseController{
|
|||
if(dicList.size() > 0){
|
||||
for(Map<String, Object> resultMap:result){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
String value = (String)resultMap.get(b.getFieldName());
|
||||
|
||||
Object obj = resultMap.get(b.getFieldName());
|
||||
String value = null;
|
||||
if(obj instanceof Integer){
|
||||
value = String.valueOf(obj);
|
||||
}else{
|
||||
value = (String)obj;
|
||||
}
|
||||
|
||||
if(oConvertUtils.isEmpty(value)){continue;}
|
||||
String[] arrayVal = value.split(",");
|
||||
if(arrayVal.length > 1){
|
||||
|
@ -315,6 +327,7 @@ public class CgAutoListController extends BaseController{
|
|||
|
||||
cgTableService.delete(table, id);
|
||||
String message = "删除成功";
|
||||
log.info("["+IpUtil.getIpAddr(request)+"][online表单数据删除]"+message+"表名:"+configId);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||
Globals.Log_Leavel_INFO);
|
||||
j.setMsg(message);
|
||||
|
@ -343,6 +356,7 @@ public class CgAutoListController extends BaseController{
|
|||
}
|
||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||
Globals.Log_Leavel_INFO);
|
||||
log.info("["+IpUtil.getIpAddr(request)+"][online表单数据批量删除]"+message+"表名:"+configId);
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
@ -393,6 +407,9 @@ public class CgAutoListController extends BaseController{
|
|||
fm.put(CgAutoListConstant.FIELD_QUERYMODE, bean.getQueryMode());
|
||||
fm.put(CgAutoListConstant.FIELD_SHOWTYPE, bean.getShowType());
|
||||
fm.put(CgAutoListConstant.FIELD_TYPE, bean.getType());
|
||||
|
||||
fm.put(CgAutoListConstant.FIELD_IS_NULL, bean.getIsNull());
|
||||
|
||||
fm.put(CgAutoListConstant.FIELD_LENGTH, bean.getFieldLength()==null?"120":bean.getFieldLength());
|
||||
fm.put(CgAutoListConstant.FIELD_HREF, bean.getFieldHref()==null?"":bean.getFieldHref());
|
||||
loadDic(fm,bean);
|
||||
|
@ -487,7 +504,7 @@ public class CgAutoListController extends BaseController{
|
|||
*/
|
||||
private void loadAuth(Map<String, Object> paras, HttpServletRequest request) {
|
||||
List<TSOperation> nolist = (List<TSOperation>) request.getAttribute(Globals.NOAUTO_OPERATIONCODES);
|
||||
if(ResourceUtil.getSessionUserName().getUserName().equals("admin")|| !Globals.BUTTON_AUTHORITY_CHECK){
|
||||
if(ResourceUtil.getSessionUser().getUserName().equals("admin")|| !Globals.BUTTON_AUTHORITY_CHECK){
|
||||
nolist = null;
|
||||
}
|
||||
List<String> list = new ArrayList<String>();
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.jeecgframework.core.enums.SysThemesEnum;
|
|||
import org.jeecgframework.core.online.util.FreemarkerHelper;
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.jeecgframework.core.util.ContextHolderUtils;
|
||||
import org.jeecgframework.core.util.IpUtil;
|
||||
import org.jeecgframework.core.util.LogUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.core.util.SysThemesUtil;
|
||||
|
@ -122,6 +123,26 @@ public class CgFormBuildController extends BaseController {
|
|||
String templateName=tablename+"_";
|
||||
//String templateName=tableName+"_";
|
||||
|
||||
Map<String, Object> dataForm = new HashMap<String, Object>();
|
||||
if(StringUtils.isNotEmpty(id)){
|
||||
|
||||
dataForm = dataBaseService.findOneForJdbc(tablename, id);
|
||||
//dataForm = dataBaseService.findOneForJdbc(tableName, id);
|
||||
|
||||
if(dataForm!=null){
|
||||
Iterator it=dataForm.entrySet().iterator();
|
||||
while(it.hasNext()){
|
||||
Map.Entry entry=(Map.Entry)it.next();
|
||||
String ok=(String)entry.getKey();
|
||||
Object ov=entry.getValue();
|
||||
data.put(ok, ov);
|
||||
}
|
||||
}else{
|
||||
id = null;
|
||||
dataForm = new HashMap<String, Object>();
|
||||
}
|
||||
}
|
||||
|
||||
TemplateUtil.TemplateType templateType=TemplateUtil.TemplateType.LIST;
|
||||
if(StringUtils.isBlank(id)){
|
||||
templateName+=TemplateUtil.TemplateType.ADD.getName();
|
||||
|
@ -140,20 +161,7 @@ public class CgFormBuildController extends BaseController {
|
|||
data = new HashMap(configData);
|
||||
//如果该表是主表查出关联的附表
|
||||
CgFormHeadEntity head = (CgFormHeadEntity)data.get("head");
|
||||
Map<String, Object> dataForm = new HashMap<String, Object>();
|
||||
if(StringUtils.isNotEmpty(id)){
|
||||
|
||||
dataForm = dataBaseService.findOneForJdbc(tablename, id);
|
||||
//dataForm = dataBaseService.findOneForJdbc(tableName, id);
|
||||
|
||||
}
|
||||
Iterator it=dataForm.entrySet().iterator();
|
||||
while(it.hasNext()){
|
||||
Map.Entry entry=(Map.Entry)it.next();
|
||||
String ok=(String)entry.getKey();
|
||||
Object ov=entry.getValue();
|
||||
data.put(ok, ov);
|
||||
}
|
||||
|
||||
Map<String, Object> tableData = new HashMap<String, Object>();
|
||||
//获取主表或单表表单数据
|
||||
|
||||
|
@ -186,9 +194,12 @@ public class CgFormBuildController extends BaseController {
|
|||
pushImages(data, id);
|
||||
|
||||
//增加basePath
|
||||
String basePath = request.getContextPath();
|
||||
//String basePath = request.getContextPath();
|
||||
String basePath = "http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
|
||||
data.put(CgAutoListConstant.BASEPATH, basePath);
|
||||
|
||||
|
||||
data.put("brower_type", ContextHolderUtils.getSession().getAttribute("brower_type"));
|
||||
|
||||
String content =null;
|
||||
response.setContentType("text/html;charset=utf-8");
|
||||
|
||||
|
@ -278,9 +289,13 @@ public class CgFormBuildController extends BaseController {
|
|||
private String getHtmlHead(HttpServletRequest request){
|
||||
HttpSession session = ContextHolderUtils.getSession();
|
||||
String lang = (String)session.getAttribute("lang");
|
||||
if(lang==null||lang.length()<=0){
|
||||
lang = "zh-cn";
|
||||
}
|
||||
StringBuilder sb= new StringBuilder("");
|
||||
SysThemesEnum sysThemesEnum = SysThemesUtil.getSysTheme(request);
|
||||
String basePath = request.getContextPath();
|
||||
//String basePath = request.getContextPath();
|
||||
String basePath = "http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
|
||||
sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/jquery/jquery-1.8.3.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\""+basePath+"/plug-in/tools/dataformat.js\"></script>");
|
||||
sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\""+basePath+"/plug-in/accordion/css/accordion.css\">");
|
||||
|
@ -412,10 +427,11 @@ public class CgFormBuildController extends BaseController {
|
|||
try {
|
||||
dataBaseService.insertTable(tableName, data);
|
||||
j.setSuccess(true);
|
||||
message = "业务提交成功";
|
||||
message = "保存成功";
|
||||
}catch (Exception e) {
|
||||
j.setSuccess(false);
|
||||
message = "业务提交失败";
|
||||
message = "保存失败";
|
||||
e.printStackTrace();
|
||||
}
|
||||
//--author:luobaoli---------date:20150615--------for: 处理service层抛出的异常
|
||||
} catch (Exception e) {
|
||||
|
@ -432,17 +448,17 @@ public class CgFormBuildController extends BaseController {
|
|||
int num = dataBaseService.updateTable(tableName, id, data);
|
||||
if (num>0) {
|
||||
j.setSuccess(true);
|
||||
message = "业务更新成功";
|
||||
message = "保存成功";
|
||||
}else {
|
||||
j.setSuccess(false);
|
||||
message = "业务更新失败";
|
||||
message = "保存失败";
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
j.setSuccess(false);
|
||||
message = e.getMessage();
|
||||
}
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单单表数据保存和更新]"+message+"表名:"+tableName);
|
||||
}
|
||||
}
|
||||
j.setMsg(message);
|
||||
|
@ -505,6 +521,7 @@ public class CgFormBuildController extends BaseController {
|
|||
message = e.getMessage();
|
||||
}
|
||||
}
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单一对多数据保存和更新]"+message+"表名:"+tableName);
|
||||
}
|
||||
j.setMsg(message);
|
||||
j.setObj(data);
|
||||
|
@ -544,6 +561,7 @@ public class CgFormBuildController extends BaseController {
|
|||
}
|
||||
j.setSuccess(true);
|
||||
message = "操作成功";
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单自定义按钮action触发]"+message+"表名:"+tableName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "操作失败";
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.jeecgframework.core.common.controller.BaseController;
|
|||
import org.jeecgframework.core.common.model.common.DBTable;
|
||||
import org.jeecgframework.core.common.model.common.UploadFile;
|
||||
import org.jeecgframework.core.common.model.json.AjaxJson;
|
||||
import org.jeecgframework.core.util.IpUtil;
|
||||
import org.jeecgframework.core.util.LogUtil;
|
||||
import org.jeecgframework.core.util.ReflectHelper;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
|
@ -51,7 +52,7 @@ import com.thoughtworks.xstream.XStream;
|
|||
|
||||
/**
|
||||
* @Title: Controller
|
||||
* @Description: sql导入导出
|
||||
* @Description: Online表单导入导出(采用XML方式)
|
||||
* @author duanqilu
|
||||
* @date 2013-09-04
|
||||
* @version V1.0
|
||||
|
@ -78,7 +79,7 @@ public class CgformSqlController extends BaseController {
|
|||
private NamedParameterJdbcTemplate namedJdbcTemplate;
|
||||
|
||||
/**
|
||||
* 导出 Form(采用SQL方式)
|
||||
* 导出 Form(采用XML方式)
|
||||
*
|
||||
* @return
|
||||
* @throws SQLException
|
||||
|
@ -104,7 +105,7 @@ public class CgformSqlController extends BaseController {
|
|||
//update by duanqilu 2013-12-05 增加多表单导出功能
|
||||
//MigrateForm.createFile(request,cgFormHeadEntity.getTableName())
|
||||
String ls_filename = cgFormHeadEntity.getTableName();// 创建文件
|
||||
String destFileDir = ResourceUtil.getSystempPath()+"/"+ls_filename;
|
||||
String destFileDir = ResourceUtil.getSystempPath()+File.separator+ls_filename;
|
||||
MigrateForm.generateXmlDataOutFlieContent(dbTables, destFileDir);
|
||||
ls_filename = MigrateForm.zip(null, "", destFileDir); // 压缩文件
|
||||
// 文件下载
|
||||
|
@ -131,6 +132,7 @@ public class CgformSqlController extends BaseController {
|
|||
toClient.flush();
|
||||
toClient.close();
|
||||
fis.close();
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单配置导出]");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -149,7 +151,7 @@ public class CgformSqlController extends BaseController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 导入Form(采用SQL方式)
|
||||
* 导入Form(采用XML方式)
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
|
@ -169,9 +171,9 @@ public class CgformSqlController extends BaseController {
|
|||
if (uploadbasepath == null) {
|
||||
uploadbasepath = ResourceUtil.getConfigByName("uploadpath");
|
||||
}
|
||||
String path = uploadbasepath + "\\";// 文件保存在硬盘的相对路径
|
||||
String path = uploadbasepath + File.separator;// 文件保存在硬盘的相对路径
|
||||
String realPath = uploadFile.getMultipartRequest().getSession()
|
||||
.getServletContext().getRealPath("\\")
|
||||
.getServletContext().getRealPath(File.separator)
|
||||
+ path;// 文件的硬盘真实路径
|
||||
message = null;
|
||||
try {
|
||||
|
@ -197,7 +199,7 @@ public class CgformSqlController extends BaseController {
|
|||
MigrateForm.unzip(savePath, "");
|
||||
String sqlFileDir = realPath + ls_tmp.substring(0, ls_tmp.lastIndexOf("."));
|
||||
File sqlDirFile = new File(sqlFileDir);
|
||||
String sqlfilename = sqlDirFile.getPath() + "/";
|
||||
String sqlfilename = sqlDirFile.getPath() + File.separator;
|
||||
if(sqlDirFile.isDirectory()){
|
||||
sqlfilename += sqlDirFile.list()[0];
|
||||
}
|
||||
|
@ -224,6 +226,7 @@ public class CgformSqlController extends BaseController {
|
|||
LogUtil.error(e1.toString());
|
||||
message = e1.toString();
|
||||
}
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单配置导入]"+message);
|
||||
if (StringUtil.isNotEmpty(message))
|
||||
j.setMsg("SQL文件导入失败," + message);
|
||||
else
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
|
|||
import org.jeecgframework.core.common.model.json.AjaxJson;
|
||||
import org.jeecgframework.core.common.model.json.DataGrid;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.util.IpUtil;
|
||||
import org.jeecgframework.core.util.MyBeanUtils;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.tag.core.easyui.TagUtil;
|
||||
|
@ -95,7 +96,7 @@ public class CgformButtonController extends BaseController {
|
|||
message = "删除成功";
|
||||
cgformButtonService.delete(cgformButton);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单自定义按钮删除]"+message);
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
@ -140,6 +141,7 @@ public class CgformButtonController extends BaseController {
|
|||
cgformButtonService.save(cgformButton);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
}
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单自定义按钮添加编辑]"+message);
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
|
|||
import org.jeecgframework.core.common.model.json.AjaxJson;
|
||||
import org.jeecgframework.core.common.model.json.DataGrid;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.util.IpUtil;
|
||||
import org.jeecgframework.core.util.MyBeanUtils;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.tag.core.easyui.TagUtil;
|
||||
|
@ -100,7 +101,7 @@ public class CgformButtonSqlController extends BaseController {
|
|||
message = "删除成功";
|
||||
cgformButtonSqlService.delete(cgformButtonSql);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单sql增强删除]"+message);
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
@ -157,6 +158,7 @@ public class CgformButtonSqlController extends BaseController {
|
|||
cgformButtonSqlService.save(cgformButtonSql);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
}
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单sql增强添加更新]"+message);
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.jeecgframework.core.util.ContextHolderUtils;
|
|||
import org.jeecgframework.core.util.DateUtils;
|
||||
import org.jeecgframework.core.util.FileUtils;
|
||||
import org.jeecgframework.core.util.FormUtil;
|
||||
import org.jeecgframework.core.util.IpUtil;
|
||||
import org.jeecgframework.core.util.LogUtil;
|
||||
import org.jeecgframework.core.util.MyBeanUtils;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
|
@ -114,6 +115,7 @@ public class CgformFtlController extends BaseController {
|
|||
systemService.saveOrUpdate(t);
|
||||
j.setSuccess(true);
|
||||
j.setMsg("更新成功");
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单模板创建]更新成功");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
j.setSuccess(false);
|
||||
|
@ -172,7 +174,7 @@ public class CgformFtlController extends BaseController {
|
|||
cgformFtlService.delete(cgformFtl);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||
Globals.Log_Leavel_INFO);
|
||||
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单模板删除]"+message);
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
@ -199,6 +201,7 @@ public class CgformFtlController extends BaseController {
|
|||
templetContext.removeTemplateFromCache(po.getTableName()+"_"+TemplateUtil.TemplateType.DETAIL.getName());
|
||||
templetContext.removeTemplateFromCache(po.getTableName()+"_"+TemplateUtil.TemplateType.UPDATE.getName());
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE,Globals.Log_Leavel_INFO);
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单模板激活]"+message+"表名:"+po.getTableName());
|
||||
j.setSuccess(true);
|
||||
j.setMsg(message);
|
||||
} else {
|
||||
|
@ -235,6 +238,7 @@ public class CgformFtlController extends BaseController {
|
|||
cgformFtl.setFtlStatus("0");
|
||||
cgformFtlService.saveOrUpdate(cgformFtl);
|
||||
message = "取消激活成功";
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单模板取消激活]"+message+"表名:"+po.getTableName());
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE,
|
||||
Globals.Log_Leavel_INFO);
|
||||
j.setSuccess(true);
|
||||
|
@ -296,56 +300,61 @@ public class CgformFtlController extends BaseController {
|
|||
HttpSession session = ContextHolderUtils.getSession();
|
||||
String lang = (String)session.getAttribute("lang");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("<html xmlns:m=\"http://schemas.microsoft.com/office/2004/12/omml\"><head><title></title>");
|
||||
sb.append("<link href=\"plug-in/easyui/themes/default/easyui.css\" id=\"easyuiTheme\" rel=\"stylesheet\" type=\"text/css\" />");
|
||||
sb.append("<link href=\"plug-in/easyui/themes/icon.css\" rel=\"stylesheet\" type=\"text/css\" />");
|
||||
sb.append("<link href=\"plug-in/accordion/css/accordion.css\" rel=\"stylesheet\" type=\"text/css\" />");
|
||||
sb.append("<link href=\"plug-in/Validform/css/style.css\" rel=\"stylesheet\" type=\"text/css\" />");
|
||||
sb.append("<link href=\"plug-in/Validform/css/tablefrom.css\" rel=\"stylesheet\" type=\"text/css\" />");
|
||||
sb.append("<style type=\"text/css\">body{font-size:12px;}table{border: 1px solid #000000;padding:0; ");
|
||||
|
||||
sb.append("<!DOCTYPE html xmlns:m=\"http://schemas.microsoft.com/office/2004/12/omml\"><head><title></title>");
|
||||
|
||||
sb.append("<base href=\"${basePath}/\" />");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/jquery/jquery-1.8.3.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/tools/dataformat.js\"></script>");
|
||||
sb.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"${basePath}/plug-in/accordion/css/accordion.css\"></link>");
|
||||
sb.append("<link id=\"easyuiTheme\" rel=\"stylesheet\" href=\"${basePath}/plug-in/easyui/themes/default/easyui.css\" type=\"text/css\"></link>");
|
||||
sb.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/easyui/themes/icon.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/easyui/jquery.easyui.min.1.3.2.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/easyui/locale/zh-cn.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/tools/syUtil.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/My97DatePicker/WdatePicker.js\"></script>");
|
||||
sb.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/tools/css/metrole/common.css\" type=\"text/css\"></link>");
|
||||
sb.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/ace/css/font-awesome.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/lhgDialog/lhgdialog.min.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/layer/layer.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/tools/curdtools_zh-cn.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/tools/easyuiextend.js\"></script>");
|
||||
sb.append("<link id=\"easyuiTheme\" rel=\"stylesheet\" href=\"${basePath}/plug-in/easyui/themes/metrole/main.css\" type=\"text/css\"></link>");
|
||||
sb.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/uploadify/css/uploadify.css\" type=\"text/css\"></link>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/uploadify/jquery.uploadify-3.1.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/tools/Map.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/Validform/js/Validform_Datatype_zh-cn.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/Validform/js/datatype_zh-cn.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/Validform/plugin/passwordStrength/passwordStrength-min.js\"></script>");
|
||||
sb.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/Validform/css/metrole/style.css\" type=\"text/css\"/>");
|
||||
sb.append("<link rel=\"stylesheet\" href=\"${basePath}/plug-in/Validform/css/metrole/tablefrom.css\" type=\"text/css\"/>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/ueditor/ueditor.config.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"${basePath}/plug-in/ueditor/ueditor.all.js\"></script>");
|
||||
sb.append("<style type=\"text/css\">body{font-size:12px;}table{border: 1px solid #000000;padding:0; ");
|
||||
sb.append("margin:0 auto;border-collapse: collapse;width:100%;align:right;}td {border: 1px solid ");
|
||||
sb.append("#000000;background: #fff;font-size:12px;padding: 3px 3px 3px 8px;color: #000000;word-break: keep-all;}");
|
||||
sb.append("</style></head><script type=\"text/javascript\" src=\"plug-in/jquery/jquery-1.8.3.js\">");
|
||||
sb.append("</script><script type=\"text/javascript\" src=\"plug-in/tools/dataformat.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/jquery.easyui.min.1.3.2.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/easyui/locale/zh-cn.js\"></script>");
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/tools/syUtil.js\"></script><script ");
|
||||
sb.append("type=\"text/javascript\" src=\"plug-in/My97DatePicker/WdatePicker.js\"></script><script ");
|
||||
sb.append("type=\"text/javascript\" src=\"plug-in/lhgDialog/lhgdialog.min.js\"></script>");
|
||||
|
||||
sb.append("<script type=\"text/javascript\" src=\"plug-in/layer/layer.js\"></script>");
|
||||
sb.append(".ui_state_highlight{border:1px solid #39befb;position:relative;display:inline-block;cursor:pointer;text-align:center;overflow:hidden;border-radius:10px;padding:4px 30px;font-size:14px;background-color:#39befb;color:#fff}.ui_state_highlight:hover{background-color:#3aace5;color:#000;}");
|
||||
|
||||
sb.append(StringUtil.replace("<script type=\"text/javascript\" src=\"plug-in/tools/curdtools_{0}.js\"></script><script type=\"text/javascript\" ",
|
||||
"{0}", lang));
|
||||
sb.append("</style></head>");
|
||||
|
||||
sb.append("src=\"plug-in/tools/easyuiextend.js\"></script><script type=\"text/javascript\" ");
|
||||
sb.append("src=\"plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js\"></script><script type=\"text/javascript\" ");
|
||||
sb.append("src=\"plug-in/Validform/js/Validform_Datatype_zh-cn.js\"></script><script type=\"text/javascript\" ");
|
||||
sb.append("src=\"plug-in/Validform/js/datatype_zh-cn.js\"></script><script type=\"text/javascript\" ");
|
||||
sb.append("src=\"plug-in/Validform/plugin/passwordStrength/passwordStrength-min.js\"></script>");
|
||||
|
||||
//表单提交 js
|
||||
sb.append("<script type=\"text/javascript\">$(function(){$(\"#formobj\").Validform({tiptype:1,");
|
||||
sb.append("btnSubmit:\"#btn_sub\",btnReset:\"#btn_reset\",ajaxPost:true,usePlugin:{passwordstrength:");
|
||||
sb.append("{minLen:6,maxLen:18,trigger:function(obj,error){if(error){obj.parent().next().");
|
||||
sb.append("find(\".Validform_checktip\").show();obj.find(\".passwordStrength\").hide();}");
|
||||
sb.append("else{$(\".passwordStrength\").show();obj.parent().next().find(\".Validform_checktip\")");
|
||||
sb.append(".hide();}}}},callback:function(data){if(data.success");
|
||||
sb.append("==true) {uploadFile(data);}else{ if (data.responseText == '' || data.responseText == undefined) {");
|
||||
sb.append(" $.messager.alert('错误', data.msg); $.Hidemsg();} else {");
|
||||
sb.append(" try { var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'), data.responseText.indexOf('错误信息'));");
|
||||
sb.append(" $.messager.alert('错误', emsg); $.Hidemsg();");
|
||||
sb.append(" } catch(ex) { $.messager.alert('错误', data.responseText + '');}}return false;}");
|
||||
sb.append("if (!neibuClickFlag) { var win = frameElement.api.opener;win.reloadTable(); }}});});</script><body>");
|
||||
|
||||
sb.append("<body>");
|
||||
|
||||
sb.append("<div align=\"center\" id=\"sub_tr\" style=\"display: none;\"><input class=\"ui_state_highlight\" onclick=\"neibuClick()\" type=\"button\" value=\"提交\" /></div>");
|
||||
sb.append("</body>");
|
||||
sb.append("<script type=\"text/javascript\">$(function(){if(location.href.indexOf(\"mode=read\")!=-1){");
|
||||
sb.append("$('#formobj').find(':input').attr('disabled','disabled');}");
|
||||
sb.append("if(location.href.indexOf(\"mode=onbutton\")!=-1){$(\"#sub_tr\").show();} });");
|
||||
sb.append("var neibuClickFlag = false; function neibuClick() {neibuClickFlag = true;$('#btn_sub').trigger('click');}</script>");
|
||||
|
||||
|
||||
sb.append("<script type=\"text/javascript\">$(function(){$(\"#formobj\").Validform({tiptype:1,btnSubmit:\"#btn_sub\",btnReset:\"#btn_reset\",ajaxPost:true,usePlugin:{passwordstrength:{minLen:6,maxLen:18,trigger:function(obj,error){if(error){obj.parent().next().find(\".Validform_checktip\").show();obj.find(\".passwordStrength\").hide();}else{$(\".passwordStrength\").show();obj.parent().next().find(\".Validform_checktip\").hide();}}}},callback:function(data){if(data.success==true){uploadFile(data);}else{if(data.responseText==''||data.responseText==undefined){$.messager.alert('错误', data.msg);$.Hidemsg();}else{try{var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'),data.responseText.indexOf('错误信息')); $.messager.alert('错误',emsg);$.Hidemsg();}catch(ex){$.messager.alert('错误',data.responseText+'');}} return false;}if(!neibuClickFlag){var win = frameElement.api.opener; win.reloadTable();}}});});</script>");
|
||||
|
||||
sb.append("<script type=\"text/javascript\">");
|
||||
sb.append("$(function(){if(location.href.indexOf(\"goDetail.do\")!=-1){$(\".jeecgDetail\").hide();}if(location.href.indexOf(\"goDetail.do\")!=-1){$(\"#formobj\").find(\":input\").attr(\"disabled\",\"disabled\");}if(location.href.indexOf(\"goAddButton.do\")!=-1||location.href.indexOf(\"goUpdateButton.do\")!=-1){$(\"#sub_tr\").show();}});");
|
||||
sb.append(" var neibuClickFlag = false;");
|
||||
sb.append(" function neibuClick() {neibuClickFlag = true;$('#btn_sub').trigger('click');}");
|
||||
sb.append(" function uploadFile(data){if(!$(\"input[name='id']\").val()){if(data.obj!=null && data.obj!='undefined'){$(\"input[name='id']\").val(data.obj.id);}} if($(\".uploadify-queue-item\").length>0){upload();}else{if (neibuClickFlag){alert(data.msg);neibuClickFlag = false;}else {var win = frameElement.api.opener;win.reloadTable();win.tip(data.msg);frameElement.api.close();}}}");
|
||||
sb.append(" $.dialog.setting.zIndex =9999;");
|
||||
sb.append(" function del(url,obj){$.dialog.confirm(\"确认删除该条记录?\", function(){$.ajax({async : false,cache : false,type : 'POST',url : url,error : function() {},success : function(data) {var d = $.parseJSON(data);if (d.success) {var msg = d.msg;tip(msg);$(obj).closest(\"tr\").hide(\"slow\");}}});}, function(){ });}");
|
||||
sb.append("</script>");
|
||||
|
||||
sb.append("<script type=\"text/javascript\">${js_plug_in?if_exists}</script></html>");
|
||||
|
||||
|
||||
|
@ -413,24 +422,24 @@ public class CgformFtlController extends BaseController {
|
|||
}
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
// 文件数据库保存路径
|
||||
String path = uploadbasepath + "\\";// 文件保存在硬盘的相对路径
|
||||
String path = uploadbasepath + File.separator;// 文件保存在硬盘的相对路径
|
||||
String realPath = uploadFile.getMultipartRequest().getSession()
|
||||
.getServletContext().getRealPath("\\")
|
||||
.getServletContext().getRealPath(File.separator)
|
||||
+ path;// 文件的硬盘真实路径
|
||||
File file = new File(realPath);
|
||||
if (!file.exists()) {
|
||||
file.mkdir();// 创建根目录
|
||||
}
|
||||
if (uploadFile.getCusPath() != null) {
|
||||
realPath += uploadFile.getCusPath() + "\\";
|
||||
path += uploadFile.getCusPath() + "\\";
|
||||
realPath += uploadFile.getCusPath() + File.separator;
|
||||
path += uploadFile.getCusPath() +File.separator;
|
||||
file = new File(realPath);
|
||||
if (!file.exists()) {
|
||||
file.mkdir();// 创建文件自定义子目录
|
||||
}
|
||||
} else {
|
||||
realPath += DateUtils.getDataString(DateUtils.yyyyMMdd) + "\\";
|
||||
path += DateUtils.getDataString(DateUtils.yyyyMMdd) + "\\";
|
||||
realPath += DateUtils.getDataString(DateUtils.yyyyMMdd) +File.separator;
|
||||
path += DateUtils.getDataString(DateUtils.yyyyMMdd) +File.separator;
|
||||
file = new File(realPath);
|
||||
if (!file.exists()) {
|
||||
file.mkdir();// 创建文件时间子目录
|
||||
|
@ -481,12 +490,17 @@ public class CgformFtlController extends BaseController {
|
|||
StringBuilder script = new StringBuilder("");
|
||||
script.append("<div align=\"center\" id=\"sub_tr\" style=\"display: none;\"><input class=\"ui_state_highlight\" onclick=\"neibuClick()\" type=\"button\" value=\"提交\" /></div>");
|
||||
script.append("</body>");
|
||||
script.append("<script type=\"text/javascript\">$(function(){if(location.href.indexOf(\"mode=read\")!=-1){");
|
||||
script.append("$('#formobj').find(':input').attr('disabled','disabled');}");
|
||||
script.append("if(location.href.indexOf(\"mode=onbutton\")!=-1){$(\"#sub_tr\").show();} });");
|
||||
script.append("var neibuClickFlag = false; function neibuClick() {neibuClickFlag = true;$('#btn_sub').trigger('click');}</script>");
|
||||
|
||||
|
||||
|
||||
script.append("<script type=\"text/javascript\">$(function(){$(\"#formobj\").Validform({tiptype:function(msg,o,cssctl){if(o.type == 3){layer.open({title:'提示信息',content:msg,icon:5,shift:6,btn:false,shade:false,time:5000,cancel:function(index){o.obj.focus();layer.close(index);},yes:function(index){o.obj.focus();layer.close(index);},})}},btnSubmit:\"#btn_sub\",btnReset:\"#btn_reset\",ajaxPost:true,usePlugin:{passwordstrength:{minLen:6,maxLen:18,trigger:function(obj,error){if(error){obj.parent().next().find(\".Validform_checktip\").show();obj.find(\".passwordStrength\").hide();}else{$(\".passwordStrength\").show();obj.parent().next().find(\".Validform_checktip\").hide();}}}},callback:function(data){if(data.success==true){uploadFile(data);}else{if(data.responseText==''||data.responseText==undefined){$.messager.alert('错误', data.msg);$.Hidemsg();}else{try{var emsg = data.responseText.substring(data.responseText.indexOf('错误描述'),data.responseText.indexOf('错误信息')); $.messager.alert('错误',emsg);$.Hidemsg();}catch(ex){$.messager.alert('错误',data.responseText+'');}} return false;}if(!neibuClickFlag){var win = frameElement.api.opener; win.reloadTable();}}});});</script>");
|
||||
script.append("<script type=\"text/javascript\">");
|
||||
script.append("$(function(){if(location.href.indexOf(\"goDetail.do\")!=-1){$(\".jeecgDetail\").hide();}if(location.href.indexOf(\"goDetail.do\")!=-1){$(\"#formobj\").find(\":input\").attr(\"disabled\",\"disabled\");}if(location.href.indexOf(\"goAddButton.do\")!=-1||location.href.indexOf(\"goUpdateButton.do\")!=-1){$(\"#sub_tr\").show();}});");
|
||||
script.append(" var neibuClickFlag = false;");
|
||||
script.append(" function neibuClick() {neibuClickFlag = true;$('#btn_sub').trigger('click');}");
|
||||
script.append(" function uploadFile(data){if(!$(\"input[name='id']\").val()){if(data.obj!=null && data.obj!='undefined'){$(\"input[name='id']\").val(data.obj.id);}} if($(\".uploadify-queue-item\").length>0){upload();}else{if (neibuClickFlag){alert(data.msg);neibuClickFlag = false;}else {var win = frameElement.api.opener;win.reloadTable();win.tip(data.msg);frameElement.api.close();}}}");
|
||||
script.append(" $.dialog.setting.zIndex =9999;");
|
||||
script.append(" function del(url,obj){$.dialog.confirm(\"确认删除该条记录?\", function(){$.ajax({async : false,cache : false,type : 'POST',url : url,error : function() {},success : function(data) {var d = $.parseJSON(data);if (d.success) {var msg = d.msg;tip(msg);$(obj).closest(\"tr\").hide(\"slow\");}}});}, function(){ });}");
|
||||
script.append("</script>");
|
||||
|
||||
script.append("<script type=\"text/javascript\">");
|
||||
script.append("${js_plug_in?if_exists}");
|
||||
script.append("</script>");
|
||||
|
@ -497,6 +511,7 @@ public class CgformFtlController extends BaseController {
|
|||
cgformFtlService.saveOrUpdate(cgformFtl);
|
||||
LogUtil.info("-------------------------step.5-------------------------------------");
|
||||
}
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单模板word上传]"+message+"表名:"+cgformName);
|
||||
} catch (Exception e1) {
|
||||
LogUtil.error(e1.toString());
|
||||
message = e1.toString();
|
||||
|
|
|
@ -17,10 +17,12 @@ import org.jeecgframework.core.common.model.json.AjaxJson;
|
|||
import org.jeecgframework.core.common.model.json.DataGrid;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.util.ExceptionUtil;
|
||||
import org.jeecgframework.core.util.IpUtil;
|
||||
import org.jeecgframework.core.util.MutiLangUtil;
|
||||
import org.jeecgframework.core.util.MyBeanUtils;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.core.util.oConvertUtils;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
import org.jeecgframework.tag.core.easyui.TagUtil;
|
||||
|
@ -35,6 +37,7 @@ import org.jeecgframework.web.cgform.service.config.CgFormIndexServiceI;
|
|||
import org.jeecgframework.web.cgform.service.impl.config.util.FieldNumComparator;
|
||||
import org.jeecgframework.web.cgform.util.PublicUtil;
|
||||
import org.jeecgframework.web.system.pojo.base.TSType;
|
||||
import org.jeecgframework.web.system.pojo.base.TSUser;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -135,14 +138,25 @@ public class CgFormHeadController extends BaseController {
|
|||
cgFormHead);
|
||||
this.cgFormFieldService.getDataGridReturn(cq, true);
|
||||
|
||||
List<CgFormHeadEntity> list=dataGrid.getResults();
|
||||
Map<String,Map<String,Object>> extMap = new HashMap<String, Map<String,Object>>();
|
||||
for(CgFormHeadEntity temp:list){
|
||||
//此为针对原来的行数据,拓展的新字段
|
||||
Map m = new HashMap();
|
||||
m.put("hasPeizhi",String.valueOf(this.cgFormFieldService.getByphysiceId(temp.getId())));
|
||||
extMap.put(temp.getId(), m);
|
||||
List<CgFormHeadEntity> list = dataGrid.getResults();
|
||||
Map<String,Map<String,Object>> extMap = new HashMap<String, Map<String,Object>>();
|
||||
List<Map<String,Object>> pzlist = this.cgFormFieldService.getPeizhiCountByIds(list);
|
||||
for(Map<String,Object> temp:pzlist){
|
||||
//此为针对原来的行数据,拓展的新字段
|
||||
Map<String,Object> m = new HashMap<String,Object>();
|
||||
m.put("hasPeizhi",temp.get("hasPeizhi")==null?"0":temp.get("hasPeizhi"));
|
||||
extMap.put(temp.get("id").toString(), m);
|
||||
}
|
||||
//因数据查询优化,补全空数据。考虑到效率问题,不使用嵌套循环。
|
||||
for(CgFormHeadEntity temp:list){
|
||||
//此为针对原来的行数据,拓展的新字段
|
||||
if (extMap.get(temp.getId())==null) {
|
||||
Map<String,Object> m = new HashMap<String,Object>();
|
||||
m.put("hasPeizhi","0");
|
||||
extMap.put(temp.getId(), m);
|
||||
}
|
||||
}
|
||||
|
||||
TagUtil.datagrid(response, dataGrid, extMap);
|
||||
|
||||
}
|
||||
|
@ -164,7 +178,7 @@ public class CgFormHeadController extends BaseController {
|
|||
cgFormFieldService.removeSubTableStr4Main(cgFormHead);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||
Globals.Log_Leavel_INFO);
|
||||
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单配置删除]"+message+"表名:"+cgFormHead.getTableName());
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
@ -186,7 +200,7 @@ public class CgFormHeadController extends BaseController {
|
|||
cgFormFieldService.removeSubTableStr4Main(cgFormHead);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||
Globals.Log_Leavel_INFO);
|
||||
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单配置移除]"+message+"表名:"+cgFormHead.getTableName());
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
@ -207,7 +221,6 @@ public class CgFormHeadController extends BaseController {
|
|||
cgFormFieldService.delete(cgFormField);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||
Globals.Log_Leavel_INFO);
|
||||
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
@ -225,8 +238,28 @@ public class CgFormHeadController extends BaseController {
|
|||
HttpServletRequest request) {
|
||||
String message;
|
||||
AjaxJson j = new AjaxJson();
|
||||
cgFormHead = systemService.getEntity(CgFormHeadEntity.class,
|
||||
cgFormHead.getId());
|
||||
cgFormHead = systemService.getEntity(CgFormHeadEntity.class,cgFormHead.getId());
|
||||
|
||||
logger.info("---同步数据库 ---doDbSynch-----> TableName:"+cgFormHead.getTableName()+" ---修改时间 :"+cgFormHead.getUpdateDate()+" ----创建时间:"+cgFormHead.getCreateDate() +"---请求IP ---+"+oConvertUtils.getIpAddrByRequest(request));
|
||||
//安全控制,判断不在online管理中表单不允许操作
|
||||
String sql = "select count(*) from cgform_head where table_name = '"+cgFormHead.getTableName()+"'";
|
||||
Long i = systemService.getCountForJdbc(sql);
|
||||
if(i==0){
|
||||
message = "同步失败,非法无授权访问!";
|
||||
logger.info(message+" ----- 请求IP ---+"+IpUtil.getIpAddr(request));
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
TSUser currentUser = ResourceUtil.getSessionUser();
|
||||
if("0".equals(currentUser.getDevFlag())){
|
||||
message = "同步失败,您不是开发人员无授权访问!";
|
||||
logger.info(message+" ----- 请求IP ---+"+IpUtil.getIpAddr(request));
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
//TODO 校验登录用户是否拥有开发权限
|
||||
|
||||
|
||||
//同步数据库
|
||||
try {
|
||||
boolean bl = cgFormFieldService.dbSynch(cgFormHead,synMethod);
|
||||
|
@ -243,6 +276,7 @@ public class CgFormHeadController extends BaseController {
|
|||
}
|
||||
|
||||
j.setMsg(message);
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单配置同步数据库]"+message+"表名:"+cgFormHead.getTableName());
|
||||
}else{
|
||||
message = "同步失败";
|
||||
j.setMsg(message);
|
||||
|
@ -344,6 +378,7 @@ public class CgFormHeadController extends BaseController {
|
|||
systemService.addLog(message, Globals.Log_Type_INSERT,
|
||||
Globals.Log_Leavel_INFO);
|
||||
}
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"][online表单配置保存]"+message+"表名:"+cgFormHead.getTableName());
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
|
|
@ -264,7 +264,7 @@ public class CgFormIndexController extends BaseController {
|
|||
List<CgFormIndexEntity> cgFormIndexs = this.cgFormIndexService.getListByCriteriaQuery(cq,false);
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"索引表");
|
||||
modelMap.put(NormalExcelConstants.CLASS,CgFormIndexEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("索引表列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("索引表列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,cgFormIndexs);
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
|
@ -280,7 +280,7 @@ public class CgFormIndexController extends BaseController {
|
|||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"索引表");
|
||||
modelMap.put(NormalExcelConstants.CLASS,CgFormIndexEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("索引表列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("索引表列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
|
|
|
@ -85,8 +85,10 @@ public class ExcelTempletController extends BaseController {
|
|||
*/
|
||||
@SuppressWarnings("all")
|
||||
@RequestMapping(params = "exportXls")
|
||||
|
||||
public String exportXls(HttpServletRequest request, ModelMap modelMap,
|
||||
HttpServletResponse response, String field, DataGrid dataGrid) {
|
||||
HttpServletResponse response, String field, DataGrid dataGrid,String id) {//update-begin--Author:dangzhenghui Date:20170429 for:TASK #1906 【online excel】Online excel 导出功能改进
|
||||
|
||||
|
||||
String codedFileName = "文件";
|
||||
String sheetName = "导出信息";
|
||||
|
@ -136,8 +138,20 @@ public class ExcelTempletController extends BaseController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String, Object>> nresult=new ArrayList<Map<String, Object>>();
|
||||
if (StringUtil.isNotEmpty(id)){
|
||||
for(Map map:result){
|
||||
if(id.contains((String )map.get("id"))){
|
||||
nresult.add(map);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
nresult.addAll(result);
|
||||
}
|
||||
|
||||
modelMap.put(MapExcelConstants.ENTITY_LIST, entityList);
|
||||
modelMap.put(MapExcelConstants.MAP_LIST, result);
|
||||
modelMap.put(MapExcelConstants.MAP_LIST, nresult);
|
||||
modelMap.put(MapExcelConstants.FILE_NAME, codedFileName);
|
||||
modelMap.put(MapExcelConstants.PARAMS, new ExportParams(null, sheetName));
|
||||
return MapExcelConstants.JEECG_MAP_EXCEL_VIEW;
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
@ -25,11 +26,13 @@ import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
|
|||
import org.jeecgframework.core.common.model.json.AjaxJson;
|
||||
import org.jeecgframework.core.common.model.json.DataGrid;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.util.ContextHolderUtils;
|
||||
import org.jeecgframework.core.util.ExceptionUtil;
|
||||
import org.jeecgframework.core.util.FileUtils;
|
||||
import org.jeecgframework.core.util.MyBeanUtils;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.p3.core.util.oConvertUtils;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.entity.ExportParams;
|
||||
import org.jeecgframework.poi.excel.entity.ImportParams;
|
||||
|
@ -328,7 +331,7 @@ public class CgformTemplateController extends BaseController {
|
|||
List<CgformTemplateEntity> cgformTemplates = this.cgformTemplateService.getListByCriteriaQuery(cq, false);
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"自定义模板");
|
||||
modelMap.put(NormalExcelConstants.CLASS,CgformTemplateEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("自定义模板列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("自定义模板列表", "导出人:"+ResourceUtil.getSessionUser().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST, cgformTemplates);
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
|
@ -346,7 +349,7 @@ public class CgformTemplateController extends BaseController {
|
|||
if(StringUtils.isNotBlank(id)) {
|
||||
CgformTemplateEntity entity = cgformTemplateService.getEntity(CgformTemplateEntity.class, id);
|
||||
if (entity != null && entity.getTemplateCode() != null) {
|
||||
File dirFile=new File(getUploadBasePath(request)+"/"+entity.getTemplateCode());
|
||||
File dirFile=new File(getUploadBasePath(request)+File.separator+entity.getTemplateCode());
|
||||
if(dirFile.exists()&&dirFile.isDirectory()){
|
||||
flag=true;
|
||||
}
|
||||
|
@ -442,7 +445,7 @@ public class CgformTemplateController extends BaseController {
|
|||
tempDir.mkdirs();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile file = entity.getValue();
|
||||
picTempFile=new File(tempDir.getAbsolutePath(),"/index_"+request.getSession().getId()+"."+FileUtils.getExtend(file.getOriginalFilename()));
|
||||
picTempFile=new File(tempDir.getAbsolutePath(),File.separator+"index_"+request.getSession().getId()+"."+FileUtils.getExtend(file.getOriginalFilename()));
|
||||
try{
|
||||
if(picTempFile.exists())
|
||||
org.apache.commons.io.FileUtils.forceDelete(picTempFile);
|
||||
|
@ -477,7 +480,7 @@ public class CgformTemplateController extends BaseController {
|
|||
tempDir.mkdirs();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile file = entity.getValue();
|
||||
picTempFile=new File(tempDir.getAbsolutePath(),"/zip_"+request.getSession().getId()+"."+ FileUtils.getExtend(file.getOriginalFilename()));
|
||||
picTempFile=new File(tempDir.getAbsolutePath(),File.separator+"zip_"+request.getSession().getId()+"."+ FileUtils.getExtend(file.getOriginalFilename()));
|
||||
try{
|
||||
if(picTempFile.exists())
|
||||
org.apache.commons.io.FileUtils.forceDelete(picTempFile);
|
||||
|
@ -506,17 +509,19 @@ public class CgformTemplateController extends BaseController {
|
|||
String defaultPath="default.jpg";
|
||||
String defaultCode="default/images/";
|
||||
//无图片情况
|
||||
if(path==null){
|
||||
|
||||
if(oConvertUtils.isEmpty(path)){
|
||||
path=defaultPath;
|
||||
code=defaultCode;
|
||||
}else{
|
||||
//临时图片
|
||||
if(code==null){
|
||||
if(oConvertUtils.isEmpty(code)){
|
||||
code="temp/";
|
||||
}else{
|
||||
code+="/images/";
|
||||
}
|
||||
}
|
||||
|
||||
FileInputStream fis = null;
|
||||
OutputStream out = null;
|
||||
response.setContentType("image/" + FileUtils.getExtend(path));
|
||||
|
@ -530,16 +535,19 @@ public class CgformTemplateController extends BaseController {
|
|||
byte[] b = new byte[fis.available()];
|
||||
fis.read(b);
|
||||
out.write(b);
|
||||
out.flush();
|
||||
|
||||
//out.flush();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error(e.toString());
|
||||
// e.printStackTrace();
|
||||
} finally {
|
||||
if (fis != null) {
|
||||
try {
|
||||
fis.close();
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.info(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -625,7 +633,14 @@ public class CgformTemplateController extends BaseController {
|
|||
//下载文件
|
||||
private void downLoadFile(InputStream inputStream,String fileName,long size,HttpServletResponse response){
|
||||
try{
|
||||
fileName=new String(fileName.getBytes("utf-8"),"iso-8859-1");
|
||||
|
||||
String userAgent =ContextHolderUtils.getRequest().getHeader("user-agent").toLowerCase();
|
||||
if (userAgent.contains("msie") || userAgent.contains("like gecko") ) {
|
||||
fileName = URLEncoder.encode(fileName, "UTF-8");
|
||||
}else {
|
||||
fileName = new String(fileName.getBytes("UTF-8"),"iso-8859-1");
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -17,10 +17,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jeecgframework.codegenerate.database.JeecgReadTable;
|
||||
import org.jeecgframework.codegenerate.pojo.Columnt;
|
||||
import org.jeecgframework.core.common.model.json.AjaxJson;
|
||||
import org.jeecgframework.core.common.model.json.DataGrid;
|
||||
import org.jeecgframework.core.util.IpUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.core.util.oConvertUtils;
|
||||
import org.jeecgframework.tag.vo.datatable.SortDirection;
|
||||
|
@ -43,7 +45,8 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
@Controller
|
||||
@RequestMapping("/cgformTransController")
|
||||
public class CgformTransController {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(CgformTransController.class);
|
||||
private static String GENERATE_FORM_IDS;
|
||||
@Autowired
|
||||
private CgFormFieldServiceI cgFormFieldService;
|
||||
|
||||
|
@ -105,22 +108,32 @@ public class CgformTransController {
|
|||
public AjaxJson transEditor(HttpServletRequest request, String id)
|
||||
throws Exception {
|
||||
AjaxJson j = new AjaxJson();
|
||||
|
||||
//TODO 1.存在缺陷,表单移除再点击生成违法生成
|
||||
//TODO 2.重复提醒,在前段没提示信息
|
||||
if(GENERATE_FORM_IDS!=null && GENERATE_FORM_IDS.equals(id)){
|
||||
j.setMsg("不允许重复生成!");
|
||||
j.setSuccess(false);
|
||||
return j;
|
||||
}else{
|
||||
GENERATE_FORM_IDS = id;
|
||||
}
|
||||
|
||||
|
||||
String ids[] = id.split(",");
|
||||
String no = "";
|
||||
String yes = "";
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (StringUtil.isNotEmpty(ids[i])) {
|
||||
List<CgFormHeadEntity> cffList = cgFormFieldService
|
||||
.findByProperty(CgFormHeadEntity.class, "tableName",
|
||||
ids[i]);
|
||||
List<CgFormHeadEntity> cffList = cgFormFieldService.findByProperty(CgFormHeadEntity.class, "tableName",ids[i]);
|
||||
if (cffList.size() > 0) {
|
||||
if (no != "")
|
||||
no += ",";
|
||||
no += ids[i];
|
||||
continue;
|
||||
}
|
||||
List<Columnt> list = new JeecgReadTable()
|
||||
.readOriginalTableColumn(ids[i]);
|
||||
logger.info("["+IpUtil.getIpAddr(request)+"] [online数据库导入表] "+" --表名:"+ids[i]);
|
||||
List<Columnt> list = new JeecgReadTable().readOriginalTableColumn(ids[i]);
|
||||
CgFormHeadEntity cgFormHead = new CgFormHeadEntity();
|
||||
cgFormHead.setJformType(1);
|
||||
cgFormHead.setIsCheckbox("Y");
|
||||
|
@ -192,13 +205,11 @@ public class CgformTransController {
|
|||
cgFormField.setLength(Integer.valueOf(columnt.getCharmaxLength()));
|
||||
}catch(Exception e){}
|
||||
} else {
|
||||
cgFormField.setLength(Integer.valueOf(columnt
|
||||
.getCharmaxLength()));
|
||||
cgFormField.setLength(Integer.valueOf(columnt.getCharmaxLength()));
|
||||
}
|
||||
} else {
|
||||
if (StringUtil.isNotEmpty(columnt.getPrecision())) {
|
||||
cgFormField.setLength(Integer.valueOf(columnt
|
||||
.getPrecision()));
|
||||
cgFormField.setLength(Integer.valueOf(columnt.getPrecision()));
|
||||
}
|
||||
|
||||
else{
|
||||
|
@ -208,8 +219,7 @@ public class CgformTransController {
|
|||
}
|
||||
|
||||
if (StringUtil.isNotEmpty(columnt.getScale()))
|
||||
cgFormField.setPointLength(Integer.valueOf(columnt
|
||||
.getScale()));
|
||||
cgFormField.setPointLength(Integer.valueOf(columnt.getScale()));
|
||||
|
||||
}
|
||||
columnsList.add(cgFormField);
|
||||
|
@ -217,7 +227,7 @@ public class CgformTransController {
|
|||
cgFormHead.setColumns(columnsList);
|
||||
|
||||
if(oConvertUtils.isEmpty(cgFormHead.getJformCategory())){
|
||||
cgFormHead.setJformCategory("bdfl_ptbd");
|
||||
cgFormHead.setJformCategory("bdfl_include");
|
||||
}
|
||||
|
||||
cgFormFieldService.saveTable(cgFormHead, "");
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
package org.jeecgframework.web.cgform.controller.upload;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
@ -10,20 +20,28 @@ import org.jeecgframework.web.cgform.entity.upload.CgUploadEntity;
|
|||
import org.jeecgframework.web.cgform.service.upload.CgUploadServiceI;
|
||||
import org.jeecgframework.web.system.pojo.base.TSAttachment;
|
||||
import org.jeecgframework.web.system.service.SystemService;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jeecgframework.core.common.controller.BaseController;
|
||||
import org.jeecgframework.core.common.model.common.UploadFile;
|
||||
import org.jeecgframework.core.common.model.json.AjaxJson;
|
||||
import org.jeecgframework.core.constant.Globals;
|
||||
import org.jeecgframework.core.extend.swftools.SwfToolsUtil;
|
||||
import org.jeecgframework.core.util.DateUtils;
|
||||
import org.jeecgframework.core.util.FileUtils;
|
||||
import org.jeecgframework.core.util.PinyinUtil;
|
||||
import org.jeecgframework.core.util.ResourceUtil;
|
||||
import org.jeecgframework.core.util.StringUtil;
|
||||
import org.jeecgframework.core.util.oConvertUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -40,8 +58,8 @@ public class CgUploadController extends BaseController {
|
|||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger
|
||||
.getLogger(CgUploadController.class);
|
||||
private static final Logger logger = Logger.getLogger(CgUploadController.class);
|
||||
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
|
@ -63,6 +81,7 @@ public class CgUploadController extends BaseController {
|
|||
String id = oConvertUtils.getString(request.getParameter("cgFormId"));//动态表主键ID
|
||||
String tableName = oConvertUtils.getString(request.getParameter("cgFormName"));//动态表名
|
||||
String cgField = oConvertUtils.getString(request.getParameter("cgFormField"));//动态表上传控件字段
|
||||
logger.info("--cgUploadController--saveFiles--上传文件-----"+"{id:"+id+"} {tableName:"+tableName+"} {cgField:"+cgField+"}");
|
||||
if(!StringUtil.isEmpty(id)){
|
||||
cgUploadEntity.setCgformId(id);
|
||||
cgUploadEntity.setCgformName(tableName);
|
||||
|
@ -77,12 +96,21 @@ public class CgUploadController extends BaseController {
|
|||
uploadFile.setSwfpath("swfpath");
|
||||
uploadFile.setByteField(null);//不存二进制内容
|
||||
cgUploadEntity = systemService.uploadFile(uploadFile);
|
||||
cgUploadService.writeBack(id, tableName, cgField, fileKey, cgUploadEntity.getRealpath());
|
||||
logger.info("--cgUploadController--saveFiles--上传文件----数据库保存转换成功-----");
|
||||
|
||||
String realPath = cgUploadEntity.getRealpath();
|
||||
realPath = realPath.replace(File.separator, "/");
|
||||
cgUploadService.writeBack(id, tableName, cgField, fileKey, realPath);
|
||||
logger.info("--cgUploadController--saveFiles--上传文件----回写业务数据表字段文件路径-----");
|
||||
|
||||
attributes.put("url", realPath);
|
||||
attributes.put("name", cgUploadEntity.getAttachmenttitle());
|
||||
attributes.put("fileKey", cgUploadEntity.getId());
|
||||
attributes.put("viewhref", "commonController.do?objfileList&fileKey=" + cgUploadEntity.getId());
|
||||
attributes.put("delurl", "commonController.do?delObjFile&fileKey=" + cgUploadEntity.getId());
|
||||
j.setMsg("操作成功");
|
||||
j.setAttributes(attributes);
|
||||
logger.info("--cgUploadController--saveFiles--上传文件----操作成功-----");
|
||||
return j;
|
||||
}
|
||||
|
||||
|
@ -98,12 +126,154 @@ public class CgUploadController extends BaseController {
|
|||
AjaxJson j = new AjaxJson();
|
||||
String id = request.getParameter("id");
|
||||
CgUploadEntity file = systemService.getEntity(CgUploadEntity.class, id);
|
||||
|
||||
String sql = "select " + file.getCgformField() + " from " + file.getCgformName() + " where id = '" + file.getCgformId() + "'";
|
||||
List<Object> cgformFieldResult = systemService.findListbySql(sql);
|
||||
if(cgformFieldResult != null && !cgformFieldResult.isEmpty() && cgformFieldResult.get(0) != null){
|
||||
String path = cgformFieldResult.get(0).toString();
|
||||
String realPath = file.getRealpath();
|
||||
realPath = realPath.replace(File.separator, "/");
|
||||
boolean updateFlag = false;
|
||||
if(path.equals(realPath)){
|
||||
//获取这个关联的其他文件信息
|
||||
String hql = "from CgUploadEntity where cgformId = '"+file.getCgformId()+"' "
|
||||
+ " and cgformField = '"+file.getCgformField()+"' "
|
||||
+ " and cgformName = '"+file.getCgformName()+"'";
|
||||
List<CgUploadEntity> uploadList = systemService.findHql(hql);
|
||||
if(uploadList != null && !uploadList.isEmpty() && uploadList.size() > 1){
|
||||
for (CgUploadEntity cgUploadEntity : uploadList) {
|
||||
if(!file.getId().equals(cgUploadEntity.getId())){
|
||||
realPath = cgUploadEntity.getRealpath();
|
||||
realPath = realPath.replace(File.separator, "/");
|
||||
cgUploadService.writeBack(file.getCgformId(), file.getCgformName(), file.getCgformField(), file.getId(), realPath);
|
||||
updateFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!updateFlag){
|
||||
cgUploadService.writeBack(file.getCgformId(), file.getCgformName(), file.getCgformField(), file.getId(), "");
|
||||
}
|
||||
}
|
||||
|
||||
message = "" + file.getAttachmenttitle() + "被删除成功";
|
||||
cgUploadService.deleteFile(file);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL,
|
||||
Globals.Log_Leavel_INFO);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL,Globals.Log_Leavel_INFO);
|
||||
j.setSuccess(true);
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动上传保存附件资源的方式
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "ajaxSaveFile")
|
||||
@ResponseBody
|
||||
public AjaxJson ajaxSaveFile(MultipartHttpServletRequest request) {
|
||||
AjaxJson ajaxJson = new AjaxJson();
|
||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||
try {
|
||||
Map<String, MultipartFile> fileMap = request.getFileMap();
|
||||
String uploadbasepath = ResourceUtil.getConfigByName("uploadpath");
|
||||
// 文件数据库保存路径
|
||||
String path = uploadbasepath + "/";// 文件保存在硬盘的相对路径
|
||||
String realPath = request.getSession().getServletContext().getRealPath("/") + "/" + path;// 文件的硬盘真实路径
|
||||
realPath += DateUtils.getDataString(DateUtils.yyyyMMdd) + "/";
|
||||
path += DateUtils.getDataString(DateUtils.yyyyMMdd) + "/";
|
||||
File file = new File(realPath);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();// 创建文件时间子目录
|
||||
}
|
||||
if(fileMap != null && !fileMap.isEmpty()){
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
MultipartFile mf = entity.getValue();// 获取上传文件对象
|
||||
String fileName = mf.getOriginalFilename();// 获取文件名
|
||||
String swfName = PinyinUtil.getPinYinHeadChar(oConvertUtils.replaceBlank(FileUtils.getFilePrefix(fileName)));// 取文件名首字母作为SWF文件名
|
||||
String extend = FileUtils.getExtend(fileName);// 获取文件扩展名
|
||||
String noextfilename=DateUtils.getDataString(DateUtils.yyyymmddhhmmss)+StringUtil.random(8);//自定义文件名称
|
||||
String myfilename=noextfilename+"."+extend;//自定义文件名称
|
||||
String savePath = realPath + myfilename;// 文件保存全路径
|
||||
write2Disk(mf, extend, savePath);
|
||||
TSAttachment attachment = new TSAttachment();
|
||||
attachment.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
attachment.setAttachmenttitle(fileName);
|
||||
attachment.setCreatedate(new Timestamp(new Date().getTime()));
|
||||
attachment.setExtend(extend);
|
||||
attachment.setRealpath(path + myfilename);
|
||||
|
||||
attachment.setSwfpath( path + FileUtils.getFilePrefix(myfilename) + ".swf");
|
||||
SwfToolsUtil.convert2SWF(savePath);
|
||||
|
||||
systemService.save(attachment);
|
||||
attributes.put("url", path + myfilename);
|
||||
attributes.put("name", fileName);
|
||||
attributes.put("swfpath", attachment.getSwfpath());
|
||||
}
|
||||
}
|
||||
ajaxJson.setAttributes(attributes);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
ajaxJson.setSuccess(false);
|
||||
ajaxJson.setMsg(e.getMessage());
|
||||
}
|
||||
return ajaxJson;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存文件的具体操作
|
||||
* @param mf
|
||||
* @param extend
|
||||
* @param savePath
|
||||
* @throws IOException
|
||||
* @throws UnsupportedEncodingException
|
||||
* @throws FileNotFoundException
|
||||
*/
|
||||
private void write2Disk(MultipartFile mf, String extend, String savePath)
|
||||
throws IOException, UnsupportedEncodingException, FileNotFoundException {
|
||||
File savefile = new File(savePath);
|
||||
if("txt".equals(extend)){
|
||||
//利用utf-8字符集的固定首行隐藏编码原理
|
||||
//Unicode:FF FE UTF-8:EF BB
|
||||
byte[] allbytes = mf.getBytes();
|
||||
try{
|
||||
String head1 = toHexString(allbytes[0]);
|
||||
String head2 = toHexString(allbytes[1]);
|
||||
if("ef".equals(head1) && "bb".equals(head2)){
|
||||
//UTF-8
|
||||
String contents = new String(mf.getBytes(),"UTF-8");
|
||||
if(StringUtils.isNotBlank(contents)){
|
||||
OutputStream out = new FileOutputStream(savePath);
|
||||
out.write(contents.getBytes());
|
||||
out.close();
|
||||
}
|
||||
} else {
|
||||
//GBK
|
||||
String contents = new String(mf.getBytes(),"GBK");
|
||||
OutputStream out = new FileOutputStream(savePath);
|
||||
out.write(contents.getBytes());
|
||||
out.close();
|
||||
}
|
||||
} catch(Exception e){
|
||||
String contents = new String(mf.getBytes(),"UTF-8");
|
||||
if(StringUtils.isNotBlank(contents)){
|
||||
OutputStream out = new FileOutputStream(savePath);
|
||||
out.write(contents.getBytes());
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
FileCopyUtils.copy(mf.getBytes(), savefile);
|
||||
}
|
||||
}
|
||||
|
||||
private String toHexString(int index){
|
||||
String hexString = Integer.toHexString(index);
|
||||
// 1个byte变成16进制的,只需要2位就可以表示了,取后面两位,去掉前面的符号填充
|
||||
hexString = hexString.substring(hexString.length() -2);
|
||||
return hexString;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue