代码格式化
parent
afb16e4b22
commit
37412fb518
|
@ -1,8 +1,10 @@
|
|||
package com.zzjee.wmapi.controller;
|
||||
|
||||
import com.zzjee.api.ResultDO;
|
||||
import com.zzjee.wmapi.entity.WvGiEntity;
|
||||
import com.zzjee.wmapi.entity.WvGiNoticeEntity;
|
||||
import com.zzjee.wmapi.service.WvGiServiceI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
@ -31,6 +33,7 @@ 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;
|
||||
|
@ -41,12 +44,15 @@ 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.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;
|
||||
|
@ -57,405 +63,407 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|||
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;
|
||||
|
||||
/**
|
||||
* @author erzhongxmu
|
||||
* @version V1.0
|
||||
* @Title: Controller
|
||||
* @Description: wv_gi
|
||||
* @author erzhongxmu
|
||||
* @date 2018-05-30 20:21:50
|
||||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/wvGiController")
|
||||
public class WvGiController extends BaseController {
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(WvGiController.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(WvGiController.class);
|
||||
|
||||
@Autowired
|
||||
private WvGiServiceI wvGiService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
@Autowired
|
||||
private WvGiServiceI wvGiService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
|
||||
/**
|
||||
* wv_gi列表 页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "list")
|
||||
public ModelAndView list(HttpServletRequest request) {
|
||||
return new ModelAndView("com/zzjee/wmapi/wvGiList");
|
||||
}
|
||||
|
||||
/**
|
||||
* wv_gi列表 页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "list")
|
||||
public ModelAndView list(HttpServletRequest request) {
|
||||
return new ModelAndView("com/zzjee/wmapi/wvGiList");
|
||||
}
|
||||
/**
|
||||
* easyui AJAX请求数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param dataGrid
|
||||
* @param user
|
||||
*/
|
||||
|
||||
/**
|
||||
* easyui AJAX请求数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param dataGrid
|
||||
* @param user
|
||||
*/
|
||||
@RequestMapping(params = "datagrid")
|
||||
public void datagrid(WvGiEntity wvGi, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
|
||||
CriteriaQuery cq = new CriteriaQuery(WvGiEntity.class, dataGrid);
|
||||
//查询条件组装器
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvGi, request.getParameterMap());
|
||||
try {
|
||||
//自定义追加查询条件
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
cq.add();
|
||||
this.wvGiService.getDataGridReturn(cq, true);
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
}
|
||||
|
||||
@RequestMapping(params = "datagrid")
|
||||
public void datagrid(WvGiEntity wvGi,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
|
||||
CriteriaQuery cq = new CriteriaQuery(WvGiEntity.class, dataGrid);
|
||||
//查询条件组装器
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvGi, request.getParameterMap());
|
||||
try{
|
||||
//自定义追加查询条件
|
||||
}catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
cq.add();
|
||||
this.wvGiService.getDataGridReturn(cq, true);
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
}
|
||||
/**
|
||||
* 删除wv_gi
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(WvGiEntity wvGi, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
wvGi = systemService.getEntity(WvGiEntity.class, wvGi.getId());
|
||||
message = "wv_gi删除成功";
|
||||
try {
|
||||
wvGiService.delete(wvGi);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_gi删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除wv_gi
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(WvGiEntity wvGi, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
wvGi = systemService.getEntity(WvGiEntity.class, wvGi.getId());
|
||||
message = "wv_gi删除成功";
|
||||
try{
|
||||
wvGiService.delete(wvGi);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "wv_gi删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除wv_gi
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doBatchDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_gi删除成功";
|
||||
try{
|
||||
for(String id:ids.split(",")){
|
||||
WvGiEntity wvGi = systemService.getEntity(WvGiEntity.class,
|
||||
id
|
||||
);
|
||||
wvGiService.delete(wvGi);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "wv_gi删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
* 批量删除wv_gi
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doBatchDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_gi删除成功";
|
||||
try {
|
||||
for (String id : ids.split(",")) {
|
||||
WvGiEntity wvGi = systemService.getEntity(WvGiEntity.class,
|
||||
id
|
||||
);
|
||||
wvGiService.delete(wvGi);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_gi删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加wv_gi
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doAdd")
|
||||
@ResponseBody
|
||||
public AjaxJson doAdd(WvGiEntity wvGi, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_gi添加成功";
|
||||
try{
|
||||
wvGiService.save(wvGi);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "wv_gi添加失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
* 添加wv_gi
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doAdd")
|
||||
@ResponseBody
|
||||
public AjaxJson doAdd(WvGiEntity wvGi, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_gi添加成功";
|
||||
try {
|
||||
wvGiService.save(wvGi);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_gi添加失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新wv_gi
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson doUpdate(WvGiEntity wvGi, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_gi更新成功";
|
||||
WvGiEntity t = wvGiService.get(WvGiEntity.class, wvGi.getId());
|
||||
try {
|
||||
MyBeanUtils.copyBeanNotNull2Bean(wvGi, t);
|
||||
wvGiService.saveOrUpdate(t);
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_gi更新失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
* 更新wv_gi
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson doUpdate(WvGiEntity wvGi, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_gi更新成功";
|
||||
WvGiEntity t = wvGiService.get(WvGiEntity.class, wvGi.getId());
|
||||
try {
|
||||
MyBeanUtils.copyBeanNotNull2Bean(wvGi, t);
|
||||
wvGiService.saveOrUpdate(t);
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_gi更新失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wv_gi新增页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goAdd")
|
||||
public ModelAndView goAdd(WvGiEntity wvGi, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(wvGi.getId())) {
|
||||
wvGi = wvGiService.getEntity(WvGiEntity.class, wvGi.getId());
|
||||
req.setAttribute("wvGiPage", wvGi);
|
||||
}
|
||||
return new ModelAndView("com/zzjee/wmapi/wvGi-add");
|
||||
}
|
||||
/**
|
||||
* wv_gi编辑页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goUpdate")
|
||||
public ModelAndView goUpdate(WvGiEntity wvGi, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(wvGi.getId())) {
|
||||
wvGi = wvGiService.getEntity(WvGiEntity.class, wvGi.getId());
|
||||
req.setAttribute("wvGiPage", wvGi);
|
||||
}
|
||||
return new ModelAndView("com/zzjee/wmapi/wvGi-update");
|
||||
}
|
||||
/**
|
||||
* wv_gi新增页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goAdd")
|
||||
public ModelAndView goAdd(WvGiEntity wvGi, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(wvGi.getId())) {
|
||||
wvGi = wvGiService.getEntity(WvGiEntity.class, wvGi.getId());
|
||||
req.setAttribute("wvGiPage", wvGi);
|
||||
}
|
||||
return new ModelAndView("com/zzjee/wmapi/wvGi-add");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入功能跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "upload")
|
||||
public ModelAndView upload(HttpServletRequest req) {
|
||||
req.setAttribute("controller_name","wvGiController");
|
||||
return new ModelAndView("common/upload/pub_excel_upload");
|
||||
}
|
||||
/**
|
||||
* wv_gi编辑页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goUpdate")
|
||||
public ModelAndView goUpdate(WvGiEntity wvGi, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(wvGi.getId())) {
|
||||
wvGi = wvGiService.getEntity(WvGiEntity.class, wvGi.getId());
|
||||
req.setAttribute("wvGiPage", wvGi);
|
||||
}
|
||||
return new ModelAndView("com/zzjee/wmapi/wvGi-update");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXls")
|
||||
public String exportXls(WvGiEntity wvGi,HttpServletRequest request,HttpServletResponse response
|
||||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
CriteriaQuery cq = new CriteriaQuery(WvGiEntity.class, dataGrid);
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvGi, request.getParameterMap());
|
||||
List<WvGiEntity> wvGis = this.wvGiService.getListByCriteriaQuery(cq,false);
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"wv_gi");
|
||||
modelMap.put(NormalExcelConstants.CLASS,WvGiEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("wv_gi列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,wvGis);
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
/**
|
||||
* 导出excel 使模板
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXlsByT")
|
||||
public String exportXlsByT(WvGiEntity wvGi,HttpServletRequest request,HttpServletResponse response
|
||||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"wv_gi");
|
||||
modelMap.put(NormalExcelConstants.CLASS,WvGiEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("wv_gi列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
/**
|
||||
* 导入功能跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "upload")
|
||||
public ModelAndView upload(HttpServletRequest req) {
|
||||
req.setAttribute("controller_name", "wvGiController");
|
||||
return new ModelAndView("common/upload/pub_excel_upload");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
AjaxJson j = new AjaxJson();
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXls")
|
||||
public String exportXls(WvGiEntity wvGi, HttpServletRequest request, HttpServletResponse response
|
||||
, DataGrid dataGrid, ModelMap modelMap) {
|
||||
CriteriaQuery cq = new CriteriaQuery(WvGiEntity.class, dataGrid);
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvGi, request.getParameterMap());
|
||||
List<WvGiEntity> wvGis = this.wvGiService.getListByCriteriaQuery(cq, false);
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME, "wv_gi");
|
||||
modelMap.put(NormalExcelConstants.CLASS, WvGiEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("wv_gi列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST, wvGis);
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
|
||||
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<WvGiEntity> listWvGiEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WvGiEntity.class,params);
|
||||
for (WvGiEntity wvGi : listWvGiEntitys) {
|
||||
wvGiService.save(wvGi);
|
||||
}
|
||||
j.setMsg("文件导入成功!");
|
||||
} catch (Exception e) {
|
||||
j.setMsg("文件导入失败!");
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}finally{
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
* 导出excel 使模板
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXlsByT")
|
||||
public String exportXlsByT(WvGiEntity wvGi, HttpServletRequest request, HttpServletResponse response
|
||||
, DataGrid dataGrid, ModelMap modelMap) {
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME, "wv_gi");
|
||||
modelMap.put(NormalExcelConstants.CLASS, WvGiEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("wv_gi列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST, new ArrayList());
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> list( @RequestParam(value="username", required=false) String username, @RequestParam(value="searchstr", required=false)String searchstr, @RequestParam(value="searchstr2", required=false)String searchstr2) {
|
||||
@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<WvGiEntity> listWvGiEntitys = ExcelImportUtil.importExcel(file.getInputStream(), WvGiEntity.class, params);
|
||||
for (WvGiEntity wvGi : listWvGiEntitys) {
|
||||
wvGiService.save(wvGi);
|
||||
}
|
||||
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 ResponseEntity<?> list(@RequestParam(value = "username", required = false) String username, @RequestParam(value = "searchstr", required = false) String searchstr, @RequestParam(value = "searchstr2", required = false) String searchstr2) {
|
||||
// return listWvGis;
|
||||
|
||||
|
||||
ResultDO D0 = new ResultDO();
|
||||
String hql = " from WvGiEntity where downSta is null ";
|
||||
D0.setOK(true);
|
||||
if(!StringUtil.isEmpty(searchstr)) {
|
||||
hql=hql+" and orderId = '" + searchstr + "'";
|
||||
}
|
||||
if(!StringUtil.isEmpty(searchstr2)) {
|
||||
try{
|
||||
String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2);
|
||||
if(StringUtil.isNotEmpty(shpbianma)){
|
||||
searchstr2=shpbianma;
|
||||
}
|
||||
}catch (Exception e){
|
||||
ResultDO D0 = new ResultDO();
|
||||
String hql = " from WvGiEntity where downSta is null ";
|
||||
D0.setOK(true);
|
||||
if (!StringUtil.isEmpty(searchstr)) {
|
||||
hql = hql + " and orderId = '" + searchstr + "'";
|
||||
}
|
||||
if (!StringUtil.isEmpty(searchstr2)) {
|
||||
try {
|
||||
String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2);
|
||||
if (StringUtil.isNotEmpty(shpbianma)) {
|
||||
searchstr2 = shpbianma;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// hql=hql+" and goodsId = '" + searchstr2 + "'";
|
||||
String[] ss = searchstr2.split(",");
|
||||
if (ss.length == 1) {
|
||||
hql = hql + " and goodsId = '" + searchstr2 + "'";
|
||||
String[] ss = searchstr2.split(",");
|
||||
if (ss.length == 1) {
|
||||
hql = hql + " and goodsId = '" + searchstr2 + "'";
|
||||
|
||||
} else {
|
||||
String insearch = "";
|
||||
for (String s : ss) {
|
||||
if (StringUtil.isNotEmpty(insearch)) {
|
||||
insearch = insearch + " or goodsId = '" + s + "'";
|
||||
} else {
|
||||
insearch = "goodsId = '" + s + "'";
|
||||
}
|
||||
} else {
|
||||
String insearch = "";
|
||||
for (String s : ss) {
|
||||
if (StringUtil.isNotEmpty(insearch)) {
|
||||
insearch = insearch + " or goodsId = '" + s + "'";
|
||||
} else {
|
||||
insearch = "goodsId = '" + s + "'";
|
||||
}
|
||||
|
||||
}
|
||||
hql = hql + " and (" + insearch + ")";
|
||||
}
|
||||
hql = hql + " and (" + insearch + ")";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<WvGiEntity> listWvGis=wvGiService.findHql(hql);
|
||||
List<WvGiEntity> listWvGis = wvGiService.findHql(hql);
|
||||
|
||||
// List<WvGiEntity> listWvGis=wvGiService.getList(WvGiEntity.class);
|
||||
D0.setOK(true);
|
||||
List<WvGiEntity> result = new ArrayList<WvGiEntity>();
|
||||
int i = 0;
|
||||
for (WvGiEntity t :listWvGis){
|
||||
D0.setOK(true);
|
||||
List<WvGiEntity> result = new ArrayList<WvGiEntity>();
|
||||
int i = 0;
|
||||
for (WvGiEntity t : listWvGis) {
|
||||
|
||||
i++;
|
||||
if(i>100){
|
||||
break;
|
||||
}
|
||||
result.add(t);
|
||||
}
|
||||
i++;
|
||||
if (i > 100) {
|
||||
break;
|
||||
}
|
||||
result.add(t);
|
||||
}
|
||||
|
||||
D0.setObj(result);
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
D0.setObj(result);
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> get(@PathVariable("id") String id) {
|
||||
WvGiEntity task = wvGiService.get(WvGiEntity.class, id);
|
||||
if (task == null) {
|
||||
return new ResponseEntity(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return new ResponseEntity(task, HttpStatus.OK);
|
||||
}
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> get(@PathVariable("id") String id) {
|
||||
WvGiEntity task = wvGiService.get(WvGiEntity.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 WvGiEntity wvGi, UriComponentsBuilder uriBuilder) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WvGiEntity>> failures = validator.validate(wvGi);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> create(@RequestBody WvGiEntity wvGi, UriComponentsBuilder uriBuilder) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WvGiEntity>> failures = validator.validate(wvGi);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
//保存
|
||||
try{
|
||||
wvGiService.save(wvGi);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
//按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象.
|
||||
String id = wvGi.getId();
|
||||
URI uri = uriBuilder.path("/rest/wvGiController/" + id).build().toUri();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setLocation(uri);
|
||||
//保存
|
||||
try {
|
||||
wvGiService.save(wvGi);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
//按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象.
|
||||
String id = wvGi.getId();
|
||||
URI uri = uriBuilder.path("/rest/wvGiController/" + id).build().toUri();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setLocation(uri);
|
||||
|
||||
return new ResponseEntity(headers, HttpStatus.CREATED);
|
||||
}
|
||||
return new ResponseEntity(headers, HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<?> update(@RequestBody WvGiEntity wvGi) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WvGiEntity>> failures = validator.validate(wvGi);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<?> update(@RequestBody WvGiEntity wvGi) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WvGiEntity>> failures = validator.validate(wvGi);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
//保存
|
||||
try{
|
||||
wvGiService.saveOrUpdate(wvGi);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
//保存
|
||||
try {
|
||||
wvGiService.saveOrUpdate(wvGi);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
//按Restful约定,返回204状态码, 无内容. 也可以返回200状态码.
|
||||
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) {
|
||||
wvGiService.deleteEntityById(WvGiEntity.class, id);
|
||||
}
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
public void delete(@PathVariable("id") String id) {
|
||||
wvGiService.deleteEntityById(WvGiEntity.class, id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
package com.zzjee.wmapi.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
|
@ -55,442 +56,443 @@ import com.zzjee.wmapi.service.WvGiNoticeServiceI;
|
|||
import com.zzjee.wmutil.wmUtil;
|
||||
|
||||
/**
|
||||
* @author erzhongxmu
|
||||
* @version V1.0
|
||||
* @Title: Controller
|
||||
* @Description: wv_gi_notice
|
||||
* @author erzhongxmu
|
||||
* @date 2018-05-30 20:20:38
|
||||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/wvGiNoticeController")
|
||||
public class WvGiNoticeController extends BaseController {
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(WvGiNoticeController.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(WvGiNoticeController.class);
|
||||
|
||||
@Autowired
|
||||
private WvGiNoticeServiceI wvGiNoticeService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
@Autowired
|
||||
private WvGiNoticeServiceI wvGiNoticeService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
|
||||
/**
|
||||
* wv_gi_notice列表 页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "list")
|
||||
public ModelAndView list(HttpServletRequest request) {
|
||||
return new ModelAndView("com/zzjee/wmapi/wvGiNoticeList");
|
||||
}
|
||||
|
||||
/**
|
||||
* wv_gi_notice列表 页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "list")
|
||||
public ModelAndView list(HttpServletRequest request) {
|
||||
return new ModelAndView("com/zzjee/wmapi/wvGiNoticeList");
|
||||
}
|
||||
/**
|
||||
* easyui AJAX请求数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param dataGrid
|
||||
*/
|
||||
|
||||
/**
|
||||
* easyui AJAX请求数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param dataGrid
|
||||
*/
|
||||
@RequestMapping(params = "datagrid")
|
||||
public void datagrid(WvGiNoticeEntity wvGiNotice, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
|
||||
CriteriaQuery cq = new CriteriaQuery(WvGiNoticeEntity.class, dataGrid);
|
||||
//查询条件组装器
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvGiNotice, request.getParameterMap());
|
||||
try {
|
||||
//自定义追加查询条件
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
cq.add();
|
||||
this.wvGiNoticeService.getDataGridReturn(cq, true);
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
}
|
||||
|
||||
@RequestMapping(params = "datagrid")
|
||||
public void datagrid(WvGiNoticeEntity wvGiNotice,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
|
||||
CriteriaQuery cq = new CriteriaQuery(WvGiNoticeEntity.class, dataGrid);
|
||||
//查询条件组装器
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvGiNotice, request.getParameterMap());
|
||||
try{
|
||||
//自定义追加查询条件
|
||||
}catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
cq.add();
|
||||
this.wvGiNoticeService.getDataGridReturn(cq, true);
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
}
|
||||
/**
|
||||
* 删除wv_gi_notice
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(WvGiNoticeEntity wvGiNotice, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
wvGiNotice = systemService.getEntity(WvGiNoticeEntity.class, wvGiNotice.getId());
|
||||
message = "wv_gi_notice删除成功";
|
||||
try {
|
||||
wvGiNoticeService.delete(wvGiNotice);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_gi_notice删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除wv_gi_notice
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(WvGiNoticeEntity wvGiNotice, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
wvGiNotice = systemService.getEntity(WvGiNoticeEntity.class, wvGiNotice.getId());
|
||||
message = "wv_gi_notice删除成功";
|
||||
try{
|
||||
wvGiNoticeService.delete(wvGiNotice);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "wv_gi_notice删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除wv_gi_notice
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doBatchDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_gi_notice删除成功";
|
||||
try{
|
||||
for(String id:ids.split(",")){
|
||||
WvGiNoticeEntity wvGiNotice = systemService.getEntity(WvGiNoticeEntity.class,
|
||||
id
|
||||
);
|
||||
wvGiNoticeService.delete(wvGiNotice);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "wv_gi_notice删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
* 批量删除wv_gi_notice
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doBatchDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_gi_notice删除成功";
|
||||
try {
|
||||
for (String id : ids.split(",")) {
|
||||
WvGiNoticeEntity wvGiNotice = systemService.getEntity(WvGiNoticeEntity.class,
|
||||
id
|
||||
);
|
||||
wvGiNoticeService.delete(wvGiNotice);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_gi_notice删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加wv_gi_notice
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doAdd")
|
||||
@ResponseBody
|
||||
public AjaxJson doAdd(WvGiNoticeEntity wvGiNotice, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_gi_notice添加成功";
|
||||
try{
|
||||
wvGiNoticeService.save(wvGiNotice);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "wv_gi_notice添加失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
* 添加wv_gi_notice
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doAdd")
|
||||
@ResponseBody
|
||||
public AjaxJson doAdd(WvGiNoticeEntity wvGiNotice, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_gi_notice添加成功";
|
||||
try {
|
||||
wvGiNoticeService.save(wvGiNotice);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_gi_notice添加失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新wv_gi_notice
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson doUpdate(WvGiNoticeEntity wvGiNotice, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_gi_notice更新成功";
|
||||
WvGiNoticeEntity t = wvGiNoticeService.get(WvGiNoticeEntity.class, wvGiNotice.getId());
|
||||
try {
|
||||
MyBeanUtils.copyBeanNotNull2Bean(wvGiNotice, t);
|
||||
wvGiNoticeService.saveOrUpdate(t);
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_gi_notice更新失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
* 更新wv_gi_notice
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson doUpdate(WvGiNoticeEntity wvGiNotice, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_gi_notice更新成功";
|
||||
WvGiNoticeEntity t = wvGiNoticeService.get(WvGiNoticeEntity.class, wvGiNotice.getId());
|
||||
try {
|
||||
MyBeanUtils.copyBeanNotNull2Bean(wvGiNotice, t);
|
||||
wvGiNoticeService.saveOrUpdate(t);
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_gi_notice更新失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wv_gi_notice新增页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goAdd")
|
||||
public ModelAndView goAdd(WvGiNoticeEntity wvGiNotice, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(wvGiNotice.getId())) {
|
||||
wvGiNotice = wvGiNoticeService.getEntity(WvGiNoticeEntity.class, wvGiNotice.getId());
|
||||
req.setAttribute("wvGiNoticePage", wvGiNotice);
|
||||
}
|
||||
return new ModelAndView("com/zzjee/wmapi/wvGiNotice-add");
|
||||
}
|
||||
/**
|
||||
* wv_gi_notice编辑页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goUpdate")
|
||||
public ModelAndView goUpdate(WvGiNoticeEntity wvGiNotice, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(wvGiNotice.getId())) {
|
||||
wvGiNotice = wvGiNoticeService.getEntity(WvGiNoticeEntity.class, wvGiNotice.getId());
|
||||
req.setAttribute("wvGiNoticePage", wvGiNotice);
|
||||
}
|
||||
return new ModelAndView("com/zzjee/wmapi/wvGiNotice-update");
|
||||
}
|
||||
/**
|
||||
* wv_gi_notice新增页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goAdd")
|
||||
public ModelAndView goAdd(WvGiNoticeEntity wvGiNotice, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(wvGiNotice.getId())) {
|
||||
wvGiNotice = wvGiNoticeService.getEntity(WvGiNoticeEntity.class, wvGiNotice.getId());
|
||||
req.setAttribute("wvGiNoticePage", wvGiNotice);
|
||||
}
|
||||
return new ModelAndView("com/zzjee/wmapi/wvGiNotice-add");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入功能跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "upload")
|
||||
public ModelAndView upload(HttpServletRequest req) {
|
||||
req.setAttribute("controller_name","wvGiNoticeController");
|
||||
return new ModelAndView("common/upload/pub_excel_upload");
|
||||
}
|
||||
/**
|
||||
* wv_gi_notice编辑页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goUpdate")
|
||||
public ModelAndView goUpdate(WvGiNoticeEntity wvGiNotice, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(wvGiNotice.getId())) {
|
||||
wvGiNotice = wvGiNoticeService.getEntity(WvGiNoticeEntity.class, wvGiNotice.getId());
|
||||
req.setAttribute("wvGiNoticePage", wvGiNotice);
|
||||
}
|
||||
return new ModelAndView("com/zzjee/wmapi/wvGiNotice-update");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXls")
|
||||
public String exportXls(WvGiNoticeEntity wvGiNotice,HttpServletRequest request,HttpServletResponse response
|
||||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
CriteriaQuery cq = new CriteriaQuery(WvGiNoticeEntity.class, dataGrid);
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvGiNotice, request.getParameterMap());
|
||||
List<WvGiNoticeEntity> wvGiNotices = this.wvGiNoticeService.getListByCriteriaQuery(cq,false);
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"wv_gi_notice");
|
||||
modelMap.put(NormalExcelConstants.CLASS,WvGiNoticeEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("wv_gi_notice列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,wvGiNotices);
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
/**
|
||||
* 导出excel 使模板
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXlsByT")
|
||||
public String exportXlsByT(WvGiNoticeEntity wvGiNotice,HttpServletRequest request,HttpServletResponse response
|
||||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"wv_gi_notice");
|
||||
modelMap.put(NormalExcelConstants.CLASS,WvGiNoticeEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("wv_gi_notice列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
/**
|
||||
* 导入功能跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "upload")
|
||||
public ModelAndView upload(HttpServletRequest req) {
|
||||
req.setAttribute("controller_name", "wvGiNoticeController");
|
||||
return new ModelAndView("common/upload/pub_excel_upload");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
AjaxJson j = new AjaxJson();
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXls")
|
||||
public String exportXls(WvGiNoticeEntity wvGiNotice, HttpServletRequest request, HttpServletResponse response
|
||||
, DataGrid dataGrid, ModelMap modelMap) {
|
||||
CriteriaQuery cq = new CriteriaQuery(WvGiNoticeEntity.class, dataGrid);
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvGiNotice, request.getParameterMap());
|
||||
List<WvGiNoticeEntity> wvGiNotices = this.wvGiNoticeService.getListByCriteriaQuery(cq, false);
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME, "wv_gi_notice");
|
||||
modelMap.put(NormalExcelConstants.CLASS, WvGiNoticeEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("wv_gi_notice列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST, wvGiNotices);
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
|
||||
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<WvGiNoticeEntity> listWvGiNoticeEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WvGiNoticeEntity.class,params);
|
||||
for (WvGiNoticeEntity wvGiNotice : listWvGiNoticeEntitys) {
|
||||
wvGiNoticeService.save(wvGiNotice);
|
||||
}
|
||||
j.setMsg("文件导入成功!");
|
||||
} catch (Exception e) {
|
||||
j.setMsg("文件导入失败!");
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}finally{
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
* 导出excel 使模板
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXlsByT")
|
||||
public String exportXlsByT(WvGiNoticeEntity wvGiNotice, HttpServletRequest request, HttpServletResponse response
|
||||
, DataGrid dataGrid, ModelMap modelMap) {
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME, "wv_gi_notice");
|
||||
modelMap.put(NormalExcelConstants.CLASS, WvGiNoticeEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("wv_gi_notice列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST, new ArrayList());
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> list() {
|
||||
@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<WvGiNoticeEntity> listWvGiNoticeEntitys = ExcelImportUtil.importExcel(file.getInputStream(), WvGiNoticeEntity.class, params);
|
||||
for (WvGiNoticeEntity wvGiNotice : listWvGiNoticeEntitys) {
|
||||
wvGiNoticeService.save(wvGiNotice);
|
||||
}
|
||||
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 ResponseEntity<?> list() {
|
||||
|
||||
// public ResponseEntity<?> list(@RequestParam String username, @RequestParam String searchstr) {
|
||||
ResultDO D0 = new ResultDO();
|
||||
List<WvGiNoticeEntity> listWvGiNotices=wvGiNoticeService.getList(WvGiNoticeEntity.class);
|
||||
D0.setOK(true);
|
||||
D0.setObj(listWvGiNotices);
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
ResultDO D0 = new ResultDO();
|
||||
List<WvGiNoticeEntity> listWvGiNotices = wvGiNoticeService.getList(WvGiNoticeEntity.class);
|
||||
D0.setOK(true);
|
||||
D0.setObj(listWvGiNotices);
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
//下架任务 PDA接口
|
||||
@RequestMapping(value = "/search",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> lists( @RequestParam(value="username", required=false) String username, @RequestParam(value="searchstr", required=false)String searchstr, @RequestParam(value="searchstr2", required=false)String searchstr2, @RequestParam(value="searchstr3", required=false)String searchstr3) {
|
||||
//下架任务 PDA接口
|
||||
@RequestMapping(value = "/search", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> lists(@RequestParam(value = "username", required = false) String username, @RequestParam(value = "searchstr", required = false) String searchstr, @RequestParam(value = "searchstr2", required = false) String searchstr2, @RequestParam(value = "searchstr3", required = false) String searchstr3) {
|
||||
// return listWvGis;
|
||||
|
||||
|
||||
ResultDO D0 = new ResultDO();
|
||||
String hql = " from WvGiNoticeEntity where 1 = 1 ";
|
||||
D0.setOK(true);
|
||||
if(!StringUtil.isEmpty(searchstr)) {
|
||||
hql=hql+" and omNoticeId like '%" + searchstr + "%'" +" or imCusCode like '%" + searchstr + "%'";
|
||||
}
|
||||
if(!StringUtil.isEmpty(searchstr2)) {
|
||||
try{
|
||||
String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2);
|
||||
if(StringUtil.isNotEmpty(shpbianma)){
|
||||
searchstr2=shpbianma;
|
||||
}
|
||||
}catch (Exception e){
|
||||
ResultDO D0 = new ResultDO();
|
||||
String hql = " from WvGiNoticeEntity where 1 = 1 ";
|
||||
D0.setOK(true);
|
||||
if (!StringUtil.isEmpty(searchstr)) {
|
||||
hql = hql + " and omNoticeId like '%" + searchstr + "%'" + " or imCusCode like '%" + searchstr + "%'";
|
||||
}
|
||||
if (!StringUtil.isEmpty(searchstr2)) {
|
||||
try {
|
||||
String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2);
|
||||
if (StringUtil.isNotEmpty(shpbianma)) {
|
||||
searchstr2 = shpbianma;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
// hql=hql+" and goodsId = '" + searchstr2 + "'";
|
||||
|
||||
|
||||
String[] ss = searchstr2.split(",");
|
||||
if (ss.length == 1) {
|
||||
hql = hql + " and goodsId like '%" + searchstr2 + "%'";
|
||||
String[] ss = searchstr2.split(",");
|
||||
if (ss.length == 1) {
|
||||
hql = hql + " and goodsId like '%" + searchstr2 + "%'";
|
||||
|
||||
} else {
|
||||
String insearch = "";
|
||||
for (String s : ss) {
|
||||
if (StringUtil.isNotEmpty(insearch)) {
|
||||
insearch = insearch + " or goodsId = '" + s + "'";
|
||||
} else {
|
||||
insearch = "goodsId = '" + s + "'";
|
||||
}
|
||||
} else {
|
||||
String insearch = "";
|
||||
for (String s : ss) {
|
||||
if (StringUtil.isNotEmpty(insearch)) {
|
||||
insearch = insearch + " or goodsId = '" + s + "'";
|
||||
} else {
|
||||
insearch = "goodsId = '" + s + "'";
|
||||
}
|
||||
|
||||
}
|
||||
hql = hql + " and (" + insearch + ")";
|
||||
}
|
||||
hql = hql + " and (" + insearch + ")";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(!StringUtil.isEmpty(searchstr3)) {
|
||||
hql=hql+" and binId = '" + searchstr3 + "'";
|
||||
}
|
||||
}
|
||||
if (!StringUtil.isEmpty(searchstr3)) {
|
||||
hql = hql + " and binId = '" + searchstr3 + "'";
|
||||
}
|
||||
|
||||
|
||||
List<WvGiNoticeEntity> listWvGiNotices=wvGiNoticeService.findHql(hql);
|
||||
if(listWvGiNotices==null||listWvGiNotices.size()==0){
|
||||
hql = " from WvGiNoticeEntity where 1 = 1 ";
|
||||
List<WvGiNoticeEntity> listWvGiNotices = wvGiNoticeService.findHql(hql);
|
||||
if (listWvGiNotices == null || listWvGiNotices.size() == 0) {
|
||||
hql = " from WvGiNoticeEntity where 1 = 1 ";
|
||||
|
||||
if(!StringUtil.isEmpty(searchstr)) {
|
||||
hql=hql+" and omNoticeId = '" + searchstr + "'";
|
||||
}
|
||||
listWvGiNotices=wvGiNoticeService.findHql(hql);
|
||||
if (!StringUtil.isEmpty(searchstr)) {
|
||||
hql = hql + " and omNoticeId = '" + searchstr + "'";
|
||||
}
|
||||
listWvGiNotices = wvGiNoticeService.findHql(hql);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// public ResponseEntity<?> list(@RequestParam String username, @RequestParam String searchstr) {
|
||||
// ResultDO D0 = new ResultDO();
|
||||
// List<WvGiNoticeEntity> listWvGiNotices=wvGiNoticeService.getList(WvGiNoticeEntity.class);
|
||||
D0.setOK(true);
|
||||
D0.setOK(true);
|
||||
|
||||
|
||||
List<WvGiNoticeEntity> result = new ArrayList<WvGiNoticeEntity>();
|
||||
int i = 0;
|
||||
for (WvGiNoticeEntity t :listWvGiNotices){
|
||||
if(StringUtil.isNotEmpty(username)&&StringUtil.isNotEmpty(t.getAssignTo())){
|
||||
if(!username.equals(t.getAssignTo())){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
if(i>100){
|
||||
break;
|
||||
}
|
||||
try{
|
||||
String siji = "";
|
||||
String chehao = "";
|
||||
WmOmNoticeHEntity wmom = systemService.findUniqueByProperty(WmOmNoticeHEntity.class,"omNoticeId",t.getOmNoticeId());
|
||||
siji = wmom.getReMember();
|
||||
chehao = wmom.getReCarno();
|
||||
if(StringUtil.isNotEmpty(t.getOmBeiZhu())){
|
||||
t.setOmBeiZhu(t.getOmBeiZhu()+siji+chehao);
|
||||
}else{
|
||||
t.setOmBeiZhu(siji+chehao);
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
List<WvGiNoticeEntity> result = new ArrayList<WvGiNoticeEntity>();
|
||||
int i = 0;
|
||||
for (WvGiNoticeEntity t : listWvGiNotices) {
|
||||
if (StringUtil.isNotEmpty(username) && StringUtil.isNotEmpty(t.getAssignTo())) {
|
||||
if (!username.equals(t.getAssignTo())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
if (i > 100) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
String siji = "";
|
||||
String chehao = "";
|
||||
WmOmNoticeHEntity wmom = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "omNoticeId", t.getOmNoticeId());
|
||||
siji = wmom.getReMember();
|
||||
chehao = wmom.getReCarno();
|
||||
if (StringUtil.isNotEmpty(t.getOmBeiZhu())) {
|
||||
t.setOmBeiZhu(t.getOmBeiZhu() + siji + chehao);
|
||||
} else {
|
||||
t.setOmBeiZhu(siji + chehao);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
result.add(t);
|
||||
}
|
||||
result.add(t);
|
||||
}
|
||||
|
||||
D0.setObj(result);
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> get(@PathVariable("id") String id) {
|
||||
WvGiNoticeEntity task = wvGiNoticeService.get(WvGiNoticeEntity.class, id);
|
||||
if (task == null) {
|
||||
return new ResponseEntity(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return new ResponseEntity(task, HttpStatus.OK);
|
||||
}
|
||||
D0.setObj(result);
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> create(@RequestBody WvGiNoticeEntity wvGiNotice, UriComponentsBuilder uriBuilder) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WvGiNoticeEntity>> failures = validator.validate(wvGiNotice);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> get(@PathVariable("id") String id) {
|
||||
WvGiNoticeEntity task = wvGiNoticeService.get(WvGiNoticeEntity.class, id);
|
||||
if (task == null) {
|
||||
return new ResponseEntity(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return new ResponseEntity(task, HttpStatus.OK);
|
||||
}
|
||||
|
||||
//保存
|
||||
try{
|
||||
wvGiNoticeService.save(wvGiNotice);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
//按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象.
|
||||
String id = wvGiNotice.getId();
|
||||
URI uri = uriBuilder.path("/rest/wvGiNoticeController/" + id).build().toUri();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setLocation(uri);
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> create(@RequestBody WvGiNoticeEntity wvGiNotice, UriComponentsBuilder uriBuilder) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WvGiNoticeEntity>> failures = validator.validate(wvGiNotice);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
return new ResponseEntity(headers, HttpStatus.CREATED);
|
||||
}
|
||||
//保存
|
||||
try {
|
||||
wvGiNoticeService.save(wvGiNotice);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
//按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象.
|
||||
String id = wvGiNotice.getId();
|
||||
URI uri = uriBuilder.path("/rest/wvGiNoticeController/" + id).build().toUri();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setLocation(uri);
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<?> update(@RequestBody WvGiNoticeEntity wvGiNotice) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WvGiNoticeEntity>> failures = validator.validate(wvGiNotice);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
return new ResponseEntity(headers, HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
//保存
|
||||
try{
|
||||
wvGiNoticeService.saveOrUpdate(wvGiNotice);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<?> update(@RequestBody WvGiNoticeEntity wvGiNotice) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WvGiNoticeEntity>> failures = validator.validate(wvGiNotice);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
//按Restful约定,返回204状态码, 无内容. 也可以返回200状态码.
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
//保存
|
||||
try {
|
||||
wvGiNoticeService.saveOrUpdate(wvGiNotice);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
public void delete(@PathVariable("id") String id) {
|
||||
wvGiNoticeService.deleteEntityById(WvGiNoticeEntity.class, id);
|
||||
}
|
||||
//按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) {
|
||||
wvGiNoticeService.deleteEntityById(WvGiNoticeEntity.class, id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
package com.zzjee.wmapi.controller;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
|
@ -54,393 +55,394 @@ import com.zzjee.wmapi.service.WvNoticeServiceI;
|
|||
import com.zzjee.wmutil.wmUtil;
|
||||
|
||||
/**
|
||||
* @author erzhongxmu
|
||||
* @version V1.0
|
||||
* @Title: Controller
|
||||
* @Description: wv_notice
|
||||
* @author erzhongxmu
|
||||
* @date 2018-05-30 20:21:05
|
||||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/wvNoticeController")
|
||||
public class WvNoticeController extends BaseController {
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(WvNoticeController.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(WvNoticeController.class);
|
||||
|
||||
@Autowired
|
||||
private WvNoticeServiceI wvNoticeService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
@Autowired
|
||||
private WvNoticeServiceI wvNoticeService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
|
||||
/**
|
||||
* wv_notice列表 页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "list")
|
||||
public ModelAndView list(HttpServletRequest request) {
|
||||
return new ModelAndView("com/zzjee/wmapi/wvNoticeList");
|
||||
}
|
||||
|
||||
/**
|
||||
* wv_notice列表 页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "list")
|
||||
public ModelAndView list(HttpServletRequest request) {
|
||||
return new ModelAndView("com/zzjee/wmapi/wvNoticeList");
|
||||
}
|
||||
/**
|
||||
* easyui AJAX请求数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param dataGrid
|
||||
* @param user
|
||||
*/
|
||||
|
||||
/**
|
||||
* easyui AJAX请求数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param dataGrid
|
||||
* @param user
|
||||
*/
|
||||
@RequestMapping(params = "datagrid")
|
||||
public void datagrid(WvNoticeEntity wvNotice, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
|
||||
CriteriaQuery cq = new CriteriaQuery(WvNoticeEntity.class, dataGrid);
|
||||
//查询条件组装器
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvNotice, request.getParameterMap());
|
||||
try {
|
||||
//自定义追加查询条件
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
cq.add();
|
||||
this.wvNoticeService.getDataGridReturn(cq, true);
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
}
|
||||
|
||||
@RequestMapping(params = "datagrid")
|
||||
public void datagrid(WvNoticeEntity wvNotice,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
|
||||
CriteriaQuery cq = new CriteriaQuery(WvNoticeEntity.class, dataGrid);
|
||||
//查询条件组装器
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvNotice, request.getParameterMap());
|
||||
try{
|
||||
//自定义追加查询条件
|
||||
}catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
cq.add();
|
||||
this.wvNoticeService.getDataGridReturn(cq, true);
|
||||
TagUtil.datagrid(response, dataGrid);
|
||||
}
|
||||
/**
|
||||
* 删除wv_notice
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(WvNoticeEntity wvNotice, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
wvNotice = systemService.getEntity(WvNoticeEntity.class, wvNotice.getId());
|
||||
message = "wv_notice删除成功";
|
||||
try {
|
||||
wvNoticeService.delete(wvNotice);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_notice删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除wv_notice
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doDel(WvNoticeEntity wvNotice, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
wvNotice = systemService.getEntity(WvNoticeEntity.class, wvNotice.getId());
|
||||
message = "wv_notice删除成功";
|
||||
try{
|
||||
wvNoticeService.delete(wvNotice);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "wv_notice删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除wv_notice
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doBatchDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_notice删除成功";
|
||||
try{
|
||||
for(String id:ids.split(",")){
|
||||
WvNoticeEntity wvNotice = systemService.getEntity(WvNoticeEntity.class,
|
||||
id
|
||||
);
|
||||
wvNoticeService.delete(wvNotice);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "wv_notice删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
* 批量删除wv_notice
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doBatchDel")
|
||||
@ResponseBody
|
||||
public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_notice删除成功";
|
||||
try {
|
||||
for (String id : ids.split(",")) {
|
||||
WvNoticeEntity wvNotice = systemService.getEntity(WvNoticeEntity.class,
|
||||
id
|
||||
);
|
||||
wvNoticeService.delete(wvNotice);
|
||||
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_notice删除失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加wv_notice
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doAdd")
|
||||
@ResponseBody
|
||||
public AjaxJson doAdd(WvNoticeEntity wvNotice, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_notice添加成功";
|
||||
try{
|
||||
wvNoticeService.save(wvNotice);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
message = "wv_notice添加失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
* 添加wv_notice
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doAdd")
|
||||
@ResponseBody
|
||||
public AjaxJson doAdd(WvNoticeEntity wvNotice, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_notice添加成功";
|
||||
try {
|
||||
wvNoticeService.save(wvNotice);
|
||||
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_notice添加失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新wv_notice
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson doUpdate(WvNoticeEntity wvNotice, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_notice更新成功";
|
||||
WvNoticeEntity t = wvNoticeService.get(WvNoticeEntity.class, wvNotice.getId());
|
||||
try {
|
||||
MyBeanUtils.copyBeanNotNull2Bean(wvNotice, t);
|
||||
wvNoticeService.saveOrUpdate(t);
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_notice更新失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
/**
|
||||
* 更新wv_notice
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "doUpdate")
|
||||
@ResponseBody
|
||||
public AjaxJson doUpdate(WvNoticeEntity wvNotice, HttpServletRequest request) {
|
||||
String message = null;
|
||||
AjaxJson j = new AjaxJson();
|
||||
message = "wv_notice更新成功";
|
||||
WvNoticeEntity t = wvNoticeService.get(WvNoticeEntity.class, wvNotice.getId());
|
||||
try {
|
||||
MyBeanUtils.copyBeanNotNull2Bean(wvNotice, t);
|
||||
wvNoticeService.saveOrUpdate(t);
|
||||
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
message = "wv_notice更新失败";
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
j.setMsg(message);
|
||||
return j;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wv_notice新增页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goAdd")
|
||||
public ModelAndView goAdd(WvNoticeEntity wvNotice, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(wvNotice.getId())) {
|
||||
wvNotice = wvNoticeService.getEntity(WvNoticeEntity.class, wvNotice.getId());
|
||||
req.setAttribute("wvNoticePage", wvNotice);
|
||||
}
|
||||
return new ModelAndView("com/zzjee/wmapi/wvNotice-add");
|
||||
}
|
||||
/**
|
||||
* wv_notice编辑页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goUpdate")
|
||||
public ModelAndView goUpdate(WvNoticeEntity wvNotice, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(wvNotice.getId())) {
|
||||
wvNotice = wvNoticeService.getEntity(WvNoticeEntity.class, wvNotice.getId());
|
||||
req.setAttribute("wvNoticePage", wvNotice);
|
||||
}
|
||||
return new ModelAndView("com/zzjee/wmapi/wvNotice-update");
|
||||
}
|
||||
/**
|
||||
* wv_notice新增页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goAdd")
|
||||
public ModelAndView goAdd(WvNoticeEntity wvNotice, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(wvNotice.getId())) {
|
||||
wvNotice = wvNoticeService.getEntity(WvNoticeEntity.class, wvNotice.getId());
|
||||
req.setAttribute("wvNoticePage", wvNotice);
|
||||
}
|
||||
return new ModelAndView("com/zzjee/wmapi/wvNotice-add");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入功能跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "upload")
|
||||
public ModelAndView upload(HttpServletRequest req) {
|
||||
req.setAttribute("controller_name","wvNoticeController");
|
||||
return new ModelAndView("common/upload/pub_excel_upload");
|
||||
}
|
||||
/**
|
||||
* wv_notice编辑页面跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "goUpdate")
|
||||
public ModelAndView goUpdate(WvNoticeEntity wvNotice, HttpServletRequest req) {
|
||||
if (StringUtil.isNotEmpty(wvNotice.getId())) {
|
||||
wvNotice = wvNoticeService.getEntity(WvNoticeEntity.class, wvNotice.getId());
|
||||
req.setAttribute("wvNoticePage", wvNotice);
|
||||
}
|
||||
return new ModelAndView("com/zzjee/wmapi/wvNotice-update");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXls")
|
||||
public String exportXls(WvNoticeEntity wvNotice,HttpServletRequest request,HttpServletResponse response
|
||||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
CriteriaQuery cq = new CriteriaQuery(WvNoticeEntity.class, dataGrid);
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvNotice, request.getParameterMap());
|
||||
List<WvNoticeEntity> wvNotices = this.wvNoticeService.getListByCriteriaQuery(cq,false);
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"wv_notice");
|
||||
modelMap.put(NormalExcelConstants.CLASS,WvNoticeEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("wv_notice列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,wvNotices);
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
/**
|
||||
* 导出excel 使模板
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXlsByT")
|
||||
public String exportXlsByT(WvNoticeEntity wvNotice,HttpServletRequest request,HttpServletResponse response
|
||||
, DataGrid dataGrid,ModelMap modelMap) {
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME,"wv_notice");
|
||||
modelMap.put(NormalExcelConstants.CLASS,WvNoticeEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("wv_notice列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList());
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
/**
|
||||
* 导入功能跳转
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(params = "upload")
|
||||
public ModelAndView upload(HttpServletRequest req) {
|
||||
req.setAttribute("controller_name", "wvNoticeController");
|
||||
return new ModelAndView("common/upload/pub_excel_upload");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping(params = "importExcel", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
AjaxJson j = new AjaxJson();
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXls")
|
||||
public String exportXls(WvNoticeEntity wvNotice, HttpServletRequest request, HttpServletResponse response
|
||||
, DataGrid dataGrid, ModelMap modelMap) {
|
||||
CriteriaQuery cq = new CriteriaQuery(WvNoticeEntity.class, dataGrid);
|
||||
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvNotice, request.getParameterMap());
|
||||
List<WvNoticeEntity> wvNotices = this.wvNoticeService.getListByCriteriaQuery(cq, false);
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME, "wv_notice");
|
||||
modelMap.put(NormalExcelConstants.CLASS, WvNoticeEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("wv_notice列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
|
||||
"导出信息"));
|
||||
modelMap.put(NormalExcelConstants.DATA_LIST, wvNotices);
|
||||
return NormalExcelConstants.JEECG_EXCEL_VIEW;
|
||||
}
|
||||
|
||||
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<WvNoticeEntity> listWvNoticeEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WvNoticeEntity.class,params);
|
||||
for (WvNoticeEntity wvNotice : listWvNoticeEntitys) {
|
||||
wvNoticeService.save(wvNotice);
|
||||
}
|
||||
j.setMsg("文件导入成功!");
|
||||
} catch (Exception e) {
|
||||
j.setMsg("文件导入失败!");
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}finally{
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
//PDA接口
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> list( @RequestParam(value="username", required=false) String username, @RequestParam(value="searchstr", required=false)String searchstr, @RequestParam(value="searchstr2", required=false)String searchstr2) {
|
||||
/**
|
||||
* 导出excel 使模板
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@RequestMapping(params = "exportXlsByT")
|
||||
public String exportXlsByT(WvNoticeEntity wvNotice, HttpServletRequest request, HttpServletResponse response
|
||||
, DataGrid dataGrid, ModelMap modelMap) {
|
||||
modelMap.put(NormalExcelConstants.FILE_NAME, "wv_notice");
|
||||
modelMap.put(NormalExcelConstants.CLASS, WvNoticeEntity.class);
|
||||
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("wv_notice列表", "导出人:" + 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<WvNoticeEntity> listWvNoticeEntitys = ExcelImportUtil.importExcel(file.getInputStream(), WvNoticeEntity.class, params);
|
||||
for (WvNoticeEntity wvNotice : listWvNoticeEntitys) {
|
||||
wvNoticeService.save(wvNotice);
|
||||
}
|
||||
j.setMsg("文件导入成功!");
|
||||
} catch (Exception e) {
|
||||
j.setMsg("文件导入失败!");
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
} finally {
|
||||
try {
|
||||
file.getInputStream().close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
//PDA接口
|
||||
@RequestMapping(method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> list(@RequestParam(value = "username", required = false) String username, @RequestParam(value = "searchstr", required = false) String searchstr, @RequestParam(value = "searchstr2", required = false) String searchstr2) {
|
||||
// return listWvGis;
|
||||
|
||||
|
||||
ResultDO D0 = new ResultDO();
|
||||
String hql = " from WvNoticeEntity where 1 = 1 ";
|
||||
D0.setOK(true);
|
||||
if(!StringUtil.isEmpty(searchstr)) {
|
||||
hql=hql+" and noticeId like '%" + searchstr + "%'" +" or imCusCode like '%" + searchstr + "%'";
|
||||
}
|
||||
if(!StringUtil.isEmpty(searchstr2)) {
|
||||
try{
|
||||
String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2);
|
||||
if(StringUtil.isNotEmpty(shpbianma)){
|
||||
searchstr2=shpbianma;
|
||||
}
|
||||
}catch (Exception e){
|
||||
ResultDO D0 = new ResultDO();
|
||||
String hql = " from WvNoticeEntity where 1 = 1 ";
|
||||
D0.setOK(true);
|
||||
if (!StringUtil.isEmpty(searchstr)) {
|
||||
hql = hql + " and noticeId like '%" + searchstr + "%'" + " or imCusCode like '%" + searchstr + "%'";
|
||||
}
|
||||
if (!StringUtil.isEmpty(searchstr2)) {
|
||||
try {
|
||||
String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2);
|
||||
if (StringUtil.isNotEmpty(shpbianma)) {
|
||||
searchstr2 = shpbianma;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
String[] ss = searchstr2.split(",");
|
||||
if (ss.length == 1) {
|
||||
hql = hql + " and (goodsCode like '%" + searchstr2 + "%'"+"or shp_ming_cheng like '%"+searchstr2+"%')";
|
||||
}
|
||||
String[] ss = searchstr2.split(",");
|
||||
if (ss.length == 1) {
|
||||
hql = hql + " and (goodsCode like '%" + searchstr2 + "%'" + "or shp_ming_cheng like '%" + searchstr2 + "%')";
|
||||
|
||||
} else {
|
||||
String insearch = "";
|
||||
for (String s : ss) {
|
||||
if (StringUtil.isNotEmpty(insearch)) {
|
||||
insearch = insearch + " or goodsCode = '" + s + "'";
|
||||
} else {
|
||||
insearch = "goodsCode = '" + s + "'";
|
||||
}
|
||||
} else {
|
||||
String insearch = "";
|
||||
for (String s : ss) {
|
||||
if (StringUtil.isNotEmpty(insearch)) {
|
||||
insearch = insearch + " or goodsCode = '" + s + "'";
|
||||
} else {
|
||||
insearch = "goodsCode = '" + s + "'";
|
||||
}
|
||||
|
||||
}
|
||||
hql = hql + " and (" + insearch + ")";
|
||||
}
|
||||
hql = hql + " and (" + insearch + ")";
|
||||
|
||||
}
|
||||
}
|
||||
// hql=hql+" and goodsCode in (:alist)";
|
||||
}
|
||||
}
|
||||
|
||||
List<WvNoticeEntity> listWvNotices=wvNoticeService.findHql(hql);
|
||||
D0.setOK(true);
|
||||
List<WvNoticeEntity> listWvNotices = wvNoticeService.findHql(hql);
|
||||
D0.setOK(true);
|
||||
|
||||
List<WvNoticeEntity> result = new ArrayList<WvNoticeEntity>();
|
||||
int i = 0;
|
||||
for (WvNoticeEntity t :listWvNotices){
|
||||
List<WvNoticeEntity> result = new ArrayList<WvNoticeEntity>();
|
||||
int i = 0;
|
||||
for (WvNoticeEntity t : listWvNotices) {
|
||||
|
||||
i++;
|
||||
if(i>100){
|
||||
break;
|
||||
}
|
||||
result.add(t);
|
||||
}
|
||||
i++;
|
||||
if (i > 100) {
|
||||
break;
|
||||
}
|
||||
result.add(t);
|
||||
}
|
||||
|
||||
D0.setObj(result);
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
D0.setObj(result);
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> get(@PathVariable("id") String id) {
|
||||
WvNoticeEntity task = wvNoticeService.get(WvNoticeEntity.class, id);
|
||||
if (task == null) {
|
||||
return new ResponseEntity(HttpStatus.NOT_FOUND);
|
||||
}
|
||||
return new ResponseEntity(task, HttpStatus.OK);
|
||||
}
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> get(@PathVariable("id") String id) {
|
||||
WvNoticeEntity task = wvNoticeService.get(WvNoticeEntity.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 WvNoticeEntity wvNotice, UriComponentsBuilder uriBuilder) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WvNoticeEntity>> failures = validator.validate(wvNotice);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> create(@RequestBody WvNoticeEntity wvNotice, UriComponentsBuilder uriBuilder) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WvNoticeEntity>> failures = validator.validate(wvNotice);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
//保存
|
||||
try{
|
||||
wvNoticeService.save(wvNotice);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
//按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象.
|
||||
String id = wvNotice.getId();
|
||||
URI uri = uriBuilder.path("/rest/wvNoticeController/" + id).build().toUri();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setLocation(uri);
|
||||
//保存
|
||||
try {
|
||||
wvNoticeService.save(wvNotice);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
//按照Restful风格约定,创建指向新任务的url, 也可以直接返回id或对象.
|
||||
String id = wvNotice.getId();
|
||||
URI uri = uriBuilder.path("/rest/wvNoticeController/" + id).build().toUri();
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setLocation(uri);
|
||||
|
||||
return new ResponseEntity(headers, HttpStatus.CREATED);
|
||||
}
|
||||
return new ResponseEntity(headers, HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<?> update(@RequestBody WvNoticeEntity wvNotice) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WvNoticeEntity>> failures = validator.validate(wvNotice);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<?> update(@RequestBody WvNoticeEntity wvNotice) {
|
||||
//调用JSR303 Bean Validator进行校验,如果出错返回含400错误码及json格式的错误信息.
|
||||
Set<ConstraintViolation<WvNoticeEntity>> failures = validator.validate(wvNotice);
|
||||
if (!failures.isEmpty()) {
|
||||
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
//保存
|
||||
try{
|
||||
wvNoticeService.saveOrUpdate(wvNotice);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
//保存
|
||||
try {
|
||||
wvNoticeService.saveOrUpdate(wvNotice);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
//按Restful约定,返回204状态码, 无内容. 也可以返回200状态码.
|
||||
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) {
|
||||
wvNoticeService.deleteEntityById(WvNoticeEntity.class, id);
|
||||
}
|
||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
||||
@ResponseStatus(HttpStatus.NO_CONTENT)
|
||||
public void delete(@PathVariable("id") String id) {
|
||||
wvNoticeService.deleteEntityById(WvNoticeEntity.class, id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,238 +50,241 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author erzhongxmu
|
||||
* @version V1.0
|
||||
* @Title: wmBaseControllerController
|
||||
* @Description: wmBaseController
|
||||
* @author erzhongxmu
|
||||
* @date 2018-05-30 20:21:50
|
||||
* @version V1.0
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/wmBaseController")
|
||||
public class wmBaseController extends BaseController {
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(wmBaseController.class);
|
||||
/**
|
||||
* Logger for this class
|
||||
*/
|
||||
private static final Logger logger = Logger.getLogger(wmBaseController.class);
|
||||
|
||||
// @Autowired
|
||||
// @Autowired
|
||||
// private WvGiServiceI wvGiService;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
private SmsSendTask smsSendTask;
|
||||
@Autowired
|
||||
private CostTask costTask;
|
||||
@Autowired
|
||||
private SystemService systemService;
|
||||
@Autowired
|
||||
private SmsSendTask smsSendTask;
|
||||
@Autowired
|
||||
private CostTask costTask;
|
||||
// @Autowired
|
||||
// private Validator validator;
|
||||
/**
|
||||
* 获取图片流/获取文件用于下载
|
||||
* @param response
|
||||
* @param request
|
||||
* @throws Exception
|
||||
* http://localhost:8080/zzjee/wmOmNoticeHController/showOrDownbarcodeByurl.do?&qrvalue=1111223333 调用
|
||||
*/
|
||||
|
||||
@RequestMapping(value="showOrDownbarcodeByurl",method = RequestMethod.GET)
|
||||
public void getbarcodeImgByurl(HttpServletResponse response, HttpServletRequest request) throws Exception{
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
String flag=request.getParameter("down");//是否下载否则展示图片
|
||||
/**
|
||||
* 获取图片流/获取文件用于下载
|
||||
*
|
||||
* @param response
|
||||
* @param request
|
||||
* @throws Exception http://localhost:8080/zzjee/wmOmNoticeHController/showOrDownbarcodeByurl.do?&qrvalue=1111223333 调用
|
||||
*/
|
||||
|
||||
String qrvalue = request.getParameter("qrvalue");
|
||||
String dbpath = qrvalue+".jpg";
|
||||
String localPath=ResourceUtil.getConfigByName("webUploadpath");
|
||||
@RequestMapping(value = "showOrDownbarcodeByurl", method = RequestMethod.GET)
|
||||
public void getbarcodeImgByurl(HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
String flag = request.getParameter("down");//是否下载否则展示图片
|
||||
|
||||
try{
|
||||
String imgurl = localPath+File.separator+dbpath;
|
||||
String qrvalue = request.getParameter("qrvalue");
|
||||
String dbpath = qrvalue + ".jpg";
|
||||
String localPath = ResourceUtil.getConfigByName("webUploadpath");
|
||||
|
||||
try {
|
||||
String imgurl = localPath + File.separator + dbpath;
|
||||
// QRcodeUtil.encode(qrvalue,imgurl);
|
||||
BarcodeUtil.generateFile(qrvalue,imgurl);
|
||||
}catch (Exception e){
|
||||
BarcodeUtil.generateFile(qrvalue, imgurl);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
if("1".equals(flag)){
|
||||
response.setContentType("application/x-msdownload;charset=utf-8");
|
||||
String fileName=dbpath.substring(dbpath.lastIndexOf(File.separator)+1);
|
||||
}
|
||||
if ("1".equals(flag)) {
|
||||
response.setContentType("application/x-msdownload;charset=utf-8");
|
||||
String fileName = dbpath.substring(dbpath.lastIndexOf(File.separator) + 1);
|
||||
|
||||
String userAgent = request.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");
|
||||
}
|
||||
response.setHeader("Content-disposition", "attachment; filename="+ fileName);
|
||||
String userAgent = request.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");
|
||||
}
|
||||
response.setHeader("Content-disposition", "attachment; filename=" + fileName);
|
||||
|
||||
}else{
|
||||
response.setContentType("image/jpeg;charset=utf-8");
|
||||
}
|
||||
} else {
|
||||
response.setContentType("image/jpeg;charset=utf-8");
|
||||
}
|
||||
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream=null;
|
||||
try {
|
||||
String imgurl = localPath+File.separator+dbpath;
|
||||
inputStream = new BufferedInputStream(new FileInputStream(imgurl));
|
||||
outputStream = response.getOutputStream();
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = inputStream.read(buf)) > 0) {
|
||||
outputStream.write(buf, 0, len);
|
||||
}
|
||||
response.flushBuffer();
|
||||
} catch (Exception e) {
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}finally{
|
||||
if(inputStream!=null){
|
||||
inputStream.close();
|
||||
}
|
||||
if(outputStream!=null){
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
String imgurl = localPath + File.separator + dbpath;
|
||||
inputStream = new BufferedInputStream(new FileInputStream(imgurl));
|
||||
outputStream = response.getOutputStream();
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = inputStream.read(buf)) > 0) {
|
||||
outputStream.write(buf, 0, len);
|
||||
}
|
||||
response.flushBuffer();
|
||||
} catch (Exception e) {
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
if (outputStream != null) {
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取图片流/获取文件用于下载
|
||||
* @param response
|
||||
* @param request
|
||||
* @throws Exception
|
||||
* http://localhost:8080/zzjee/wmOmNoticeHController/showOrDownqrcodeByurl.do?&qrvalue=1111223333 调用
|
||||
*/
|
||||
/**
|
||||
* 获取图片流/获取文件用于下载
|
||||
*
|
||||
* @param response
|
||||
* @param request
|
||||
* @throws Exception http://localhost:8080/zzjee/wmOmNoticeHController/showOrDownqrcodeByurl.do?&qrvalue=1111223333 调用
|
||||
*/
|
||||
|
||||
@RequestMapping(value="showOrDownqrcodeByurl",method = RequestMethod.GET)
|
||||
public void getQrImgByurl(HttpServletResponse response, HttpServletRequest request) throws Exception{
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
String flag=request.getParameter("down");//是否下载否则展示图片
|
||||
@RequestMapping(value = "showOrDownqrcodeByurl", method = RequestMethod.GET)
|
||||
public void getQrImgByurl(HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
String flag = request.getParameter("down");//是否下载否则展示图片
|
||||
|
||||
String qrvalue = request.getParameter("qrvalue");
|
||||
String dbpath = qrvalue+".jpg";
|
||||
String localPath=ResourceUtil.getConfigByName("webUploadpath");
|
||||
String qrvalue = request.getParameter("qrvalue");
|
||||
String dbpath = qrvalue + ".jpg";
|
||||
String localPath = ResourceUtil.getConfigByName("webUploadpath");
|
||||
|
||||
try{
|
||||
String imgurl = localPath+File.separator+dbpath;
|
||||
QRcodeUtil.encode(qrvalue,imgurl);
|
||||
}catch (Exception e){
|
||||
try {
|
||||
String imgurl = localPath + File.separator + dbpath;
|
||||
QRcodeUtil.encode(qrvalue, imgurl);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
if("1".equals(flag)){
|
||||
response.setContentType("application/x-msdownload;charset=utf-8");
|
||||
String fileName=dbpath.substring(dbpath.lastIndexOf(File.separator)+1);
|
||||
}
|
||||
if ("1".equals(flag)) {
|
||||
response.setContentType("application/x-msdownload;charset=utf-8");
|
||||
String fileName = dbpath.substring(dbpath.lastIndexOf(File.separator) + 1);
|
||||
|
||||
String userAgent = request.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");
|
||||
}
|
||||
response.setHeader("Content-disposition", "attachment; filename="+ fileName);
|
||||
String userAgent = request.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");
|
||||
}
|
||||
response.setHeader("Content-disposition", "attachment; filename=" + fileName);
|
||||
|
||||
}else{
|
||||
response.setContentType("image/jpeg;charset=utf-8");
|
||||
}
|
||||
} else {
|
||||
response.setContentType("image/jpeg;charset=utf-8");
|
||||
}
|
||||
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream=null;
|
||||
try {
|
||||
String imgurl = localPath+File.separator+dbpath;
|
||||
inputStream = new BufferedInputStream(new FileInputStream(imgurl));
|
||||
outputStream = response.getOutputStream();
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = inputStream.read(buf)) > 0) {
|
||||
outputStream.write(buf, 0, len);
|
||||
}
|
||||
response.flushBuffer();
|
||||
} catch (Exception e) {
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
}finally{
|
||||
if(inputStream!=null){
|
||||
inputStream.close();
|
||||
}
|
||||
if(outputStream!=null){
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@RequestMapping(value="geterpim",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> listim( @RequestParam(value="username", required=false) String username,
|
||||
@RequestParam(value="all", required=false)String all,
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
String imgurl = localPath + File.separator + dbpath;
|
||||
inputStream = new BufferedInputStream(new FileInputStream(imgurl));
|
||||
outputStream = response.getOutputStream();
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = inputStream.read(buf)) > 0) {
|
||||
outputStream.write(buf, 0, len);
|
||||
}
|
||||
response.flushBuffer();
|
||||
} catch (Exception e) {
|
||||
logger.error(ExceptionUtil.getExceptionMessage(e));
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
if (outputStream != null) {
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequestParam(value="searchstr", required=false)String searchstr,
|
||||
@RequestParam(value="searchstr2", required=false)String searchstr2,
|
||||
@RequestParam(value="searchstrin1", required=false)String searchstrin1,
|
||||
@RequestParam(value="searchstrin2", required=false)String searchstrin2,
|
||||
@RequestParam(value="searchstrin3", required=false)String searchstrin3) {
|
||||
@RequestMapping(value = "geterpim", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> listim(@RequestParam(value = "username", required = false) String username,
|
||||
@RequestParam(value = "all", required = false) String all,
|
||||
|
||||
@RequestParam(value = "searchstr", required = false) String searchstr,
|
||||
@RequestParam(value = "searchstr2", required = false) String searchstr2,
|
||||
@RequestParam(value = "searchstrin1", required = false) String searchstrin1,
|
||||
@RequestParam(value = "searchstrin2", required = false) String searchstrin2,
|
||||
@RequestParam(value = "searchstrin3", required = false) String searchstrin3) {
|
||||
|
||||
|
||||
ResultDO D0 = new ResultDO();
|
||||
ResultDO D0 = new ResultDO();
|
||||
|
||||
String hql = " from WmToUpGoodsErpEntity where 1 = 1 ";
|
||||
D0.setOK(true);
|
||||
String hql = " from WmToUpGoodsErpEntity where 1 = 1 ";
|
||||
D0.setOK(true);
|
||||
|
||||
List<WmToUpGoodsErpEntity> listerp = systemService.findHql(hql);
|
||||
D0.setOK(true);
|
||||
List<WmToUpGoodsErpEntity> listerp = systemService.findHql(hql);
|
||||
D0.setOK(true);
|
||||
|
||||
|
||||
D0.setObj(listerp);
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
D0.setObj(listerp);
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value="geterpom",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> listom( @RequestParam(value="username", required=false) String username,
|
||||
@RequestParam(value="all", required=false)String all,
|
||||
@RequestMapping(value = "geterpom", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> listom(@RequestParam(value = "username", required = false) String username,
|
||||
@RequestParam(value = "all", required = false) String all,
|
||||
|
||||
@RequestParam(value="searchstr", required=false)String searchstr,
|
||||
@RequestParam(value="searchstr2", required=false)String searchstr2,
|
||||
@RequestParam(value="searchstrin1", required=false)String searchstrin1,
|
||||
@RequestParam(value="searchstrin2", required=false)String searchstrin2,
|
||||
@RequestParam(value="searchstrin3", required=false)String searchstrin3) {
|
||||
@RequestParam(value = "searchstr", required = false) String searchstr,
|
||||
@RequestParam(value = "searchstr2", required = false) String searchstr2,
|
||||
@RequestParam(value = "searchstrin1", required = false) String searchstrin1,
|
||||
@RequestParam(value = "searchstrin2", required = false) String searchstrin2,
|
||||
@RequestParam(value = "searchstrin3", required = false) String searchstrin3) {
|
||||
|
||||
|
||||
ResultDO D0 = new ResultDO();
|
||||
ResultDO D0 = new ResultDO();
|
||||
|
||||
String hql = " from WmToDownGoodsErpEntity where 1 = 1 ";
|
||||
D0.setOK(true);
|
||||
String hql = " from WmToDownGoodsErpEntity where 1 = 1 ";
|
||||
D0.setOK(true);
|
||||
|
||||
List<WmToDownGoodsErpEntity> listerp = systemService.findHql(hql);
|
||||
D0.setOK(true);
|
||||
List<WmToDownGoodsErpEntity> listerp = systemService.findHql(hql);
|
||||
D0.setOK(true);
|
||||
|
||||
|
||||
D0.setObj(listerp);
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
@RequestMapping(value="runtask",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> runtask( @RequestParam(value="username", required=false) String username,
|
||||
@RequestParam(value="all", required=false)String all,
|
||||
D0.setObj(listerp);
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestParam(value="searchstr", required=false)String searchstr,
|
||||
@RequestParam(value="searchstr2", required=false)String searchstr2,
|
||||
@RequestParam(value="searchstrin1", required=false)String searchstrin1,
|
||||
@RequestParam(value="searchstrin2", required=false)String searchstrin2,
|
||||
@RequestParam(value="searchstrin3", required=false)String searchstrin3) {
|
||||
@RequestMapping(value = "runtask", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> runtask(@RequestParam(value = "username", required = false) String username,
|
||||
@RequestParam(value = "all", required = false) String all,
|
||||
|
||||
@RequestParam(value = "searchstr", required = false) String searchstr,
|
||||
@RequestParam(value = "searchstr2", required = false) String searchstr2,
|
||||
@RequestParam(value = "searchstrin1", required = false) String searchstrin1,
|
||||
@RequestParam(value = "searchstrin2", required = false) String searchstrin2,
|
||||
@RequestParam(value = "searchstrin3", required = false) String searchstrin3) {
|
||||
|
||||
|
||||
ResultDO D0 = new ResultDO();
|
||||
smsSendTask.run();
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
//结转库存
|
||||
@RequestMapping(value="runtaskone",method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> runtaskone( @RequestParam(value="username", required=false) String username,
|
||||
@RequestParam(value="all", required=false)String all,
|
||||
ResultDO D0 = new ResultDO();
|
||||
smsSendTask.run();
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestParam(value="searchstr", required=false)String searchstr,
|
||||
@RequestParam(value="searchstr2", required=false)String searchstr2,
|
||||
@RequestParam(value="searchstrin1", required=false)String searchstrin1,
|
||||
@RequestParam(value="searchstrin2", required=false)String searchstrin2,
|
||||
@RequestParam(value="searchstrin3", required=false)String searchstrin3) {
|
||||
//结转库存
|
||||
@RequestMapping(value = "runtaskone", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public ResponseEntity<?> runtaskone(@RequestParam(value = "username", required = false) String username,
|
||||
@RequestParam(value = "all", required = false) String all,
|
||||
|
||||
@RequestParam(value = "searchstr", required = false) String searchstr,
|
||||
@RequestParam(value = "searchstr2", required = false) String searchstr2,
|
||||
@RequestParam(value = "searchstrin1", required = false) String searchstrin1,
|
||||
@RequestParam(value = "searchstrin2", required = false) String searchstrin2,
|
||||
@RequestParam(value = "searchstrin3", required = false) String searchstrin3) {
|
||||
|
||||
|
||||
ResultDO D0 = new ResultDO();
|
||||
costTask.run();
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
ResultDO D0 = new ResultDO();
|
||||
costTask.run();
|
||||
return new ResponseEntity(D0, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue