运费和波次设置

master
e 2020-02-01 10:03:14 +08:00
parent fcfd93d6e9
commit 1063c73dfe
8 changed files with 1800 additions and 0 deletions

View File

@ -0,0 +1,406 @@
package com.zzjee.base.controller;
import com.zzjee.base.entity.TmsYufeiConfEntity;
import com.zzjee.base.service.TmsYufeiConfServiceI;
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 2020-01-19 13:54:03
* @version V1.0
*
*/
@Controller
@RequestMapping("/tmsYufeiConfController")
public class TmsYufeiConfController extends BaseController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(TmsYufeiConfController.class);
@Autowired
private TmsYufeiConfServiceI tmsYufeiConfService;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
/**
*
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/zzjee/base/tmsYufeiConfList");
}
/**
* easyui AJAX
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(TmsYufeiConfEntity tmsYufeiConf,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(TmsYufeiConfEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tmsYufeiConf, request.getParameterMap());
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.tmsYufeiConfService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
*
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(TmsYufeiConfEntity tmsYufeiConf, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
tmsYufeiConf = systemService.getEntity(TmsYufeiConfEntity.class, tmsYufeiConf.getId());
message = "运费配置删除成功";
try{
tmsYufeiConfService.delete(tmsYufeiConf);
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(",")){
TmsYufeiConfEntity tmsYufeiConf = systemService.getEntity(TmsYufeiConfEntity.class,
id
);
tmsYufeiConfService.delete(tmsYufeiConf);
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(TmsYufeiConfEntity tmsYufeiConf, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "运费配置添加成功";
try{
tmsYufeiConfService.save(tmsYufeiConf);
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(TmsYufeiConfEntity tmsYufeiConf, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "运费配置更新成功";
TmsYufeiConfEntity t = tmsYufeiConfService.get(TmsYufeiConfEntity.class, tmsYufeiConf.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(tmsYufeiConf, t);
tmsYufeiConfService.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(TmsYufeiConfEntity tmsYufeiConf, HttpServletRequest req) {
if (StringUtil.isNotEmpty(tmsYufeiConf.getId())) {
tmsYufeiConf = tmsYufeiConfService.getEntity(TmsYufeiConfEntity.class, tmsYufeiConf.getId());
req.setAttribute("tmsYufeiConfPage", tmsYufeiConf);
}
return new ModelAndView("com/zzjee/base/tmsYufeiConf-add");
}
/**
*
*
* @return
*/
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(TmsYufeiConfEntity tmsYufeiConf, HttpServletRequest req) {
if (StringUtil.isNotEmpty(tmsYufeiConf.getId())) {
tmsYufeiConf = tmsYufeiConfService.getEntity(TmsYufeiConfEntity.class, tmsYufeiConf.getId());
req.setAttribute("tmsYufeiConfPage", tmsYufeiConf);
}
return new ModelAndView("com/zzjee/base/tmsYufeiConf-update");
}
/**
*
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","tmsYufeiConfController");
return new ModelAndView("common/upload/pub_excel_upload");
}
/**
* excel
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(TmsYufeiConfEntity tmsYufeiConf,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(TmsYufeiConfEntity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, tmsYufeiConf, request.getParameterMap());
List<TmsYufeiConfEntity> tmsYufeiConfs = this.tmsYufeiConfService.getListByCriteriaQuery(cq,false);
modelMap.put(NormalExcelConstants.FILE_NAME,"运费配置");
modelMap.put(NormalExcelConstants.CLASS,TmsYufeiConfEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("运费配置列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,tmsYufeiConfs);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(TmsYufeiConfEntity tmsYufeiConf,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"运费配置");
modelMap.put(NormalExcelConstants.CLASS,TmsYufeiConfEntity.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<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<TmsYufeiConfEntity> listTmsYufeiConfEntitys = ExcelImportUtil.importExcel(file.getInputStream(),TmsYufeiConfEntity.class,params);
for (TmsYufeiConfEntity tmsYufeiConf : listTmsYufeiConfEntitys) {
tmsYufeiConfService.save(tmsYufeiConf);
}
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<TmsYufeiConfEntity> list() {
List<TmsYufeiConfEntity> listTmsYufeiConfs=tmsYufeiConfService.getList(TmsYufeiConfEntity.class);
return listTmsYufeiConfs;
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<?> get(@PathVariable("id") String id) {
TmsYufeiConfEntity task = tmsYufeiConfService.get(TmsYufeiConfEntity.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 TmsYufeiConfEntity tmsYufeiConf, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<TmsYufeiConfEntity>> failures = validator.validate(tmsYufeiConf);
if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
}
//保存
try{
tmsYufeiConfService.save(tmsYufeiConf);
} catch (Exception e) {
e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
//按照Restful风格约定创建指向新任务的url, 也可以直接返回id或对象.
String id = tmsYufeiConf.getId();
URI uri = uriBuilder.path("/rest/tmsYufeiConfController/" + 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 TmsYufeiConfEntity tmsYufeiConf) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<TmsYufeiConfEntity>> failures = validator.validate(tmsYufeiConf);
if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
}
//保存
try{
tmsYufeiConfService.saveOrUpdate(tmsYufeiConf);
} 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) {
tmsYufeiConfService.deleteEntityById(TmsYufeiConfEntity.class, id);
}
}

View File

@ -0,0 +1,406 @@
package com.zzjee.base.controller;
import com.zzjee.base.entity.WmsWaveConfEntity;
import com.zzjee.base.service.WmsWaveConfServiceI;
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 2020-01-19 13:54:14
* @version V1.0
*
*/
@Controller
@RequestMapping("/wmsWaveConfController")
public class WmsWaveConfController extends BaseController {
/**
* Logger for this class
*/
private static final Logger logger = Logger.getLogger(WmsWaveConfController.class);
@Autowired
private WmsWaveConfServiceI wmsWaveConfService;
@Autowired
private SystemService systemService;
@Autowired
private Validator validator;
/**
*
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/zzjee/base/wmsWaveConfList");
}
/**
* easyui AJAX
*
* @param request
* @param response
* @param dataGrid
* @param user
*/
@RequestMapping(params = "datagrid")
public void datagrid(WmsWaveConfEntity wmsWaveConf,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmsWaveConfEntity.class, dataGrid);
//查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmsWaveConf, request.getParameterMap());
try{
//自定义追加查询条件
}catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.wmsWaveConfService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
/**
*
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(WmsWaveConfEntity wmsWaveConf, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
wmsWaveConf = systemService.getEntity(WmsWaveConfEntity.class, wmsWaveConf.getId());
message = "波次配置删除成功";
try{
wmsWaveConfService.delete(wmsWaveConf);
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(",")){
WmsWaveConfEntity wmsWaveConf = systemService.getEntity(WmsWaveConfEntity.class,
id
);
wmsWaveConfService.delete(wmsWaveConf);
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(WmsWaveConfEntity wmsWaveConf, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "波次配置添加成功";
try{
wmsWaveConfService.save(wmsWaveConf);
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(WmsWaveConfEntity wmsWaveConf, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "波次配置更新成功";
WmsWaveConfEntity t = wmsWaveConfService.get(WmsWaveConfEntity.class, wmsWaveConf.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(wmsWaveConf, t);
wmsWaveConfService.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(WmsWaveConfEntity wmsWaveConf, HttpServletRequest req) {
if (StringUtil.isNotEmpty(wmsWaveConf.getId())) {
wmsWaveConf = wmsWaveConfService.getEntity(WmsWaveConfEntity.class, wmsWaveConf.getId());
req.setAttribute("wmsWaveConfPage", wmsWaveConf);
}
return new ModelAndView("com/zzjee/base/wmsWaveConf-add");
}
/**
*
*
* @return
*/
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(WmsWaveConfEntity wmsWaveConf, HttpServletRequest req) {
if (StringUtil.isNotEmpty(wmsWaveConf.getId())) {
wmsWaveConf = wmsWaveConfService.getEntity(WmsWaveConfEntity.class, wmsWaveConf.getId());
req.setAttribute("wmsWaveConfPage", wmsWaveConf);
}
return new ModelAndView("com/zzjee/base/wmsWaveConf-update");
}
/**
*
*
* @return
*/
@RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","wmsWaveConfController");
return new ModelAndView("common/upload/pub_excel_upload");
}
/**
* excel
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXls")
public String exportXls(WmsWaveConfEntity wmsWaveConf,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(WmsWaveConfEntity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmsWaveConf, request.getParameterMap());
List<WmsWaveConfEntity> wmsWaveConfs = this.wmsWaveConfService.getListByCriteriaQuery(cq,false);
modelMap.put(NormalExcelConstants.FILE_NAME,"波次配置");
modelMap.put(NormalExcelConstants.CLASS,WmsWaveConfEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("波次配置列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,wmsWaveConfs);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(WmsWaveConfEntity wmsWaveConf,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"波次配置");
modelMap.put(NormalExcelConstants.CLASS,WmsWaveConfEntity.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<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<WmsWaveConfEntity> listWmsWaveConfEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WmsWaveConfEntity.class,params);
for (WmsWaveConfEntity wmsWaveConf : listWmsWaveConfEntitys) {
wmsWaveConfService.save(wmsWaveConf);
}
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<WmsWaveConfEntity> list() {
List<WmsWaveConfEntity> listWmsWaveConfs=wmsWaveConfService.getList(WmsWaveConfEntity.class);
return listWmsWaveConfs;
}
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<?> get(@PathVariable("id") String id) {
WmsWaveConfEntity task = wmsWaveConfService.get(WmsWaveConfEntity.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 WmsWaveConfEntity wmsWaveConf, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<WmsWaveConfEntity>> failures = validator.validate(wmsWaveConf);
if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
}
//保存
try{
wmsWaveConfService.save(wmsWaveConf);
} catch (Exception e) {
e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
//按照Restful风格约定创建指向新任务的url, 也可以直接返回id或对象.
String id = wmsWaveConf.getId();
URI uri = uriBuilder.path("/rest/wmsWaveConfController/" + 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 WmsWaveConfEntity wmsWaveConf) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<WmsWaveConfEntity>> failures = validator.validate(wmsWaveConf);
if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
}
//保存
try{
wmsWaveConfService.saveOrUpdate(wmsWaveConf);
} 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) {
wmsWaveConfService.deleteEntityById(WmsWaveConfEntity.class, id);
}
}

View File

@ -0,0 +1,350 @@
package com.zzjee.base.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 2020-01-19 13:54:03
* @version V1.0
*
*/
@Entity
@Table(name = "tms_yufei_conf", schema = "")
@SuppressWarnings("serial")
public class TmsYufeiConfEntity implements java.io.Serializable {
/**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;
/**配送点*/
@Excel(name="配送点")
private String peisondian;
/**运费类型*/
@Excel(name="运费类型")
private String yfType;
/**运费名称*/
@Excel(name="运费名称")
private String yfTypeName;
/**运费单价*/
@Excel(name="运费单价")
private String yfPrice;
/**备注1*/
@Excel(name="备注1")
private String yfBz1;
/**备注2*/
@Excel(name="备注2")
private String yfBz2;
/**备注3*/
@Excel(name="备注3")
private String yfBz3;
/**
*: java.lang.String
*@return: java.lang.String id
*/
@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 id
*/
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)
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)
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 ="BPM_STATUS",nullable=true,length=32)
public String getBpmStatus(){
return this.bpmStatus;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setBpmStatus(String bpmStatus){
this.bpmStatus = bpmStatus;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="PEISONDIAN",nullable=true,length=32)
public String getPeisondian(){
return this.peisondian;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setPeisondian(String peisondian){
this.peisondian = peisondian;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="YF_TYPE",nullable=true,length=32)
public String getYfType(){
return this.yfType;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setYfType(String yfType){
this.yfType = yfType;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="YF_TYPE_NAME",nullable=true,length=32)
public String getYfTypeName(){
return this.yfTypeName;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setYfTypeName(String yfTypeName){
this.yfTypeName = yfTypeName;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="YF_PRICE",nullable=true,length=32)
public String getYfPrice(){
return this.yfPrice;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setYfPrice(String yfPrice){
this.yfPrice = yfPrice;
}
/**
*: java.lang.String
*@return: java.lang.String 1
*/
@Column(name ="YF_BZ1",nullable=true,length=32)
public String getYfBz1(){
return this.yfBz1;
}
/**
*: java.lang.String
*@param: java.lang.String 1
*/
public void setYfBz1(String yfBz1){
this.yfBz1 = yfBz1;
}
/**
*: java.lang.String
*@return: java.lang.String 2
*/
@Column(name ="YF_BZ2",nullable=true,length=32)
public String getYfBz2(){
return this.yfBz2;
}
/**
*: java.lang.String
*@param: java.lang.String 2
*/
public void setYfBz2(String yfBz2){
this.yfBz2 = yfBz2;
}
/**
*: java.lang.String
*@return: java.lang.String 3
*/
@Column(name ="YF_BZ3",nullable=true,length=32)
public String getYfBz3(){
return this.yfBz3;
}
/**
*: java.lang.String
*@param: java.lang.String 3
*/
public void setYfBz3(String yfBz3){
this.yfBz3 = yfBz3;
}
}

View File

@ -0,0 +1,312 @@
package com.zzjee.base.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 2020-01-19 13:54:14
* @version V1.0
*
*/
@Entity
@Table(name = "wms_wave_conf", schema = "")
@SuppressWarnings("serial")
public class WmsWaveConfEntity 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;
/**流程状态*/
private String bpmStatus;
/**配送点*/
@Excel(name="配送点")
private String peisondian;
/**波次类型*/
@Excel(name="波次类型")
private String waveType;
/**备用1*/
@Excel(name="备用1")
private String wvBy1;
/**备用2*/
@Excel(name="备用2")
private String wvBy2;
/**备用3*/
@Excel(name="备用3")
private String wvBy3;
/**
*: 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 ="BPM_STATUS",nullable=true,length=32)
public String getBpmStatus(){
return this.bpmStatus;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setBpmStatus(String bpmStatus){
this.bpmStatus = bpmStatus;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="PEISONDIAN",nullable=true,length=32)
public String getPeisondian(){
return this.peisondian;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setPeisondian(String peisondian){
this.peisondian = peisondian;
}
/**
*: java.lang.String
*@return: java.lang.String
*/
@Column(name ="WAVE_TYPE",nullable=true,length=32)
public String getWaveType(){
return this.waveType;
}
/**
*: java.lang.String
*@param: java.lang.String
*/
public void setWaveType(String waveType){
this.waveType = waveType;
}
/**
*: java.lang.String
*@return: java.lang.String 1
*/
@Column(name ="WV_BY1",nullable=true,length=32)
public String getWvBy1(){
return this.wvBy1;
}
/**
*: java.lang.String
*@param: java.lang.String 1
*/
public void setWvBy1(String wvBy1){
this.wvBy1 = wvBy1;
}
/**
*: java.lang.String
*@return: java.lang.String 2
*/
@Column(name ="WV_BY2",nullable=true,length=32)
public String getWvBy2(){
return this.wvBy2;
}
/**
*: java.lang.String
*@param: java.lang.String 2
*/
public void setWvBy2(String wvBy2){
this.wvBy2 = wvBy2;
}
/**
*: java.lang.String
*@return: java.lang.String 3
*/
@Column(name ="WV_BY3",nullable=true,length=32)
public String getWvBy3(){
return this.wvBy3;
}
/**
*: java.lang.String
*@param: java.lang.String 3
*/
public void setWvBy3(String wvBy3){
this.wvBy3 = wvBy3;
}
}

View File

@ -0,0 +1,15 @@
package com.zzjee.base.service;
import com.zzjee.base.entity.TmsYufeiConfEntity;
import org.jeecgframework.core.common.service.CommonService;
import java.io.Serializable;
public interface TmsYufeiConfServiceI extends CommonService{
public void delete(TmsYufeiConfEntity entity) throws Exception;
public Serializable save(TmsYufeiConfEntity entity) throws Exception;
public void saveOrUpdate(TmsYufeiConfEntity entity) throws Exception;
}

View File

@ -0,0 +1,15 @@
package com.zzjee.base.service;
import com.zzjee.base.entity.WmsWaveConfEntity;
import org.jeecgframework.core.common.service.CommonService;
import java.io.Serializable;
public interface WmsWaveConfServiceI extends CommonService{
public void delete(WmsWaveConfEntity entity) throws Exception;
public Serializable save(WmsWaveConfEntity entity) throws Exception;
public void saveOrUpdate(WmsWaveConfEntity entity) throws Exception;
}

View File

@ -0,0 +1,150 @@
package com.zzjee.base.service.impl;
import com.zzjee.base.service.TmsYufeiConfServiceI;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import com.zzjee.base.entity.TmsYufeiConfEntity;
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("tmsYufeiConfService")
@Transactional
public class TmsYufeiConfServiceImpl extends CommonServiceImpl implements TmsYufeiConfServiceI {
public void delete(TmsYufeiConfEntity entity) throws Exception{
super.delete(entity);
//执行删除操作增强业务
this.doDelBus(entity);
}
public Serializable save(TmsYufeiConfEntity entity) throws Exception{
Serializable t = super.save(entity);
//执行新增操作增强业务
this.doAddBus(entity);
return t;
}
public void saveOrUpdate(TmsYufeiConfEntity entity) throws Exception{
super.saveOrUpdate(entity);
//执行更新操作增强业务
this.doUpdateBus(entity);
}
/**
*
* @param t
* @return
*/
private void doAddBus(TmsYufeiConfEntity t) throws Exception{
//-----------------sql增强 start----------------------------
//-----------------sql增强 end------------------------------
//-----------------java增强 start---------------------------
//-----------------java增强 end-----------------------------
}
/**
*
* @param t
* @return
*/
private void doUpdateBus(TmsYufeiConfEntity t) throws Exception{
//-----------------sql增强 start----------------------------
//-----------------sql增强 end------------------------------
//-----------------java增强 start---------------------------
//-----------------java增强 end-----------------------------
}
/**
*
* @param id
* @return
*/
private void doDelBus(TmsYufeiConfEntity t) throws Exception{
//-----------------sql增强 start----------------------------
//-----------------sql增强 end------------------------------
//-----------------java增强 start---------------------------
//-----------------java增强 end-----------------------------
}
private Map<String,Object> populationMap(TmsYufeiConfEntity 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("peisondian", t.getPeisondian());
map.put("yf_type", t.getYfType());
map.put("yf_type_name", t.getYfTypeName());
map.put("yf_price", t.getYfPrice());
map.put("yf_bz1", t.getYfBz1());
map.put("yf_bz2", t.getYfBz2());
map.put("yf_bz3", t.getYfBz3());
return map;
}
/**
* sql
* @param sql
* @param t
* @return
*/
public String replaceVal(String sql,TmsYufeiConfEntity 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("#{peisondian}",String.valueOf(t.getPeisondian()));
sql = sql.replace("#{yf_type}",String.valueOf(t.getYfType()));
sql = sql.replace("#{yf_type_name}",String.valueOf(t.getYfTypeName()));
sql = sql.replace("#{yf_price}",String.valueOf(t.getYfPrice()));
sql = sql.replace("#{yf_bz1}",String.valueOf(t.getYfBz1()));
sql = sql.replace("#{yf_bz2}",String.valueOf(t.getYfBz2()));
sql = sql.replace("#{yf_bz3}",String.valueOf(t.getYfBz3()));
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("tms_yufei_conf",data);
}
} catch (Exception e) {
e.printStackTrace();
throw new Exception("执行JAVA增强出现异常");
}
}
}
}

View File

@ -0,0 +1,146 @@
package com.zzjee.base.service.impl;
import com.zzjee.base.service.WmsWaveConfServiceI;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import com.zzjee.base.entity.WmsWaveConfEntity;
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("wmsWaveConfService")
@Transactional
public class WmsWaveConfServiceImpl extends CommonServiceImpl implements WmsWaveConfServiceI {
public void delete(WmsWaveConfEntity entity) throws Exception{
super.delete(entity);
//执行删除操作增强业务
this.doDelBus(entity);
}
public Serializable save(WmsWaveConfEntity entity) throws Exception{
Serializable t = super.save(entity);
//执行新增操作增强业务
this.doAddBus(entity);
return t;
}
public void saveOrUpdate(WmsWaveConfEntity entity) throws Exception{
super.saveOrUpdate(entity);
//执行更新操作增强业务
this.doUpdateBus(entity);
}
/**
*
* @param t
* @return
*/
private void doAddBus(WmsWaveConfEntity t) throws Exception{
//-----------------sql增强 start----------------------------
//-----------------sql增强 end------------------------------
//-----------------java增强 start---------------------------
//-----------------java增强 end-----------------------------
}
/**
*
* @param t
* @return
*/
private void doUpdateBus(WmsWaveConfEntity t) throws Exception{
//-----------------sql增强 start----------------------------
//-----------------sql增强 end------------------------------
//-----------------java增强 start---------------------------
//-----------------java增强 end-----------------------------
}
/**
*
* @param id
* @return
*/
private void doDelBus(WmsWaveConfEntity t) throws Exception{
//-----------------sql增强 start----------------------------
//-----------------sql增强 end------------------------------
//-----------------java增强 start---------------------------
//-----------------java增强 end-----------------------------
}
private Map<String,Object> populationMap(WmsWaveConfEntity 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("peisondian", t.getPeisondian());
map.put("wave_type", t.getWaveType());
map.put("wv_by1", t.getWvBy1());
map.put("wv_by2", t.getWvBy2());
map.put("wv_by3", t.getWvBy3());
return map;
}
/**
* sql
* @param sql
* @param t
* @return
*/
public String replaceVal(String sql,WmsWaveConfEntity 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("#{peisondian}",String.valueOf(t.getPeisondian()));
sql = sql.replace("#{wave_type}",String.valueOf(t.getWaveType()));
sql = sql.replace("#{wv_by1}",String.valueOf(t.getWvBy1()));
sql = sql.replace("#{wv_by2}",String.valueOf(t.getWvBy2()));
sql = sql.replace("#{wv_by3}",String.valueOf(t.getWvBy3()));
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("wms_wave_conf",data);
}
} catch (Exception e) {
e.printStackTrace();
throw new Exception("执行JAVA增强出现异常");
}
}
}
}