diff --git a/src/main/java/com/zzjee/wm/controller/WmPrintModelController.java b/src/main/java/com/zzjee/wm/controller/WmPrintModelController.java new file mode 100644 index 00000000..05a9f06b --- /dev/null +++ b/src/main/java/com/zzjee/wm/controller/WmPrintModelController.java @@ -0,0 +1,406 @@ +package com.zzjee.wm.controller; +import com.zzjee.wm.entity.WmPrintModelEntity; +import com.zzjee.wm.service.WmPrintModelServiceI; +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 2021-08-02 14:51:38 + * @version V1.0 + * + */ +@Controller +@RequestMapping("/wmPrintModelController") +public class WmPrintModelController extends BaseController { + /** + * Logger for this class + */ + private static final Logger logger = Logger.getLogger(WmPrintModelController.class); + + @Autowired + private WmPrintModelServiceI wmPrintModelService; + @Autowired + private SystemService systemService; + @Autowired + private Validator validator; + + + + /** + * 打印模板列表 页面跳转 + * + * @return + */ + @RequestMapping(params = "list") + public ModelAndView list(HttpServletRequest request) { + return new ModelAndView("com/zzjee/wm/wmPrintModelList"); + } + + /** + * easyui AJAX请求数据 + * + * @param request + * @param response + * @param dataGrid + * @param user + */ + + @RequestMapping(params = "datagrid") + public void datagrid(WmPrintModelEntity wmPrintModel,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { + CriteriaQuery cq = new CriteriaQuery(WmPrintModelEntity.class, dataGrid); + //查询条件组装器 + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmPrintModel, request.getParameterMap()); + try{ + //自定义追加查询条件 + }catch (Exception e) { + throw new BusinessException(e.getMessage()); + } + cq.add(); + this.wmPrintModelService.getDataGridReturn(cq, true); + TagUtil.datagrid(response, dataGrid); + } + + /** + * 删除打印模板 + * + * @return + */ + @RequestMapping(params = "doDel") + @ResponseBody + public AjaxJson doDel(WmPrintModelEntity wmPrintModel, HttpServletRequest request) { + String message = null; + AjaxJson j = new AjaxJson(); + wmPrintModel = systemService.getEntity(WmPrintModelEntity.class, wmPrintModel.getId()); + message = "打印模板删除成功"; + try{ + wmPrintModelService.delete(wmPrintModel); + 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(",")){ + WmPrintModelEntity wmPrintModel = systemService.getEntity(WmPrintModelEntity.class, + id + ); + wmPrintModelService.delete(wmPrintModel); + 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(WmPrintModelEntity wmPrintModel, HttpServletRequest request) { + String message = null; + AjaxJson j = new AjaxJson(); + message = "打印模板添加成功"; + try{ + wmPrintModelService.save(wmPrintModel); + 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(WmPrintModelEntity wmPrintModel, HttpServletRequest request) { + String message = null; + AjaxJson j = new AjaxJson(); + message = "打印模板更新成功"; + WmPrintModelEntity t = wmPrintModelService.get(WmPrintModelEntity.class, wmPrintModel.getId()); + try { + MyBeanUtils.copyBeanNotNull2Bean(wmPrintModel, t); + wmPrintModelService.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(WmPrintModelEntity wmPrintModel, HttpServletRequest req) { + if (StringUtil.isNotEmpty(wmPrintModel.getId())) { + wmPrintModel = wmPrintModelService.getEntity(WmPrintModelEntity.class, wmPrintModel.getId()); + req.setAttribute("wmPrintModelPage", wmPrintModel); + } + return new ModelAndView("com/zzjee/wm/wmPrintModel-add"); + } + /** + * 打印模板编辑页面跳转 + * + * @return + */ + @RequestMapping(params = "goUpdate") + public ModelAndView goUpdate(WmPrintModelEntity wmPrintModel, HttpServletRequest req) { + if (StringUtil.isNotEmpty(wmPrintModel.getId())) { + wmPrintModel = wmPrintModelService.getEntity(WmPrintModelEntity.class, wmPrintModel.getId()); + req.setAttribute("wmPrintModelPage", wmPrintModel); + } + return new ModelAndView("com/zzjee/wm/wmPrintModel-update"); + } + + /** + * 导入功能跳转 + * + * @return + */ + @RequestMapping(params = "upload") + public ModelAndView upload(HttpServletRequest req) { + req.setAttribute("controller_name","wmPrintModelController"); + return new ModelAndView("common/upload/pub_excel_upload"); + } + + /** + * 导出excel + * + * @param request + * @param response + */ + @RequestMapping(params = "exportXls") + public String exportXls(WmPrintModelEntity wmPrintModel,HttpServletRequest request,HttpServletResponse response + , DataGrid dataGrid,ModelMap modelMap) { + CriteriaQuery cq = new CriteriaQuery(WmPrintModelEntity.class, dataGrid); + org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmPrintModel, request.getParameterMap()); + List wmPrintModels = this.wmPrintModelService.getListByCriteriaQuery(cq,false); + modelMap.put(NormalExcelConstants.FILE_NAME,"打印模板"); + modelMap.put(NormalExcelConstants.CLASS,WmPrintModelEntity.class); + modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("打印模板列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(), + "导出信息")); + modelMap.put(NormalExcelConstants.DATA_LIST,wmPrintModels); + return NormalExcelConstants.JEECG_EXCEL_VIEW; + } + /** + * 导出excel 使模板 + * + * @param request + * @param response + */ + @RequestMapping(params = "exportXlsByT") + public String exportXlsByT(WmPrintModelEntity wmPrintModel,HttpServletRequest request,HttpServletResponse response + , DataGrid dataGrid,ModelMap modelMap) { + modelMap.put(NormalExcelConstants.FILE_NAME,"打印模板"); + modelMap.put(NormalExcelConstants.CLASS,WmPrintModelEntity.class); + modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("打印模板列表", "导出人:"+ResourceUtil.getSessionUserName().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 fileMap = multipartRequest.getFileMap(); + for (Map.Entry entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue();// 获取上传文件对象 + ImportParams params = new ImportParams(); + params.setTitleRows(2); + params.setHeadRows(1); + params.setNeedSave(true); + try { + List listWmPrintModelEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WmPrintModelEntity.class,params); + for (WmPrintModelEntity wmPrintModel : listWmPrintModelEntitys) { + wmPrintModelService.save(wmPrintModel); + } + 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 list() { + List listWmPrintModels=wmPrintModelService.getList(WmPrintModelEntity.class); + return listWmPrintModels; + } + + @RequestMapping(value = "/{id}", method = RequestMethod.GET) + @ResponseBody + public ResponseEntity get(@PathVariable("id") String id) { + WmPrintModelEntity task = wmPrintModelService.get(WmPrintModelEntity.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 WmPrintModelEntity wmPrintModel, UriComponentsBuilder uriBuilder) { + //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. + Set> failures = validator.validate(wmPrintModel); + if (!failures.isEmpty()) { + return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST); + } + + //保存 + try{ + wmPrintModelService.save(wmPrintModel); + } catch (Exception e) { + e.printStackTrace(); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + //按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象. + String id = wmPrintModel.getId(); + URI uri = uriBuilder.path("/rest/wmPrintModelController/" + 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 WmPrintModelEntity wmPrintModel) { + //调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息. + Set> failures = validator.validate(wmPrintModel); + if (!failures.isEmpty()) { + return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST); + } + + //保存 + try{ + wmPrintModelService.saveOrUpdate(wmPrintModel); + } 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) { + wmPrintModelService.deleteEntityById(WmPrintModelEntity.class, id); + } +} diff --git a/src/main/java/com/zzjee/wm/entity/WmPrintModelEntity.java b/src/main/java/com/zzjee/wm/entity/WmPrintModelEntity.java new file mode 100644 index 00000000..a8f7d54d --- /dev/null +++ b/src/main/java/com/zzjee/wm/entity/WmPrintModelEntity.java @@ -0,0 +1,384 @@ +package com.zzjee.wm.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 2021-08-02 14:51:38 + * @version V1.0 + * + */ +@Entity +@Table(name = "wm_print_model", schema = "") +@SuppressWarnings("serial") +public class WmPrintModelEntity implements java.io.Serializable { + /**主键*/ + 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; + /**用户名*/ + @Excel(name="用户名") + private String userName; + /**打印类型*/ + @Excel(name="打印类型") + private String printType; + /**打印模板*/ + @Excel(name="打印模板") + private String printModel; + /**打印服务器地址*/ + @Excel(name="打印服务器地址") + private String printServerAddress; + /**打印文件类型*/ + @Excel(name="打印文件类型") + private String printFileType; + /**备用1*/ + private String query1; + /**备用2*/ + private String query2; + /**备用3*/ + private String query3; + /**备用4*/ + private String query4; + /**备用5*/ + private String query5; + + /** + *方法: 取得java.lang.String + *@return: java.lang.String 主键 + */ + @Id + @GeneratedValue(generator = "paymentableGenerator") + @GenericGenerator(name = "paymentableGenerator", strategy = "uuid") + @Column(name ="ID",nullable=false,length=36) + public String getId(){ + return this.id; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 主键 + */ + public void setId(String id){ + this.id = id; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 创建人名称 + */ + @Column(name ="CREATE_NAME",nullable=true,length=50) + public String getCreateName(){ + return this.createName; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 创建人名称 + */ + public void setCreateName(String createName){ + this.createName = createName; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 创建人登录名称 + */ + @Column(name ="CREATE_BY",nullable=true,length=50) + public String getCreateBy(){ + return this.createBy; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 创建人登录名称 + */ + public void setCreateBy(String createBy){ + this.createBy = createBy; + } + /** + *方法: 取得java.util.Date + *@return: java.util.Date 创建日期 + */ + @Column(name ="CREATE_DATE",nullable=true,length=20) + public Date getCreateDate(){ + return this.createDate; + } + + /** + *方法: 设置java.util.Date + *@param: java.util.Date 创建日期 + */ + public void setCreateDate(Date createDate){ + this.createDate = createDate; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 更新人名称 + */ + @Column(name ="UPDATE_NAME",nullable=true,length=50) + public String getUpdateName(){ + return this.updateName; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 更新人名称 + */ + public void setUpdateName(String updateName){ + this.updateName = updateName; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 更新人登录名称 + */ + @Column(name ="UPDATE_BY",nullable=true,length=50) + public String getUpdateBy(){ + return this.updateBy; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 更新人登录名称 + */ + public void setUpdateBy(String updateBy){ + this.updateBy = updateBy; + } + /** + *方法: 取得java.util.Date + *@return: java.util.Date 更新日期 + */ + @Column(name ="UPDATE_DATE",nullable=true,length=20) + public Date getUpdateDate(){ + return this.updateDate; + } + + /** + *方法: 设置java.util.Date + *@param: java.util.Date 更新日期 + */ + public void setUpdateDate(Date updateDate){ + this.updateDate = updateDate; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 所属部门 + */ + @Column(name ="SYS_ORG_CODE",nullable=true,length=50) + public String getSysOrgCode(){ + return this.sysOrgCode; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 所属部门 + */ + public void setSysOrgCode(String sysOrgCode){ + this.sysOrgCode = sysOrgCode; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 所属公司 + */ + @Column(name ="SYS_COMPANY_CODE",nullable=true,length=50) + public String getSysCompanyCode(){ + return this.sysCompanyCode; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 所属公司 + */ + public void setSysCompanyCode(String sysCompanyCode){ + this.sysCompanyCode = sysCompanyCode; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 用户名 + */ + @Column(name ="USER_NAME",nullable=true,length=50) + public String getUserName(){ + return this.userName; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 用户名 + */ + public void setUserName(String userName){ + this.userName = userName; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 打印类型 + */ + @Column(name ="PRINT_TYPE",nullable=true,length=50) + public String getPrintType(){ + return this.printType; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 打印类型 + */ + public void setPrintType(String printType){ + this.printType = printType; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 打印模板 + */ + @Column(name ="PRINT_MODEL",nullable=true,length=50) + public String getPrintModel(){ + return this.printModel; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 打印模板 + */ + public void setPrintModel(String printModel){ + this.printModel = printModel; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 打印服务器地址 + */ + @Column(name ="PRINT_SERVER_ADDRESS",nullable=true,length=50) + public String getPrintServerAddress(){ + return this.printServerAddress; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 打印服务器地址 + */ + public void setPrintServerAddress(String printServerAddress){ + this.printServerAddress = printServerAddress; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 打印文件类型 + */ + @Column(name ="PRINT_FILE_TYPE",nullable=true,length=50) + public String getPrintFileType(){ + return this.printFileType; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 打印文件类型 + */ + public void setPrintFileType(String printFileType){ + this.printFileType = printFileType; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 备用1 + */ + @Column(name ="QUERY1",nullable=true,length=50) + public String getQuery1(){ + return this.query1; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 备用1 + */ + public void setQuery1(String query1){ + this.query1 = query1; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 备用2 + */ + @Column(name ="QUERY2",nullable=true,length=50) + public String getQuery2(){ + return this.query2; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 备用2 + */ + public void setQuery2(String query2){ + this.query2 = query2; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 备用3 + */ + @Column(name ="QUERY3",nullable=true,length=50) + public String getQuery3(){ + return this.query3; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 备用3 + */ + public void setQuery3(String query3){ + this.query3 = query3; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 备用4 + */ + @Column(name ="QUERY4",nullable=true,length=50) + public String getQuery4(){ + return this.query4; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 备用4 + */ + public void setQuery4(String query4){ + this.query4 = query4; + } + /** + *方法: 取得java.lang.String + *@return: java.lang.String 备用5 + */ + @Column(name ="QUERY5",nullable=true,length=50) + public String getQuery5(){ + return this.query5; + } + + /** + *方法: 设置java.lang.String + *@param: java.lang.String 备用5 + */ + public void setQuery5(String query5){ + this.query5 = query5; + } +} diff --git a/src/main/java/com/zzjee/wm/service/WmPrintModelServiceI.java b/src/main/java/com/zzjee/wm/service/WmPrintModelServiceI.java new file mode 100644 index 00000000..2193412c --- /dev/null +++ b/src/main/java/com/zzjee/wm/service/WmPrintModelServiceI.java @@ -0,0 +1,15 @@ +package com.zzjee.wm.service; +import com.zzjee.wm.entity.WmPrintModelEntity; +import org.jeecgframework.core.common.service.CommonService; + +import java.io.Serializable; + +public interface WmPrintModelServiceI extends CommonService{ + + public void delete(WmPrintModelEntity entity) throws Exception; + + public Serializable save(WmPrintModelEntity entity) throws Exception; + + public void saveOrUpdate(WmPrintModelEntity entity) throws Exception; + +} diff --git a/src/main/java/com/zzjee/wm/service/impl/WmPrintModelServiceImpl.java b/src/main/java/com/zzjee/wm/service/impl/WmPrintModelServiceImpl.java new file mode 100644 index 00000000..80a52831 --- /dev/null +++ b/src/main/java/com/zzjee/wm/service/impl/WmPrintModelServiceImpl.java @@ -0,0 +1,157 @@ +package com.zzjee.wm.service.impl; +import com.zzjee.wm.service.WmPrintModelServiceI; +import org.jeecgframework.core.common.service.impl.CommonServiceImpl; +import com.zzjee.wm.entity.WmPrintModelEntity; +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("wmPrintModelService") +@Transactional +public class WmPrintModelServiceImpl extends CommonServiceImpl implements WmPrintModelServiceI { + + + @Override + public void delete(WmPrintModelEntity entity) throws Exception{ + super.delete(entity); + //执行删除操作增强业务 + this.doDelBus(entity); + } + + @Override + public Serializable save(WmPrintModelEntity entity) throws Exception{ + Serializable t = super.save(entity); + //执行新增操作增强业务 + this.doAddBus(entity); + return t; + } + + @Override + public void saveOrUpdate(WmPrintModelEntity entity) throws Exception{ + super.saveOrUpdate(entity); + //执行更新操作增强业务 + this.doUpdateBus(entity); + } + + /** + * 新增操作增强业务 + * @param t + * @return + */ + private void doAddBus(WmPrintModelEntity t) throws Exception{ + //-----------------sql增强 start---------------------------- + //-----------------sql增强 end------------------------------ + + //-----------------java增强 start--------------------------- + //-----------------java增强 end----------------------------- + } + /** + * 更新操作增强业务 + * @param t + * @return + */ + private void doUpdateBus(WmPrintModelEntity t) throws Exception{ + //-----------------sql增强 start---------------------------- + //-----------------sql增强 end------------------------------ + + //-----------------java增强 start--------------------------- + //-----------------java增强 end----------------------------- + } + /** + * 删除操作增强业务 + * @param id + * @return + */ + private void doDelBus(WmPrintModelEntity t) throws Exception{ + //-----------------sql增强 start---------------------------- + //-----------------sql增强 end------------------------------ + + //-----------------java增强 start--------------------------- + //-----------------java增强 end----------------------------- + } + + private Map populationMap(WmPrintModelEntity t){ + Map map = new HashMap(); + 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("user_name", t.getUserName()); + map.put("print_type", t.getPrintType()); + map.put("print_model", t.getPrintModel()); + map.put("print_server_address", t.getPrintServerAddress()); + map.put("print_file_type", t.getPrintFileType()); + map.put("query1", t.getQuery1()); + map.put("query2", t.getQuery2()); + map.put("query3", t.getQuery3()); + map.put("query4", t.getQuery4()); + map.put("query5", t.getQuery5()); + return map; + } + + /** + * 替换sql中的变量 + * @param sql + * @param t + * @return + */ + public String replaceVal(String sql,WmPrintModelEntity 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("#{user_name}",String.valueOf(t.getUserName())); + sql = sql.replace("#{print_type}",String.valueOf(t.getPrintType())); + sql = sql.replace("#{print_model}",String.valueOf(t.getPrintModel())); + sql = sql.replace("#{print_server_address}",String.valueOf(t.getPrintServerAddress())); + sql = sql.replace("#{print_file_type}",String.valueOf(t.getPrintFileType())); + sql = sql.replace("#{query1}",String.valueOf(t.getQuery1())); + sql = sql.replace("#{query2}",String.valueOf(t.getQuery2())); + sql = sql.replace("#{query3}",String.valueOf(t.getQuery3())); + sql = sql.replace("#{query4}",String.valueOf(t.getQuery4())); + sql = sql.replace("#{query5}",String.valueOf(t.getQuery5())); + sql = sql.replace("#{UUID}",UUID.randomUUID().toString()); + return sql; + } + + /** + * 执行JAVA增强 + */ + private void executeJavaExtend(String cgJavaType,String cgJavaValue,Map 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("wm_print_model",data); + } + } catch (Exception e) { + e.printStackTrace(); + throw new Exception("执行JAVA增强出现异常!"); + } + } + } +} diff --git a/src/main/webapp/webpage/com/zzjee/md/mdavabinlist.jsp b/src/main/webapp/webpage/com/zzjee/md/mdavabinlist.jsp index 9e0ec252..d2be61d1 100644 --- a/src/main/webapp/webpage/com/zzjee/md/mdavabinlist.jsp +++ b/src/main/webapp/webpage/com/zzjee/md/mdavabinlist.jsp @@ -23,11 +23,11 @@ 行数: - + 列数: - + diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmPrintModel-add.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmPrintModel-add.jsp new file mode 100644 index 00000000..0dcaf113 --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/wm/wmPrintModel-add.jsp @@ -0,0 +1,106 @@ +<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@include file="/context/mytags.jsp"%> + + + + 打印模板 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+
+ + diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmPrintModel-update.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmPrintModel-update.jsp new file mode 100644 index 00000000..973ddf60 --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/wm/wmPrintModel-update.jsp @@ -0,0 +1,102 @@ +<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@include file="/context/mytags.jsp"%> + + + + 打印模板 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+
+ + diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmPrintModel.js b/src/main/webapp/webpage/com/zzjee/wm/wmPrintModel.js new file mode 100644 index 00000000..5ec72b64 --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/wm/wmPrintModel.js @@ -0,0 +1,32 @@ + + +//通用弹出式文件上传 +function commonUpload(callback){ + $.dialog({ + content: "url:systemController.do?commonUpload", + lock : true, + title:"文件上传", + zIndex:2100, + width:700, + height: 200, + parent:windowapi, + cache:false, + ok: function(){ + var iframe = this.iframe.contentWindow; + iframe.uploadCallback(callback); + return true; + }, + cancelVal: '关闭', + cancel: function(){ + } + }); +} +function browseImages(inputId, Img) {// 图片管理器,可多个上传共用 +} +function browseFiles(inputId, file) {// 文件管理器,可多个上传共用 +} +function decode(value, id) {//value传入值,id接受值 + var last = value.lastIndexOf("/"); + var filename = value.substring(last + 1, value.length); + $("#" + id).text(decodeURIComponent(filename)); +} \ No newline at end of file diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmPrintModelList.js b/src/main/webapp/webpage/com/zzjee/wm/wmPrintModelList.js new file mode 100644 index 00000000..e69de29b diff --git a/src/main/webapp/webpage/com/zzjee/wm/wmPrintModelList.jsp b/src/main/webapp/webpage/com/zzjee/wm/wmPrintModelList.jsp new file mode 100644 index 00000000..70e3ef1e --- /dev/null +++ b/src/main/webapp/webpage/com/zzjee/wm/wmPrintModelList.jsp @@ -0,0 +1,60 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@include file="/context/mytags.jsp"%> + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +