代码格式化

master
cez 2022-01-07 13:55:50 +08:00
parent afb16e4b22
commit 37412fb518
4 changed files with 1271 additions and 1256 deletions

View File

@ -1,8 +1,10 @@
package com.zzjee.wmapi.controller; package com.zzjee.wmapi.controller;
import com.zzjee.api.ResultDO; import com.zzjee.api.ResultDO;
import com.zzjee.wmapi.entity.WvGiEntity; import com.zzjee.wmapi.entity.WvGiEntity;
import com.zzjee.wmapi.entity.WvGiNoticeEntity; import com.zzjee.wmapi.entity.WvGiNoticeEntity;
import com.zzjee.wmapi.service.WvGiServiceI; import com.zzjee.wmapi.service.WvGiServiceI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -31,6 +33,7 @@ import org.jeecgframework.web.system.service.SystemService;
import org.jeecgframework.core.util.MyBeanUtils; import org.jeecgframework.core.util.MyBeanUtils;
import java.io.OutputStream; import java.io.OutputStream;
import org.jeecgframework.core.util.BrowserUtils; import org.jeecgframework.core.util.BrowserUtils;
import org.jeecgframework.poi.excel.ExcelExportUtil; import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.ExcelImportUtil; 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.jeecgframework.poi.excel.entity.vo.TemplateExcelConstants;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.jeecgframework.core.util.ResourceUtil; import org.jeecgframework.core.util.ResourceUtil;
import java.io.IOException; import java.io.IOException;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import org.jeecgframework.core.util.ExceptionUtil; import org.jeecgframework.core.util.ExceptionUtil;
import org.springframework.http.ResponseEntity; 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.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.jeecgframework.core.beanvalidator.BeanValidators; import org.jeecgframework.core.beanvalidator.BeanValidators;
import java.util.Set; import java.util.Set;
import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolation;
import javax.validation.Validator; import javax.validation.Validator;
import java.net.URI; import java.net.URI;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.util.UriComponentsBuilder;
/** /**
* @author erzhongxmu
* @version V1.0
* @Title: Controller * @Title: Controller
* @Description: wv_gi * @Description: wv_gi
* @author erzhongxmu
* @date 2018-05-30 20:21:50 * @date 2018-05-30 20:21:50
* @version V1.0
*
*/ */
@Controller @Controller
@RequestMapping("/wvGiController") @RequestMapping("/wvGiController")
public class WvGiController extends BaseController { public class WvGiController extends BaseController {
/** /**
* Logger for this class * Logger for this class
*/ */
private static final Logger logger = Logger.getLogger(WvGiController.class); private static final Logger logger = Logger.getLogger(WvGiController.class);
@Autowired @Autowired
private WvGiServiceI wvGiService; private WvGiServiceI wvGiService;
@Autowired @Autowired
private SystemService systemService; private SystemService systemService;
@Autowired @Autowired
private Validator validator; private Validator validator;
/**
* wv_gi
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wmapi/wvGiList");
}
/** /**
* wv_gi * easyui AJAX
* *
* @return * @param request
*/ * @param response
@RequestMapping(params = "list") * @param dataGrid
public ModelAndView list(HttpServletRequest request) { * @param user
return new ModelAndView("com/zzjee/wmapi/wvGiList"); */
}
/** @RequestMapping(params = "datagrid")
* easyui AJAX public void datagrid(WvGiEntity wvGi, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
* CriteriaQuery cq = new CriteriaQuery(WvGiEntity.class, dataGrid);
* @param request //查询条件组装器
* @param response org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvGi, request.getParameterMap());
* @param dataGrid try {
* @param user //自定义追加查询条件
*/ } 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) { * wv_gi
CriteriaQuery cq = new CriteriaQuery(WvGiEntity.class, dataGrid); *
//查询条件组装器 * @return
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvGi, request.getParameterMap()); */
try{ @RequestMapping(params = "doDel")
//自定义追加查询条件 @ResponseBody
}catch (Exception e) { public AjaxJson doDel(WvGiEntity wvGi, HttpServletRequest request) {
throw new BusinessException(e.getMessage()); String message = null;
} AjaxJson j = new AjaxJson();
cq.add(); wvGi = systemService.getEntity(WvGiEntity.class, wvGi.getId());
this.wvGiService.getDataGridReturn(cq, true); message = "wv_gi删除成功";
TagUtil.datagrid(response, dataGrid); 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 * wv_gi
* *
* @return * @return
*/ */
@RequestMapping(params = "doDel") @RequestMapping(params = "doBatchDel")
@ResponseBody @ResponseBody
public AjaxJson doDel(WvGiEntity wvGi, HttpServletRequest request) { public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
wvGi = systemService.getEntity(WvGiEntity.class, wvGi.getId()); message = "wv_gi删除成功";
message = "wv_gi删除成功"; try {
try{ for (String id : ids.split(",")) {
wvGiService.delete(wvGi); WvGiEntity wvGi = systemService.getEntity(WvGiEntity.class,
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); id
}catch(Exception e){ );
e.printStackTrace(); wvGiService.delete(wvGi);
message = "wv_gi删除失败"; systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
throw new BusinessException(e.getMessage()); }
} } catch (Exception e) {
j.setMsg(message); e.printStackTrace();
return j; message = "wv_gi删除失败";
} throw new BusinessException(e.getMessage());
}
/** j.setMsg(message);
* wv_gi return j;
* }
* @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 * wv_gi
* *
* @param ids * @param ids
* @return * @return
*/ */
@RequestMapping(params = "doAdd") @RequestMapping(params = "doAdd")
@ResponseBody @ResponseBody
public AjaxJson doAdd(WvGiEntity wvGi, HttpServletRequest request) { public AjaxJson doAdd(WvGiEntity wvGi, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "wv_gi添加成功"; message = "wv_gi添加成功";
try{ try {
wvGiService.save(wvGi); wvGiService.save(wvGi);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "wv_gi添加失败"; message = "wv_gi添加失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
} }
/** /**
* wv_gi * wv_gi
* *
* @param ids * @param ids
* @return * @return
*/ */
@RequestMapping(params = "doUpdate") @RequestMapping(params = "doUpdate")
@ResponseBody @ResponseBody
public AjaxJson doUpdate(WvGiEntity wvGi, HttpServletRequest request) { public AjaxJson doUpdate(WvGiEntity wvGi, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "wv_gi更新成功"; message = "wv_gi更新成功";
WvGiEntity t = wvGiService.get(WvGiEntity.class, wvGi.getId()); WvGiEntity t = wvGiService.get(WvGiEntity.class, wvGi.getId());
try { try {
MyBeanUtils.copyBeanNotNull2Bean(wvGi, t); MyBeanUtils.copyBeanNotNull2Bean(wvGi, t);
wvGiService.saveOrUpdate(t); wvGiService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "wv_gi更新失败"; message = "wv_gi更新失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
} }
/** /**
* wv_gi * wv_gi
* *
* @return * @return
*/ */
@RequestMapping(params = "goAdd") @RequestMapping(params = "goAdd")
public ModelAndView goAdd(WvGiEntity wvGi, HttpServletRequest req) { public ModelAndView goAdd(WvGiEntity wvGi, HttpServletRequest req) {
if (StringUtil.isNotEmpty(wvGi.getId())) { if (StringUtil.isNotEmpty(wvGi.getId())) {
wvGi = wvGiService.getEntity(WvGiEntity.class, wvGi.getId()); wvGi = wvGiService.getEntity(WvGiEntity.class, wvGi.getId());
req.setAttribute("wvGiPage", wvGi); req.setAttribute("wvGiPage", wvGi);
} }
return new ModelAndView("com/zzjee/wmapi/wvGi-add"); 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 * @return
*/ */
@RequestMapping(params = "upload") @RequestMapping(params = "goUpdate")
public ModelAndView upload(HttpServletRequest req) { public ModelAndView goUpdate(WvGiEntity wvGi, HttpServletRequest req) {
req.setAttribute("controller_name","wvGiController"); if (StringUtil.isNotEmpty(wvGi.getId())) {
return new ModelAndView("common/upload/pub_excel_upload"); wvGi = wvGiService.getEntity(WvGiEntity.class, wvGi.getId());
} req.setAttribute("wvGiPage", wvGi);
}
return new ModelAndView("com/zzjee/wmapi/wvGi-update");
}
/** /**
* excel *
* *
* @param request * @return
* @param response */
*/ @RequestMapping(params = "upload")
@RequestMapping(params = "exportXls") public ModelAndView upload(HttpServletRequest req) {
public String exportXls(WvGiEntity wvGi,HttpServletRequest request,HttpServletResponse response req.setAttribute("controller_name", "wvGiController");
, DataGrid dataGrid,ModelMap modelMap) { return new ModelAndView("common/upload/pub_excel_upload");
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;
}
@SuppressWarnings("unchecked") /**
@RequestMapping(params = "importExcel", method = RequestMethod.POST) * excel
@ResponseBody *
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) { * @param request
AjaxJson j = new AjaxJson(); * @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(); * excel 使
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { *
MultipartFile file = entity.getValue();// 获取上传文件对象 * @param request
ImportParams params = new ImportParams(); * @param response
params.setTitleRows(2); */
params.setHeadRows(1); @RequestMapping(params = "exportXlsByT")
params.setNeedSave(true); public String exportXlsByT(WvGiEntity wvGi, HttpServletRequest request, HttpServletResponse response
try { , DataGrid dataGrid, ModelMap modelMap) {
List<WvGiEntity> listWvGiEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WvGiEntity.class,params); modelMap.put(NormalExcelConstants.FILE_NAME, "wv_gi");
for (WvGiEntity wvGi : listWvGiEntitys) { modelMap.put(NormalExcelConstants.CLASS, WvGiEntity.class);
wvGiService.save(wvGi); modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("wv_gi列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
} "导出信息"));
j.setMsg("文件导入成功!"); modelMap.put(NormalExcelConstants.DATA_LIST, new ArrayList());
} catch (Exception e) { return NormalExcelConstants.JEECG_EXCEL_VIEW;
j.setMsg("文件导入失败!"); }
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return j;
}
@RequestMapping(method = RequestMethod.GET) @SuppressWarnings("unchecked")
@ResponseBody @RequestMapping(params = "importExcel", method = RequestMethod.POST)
public ResponseEntity<?> list( @RequestParam(value="username", required=false) String username, @RequestParam(value="searchstr", required=false)String searchstr, @RequestParam(value="searchstr2", required=false)String searchstr2) { @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; // return listWvGis;
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
String hql = " from WvGiEntity where downSta is null "; String hql = " from WvGiEntity where downSta is null ";
D0.setOK(true); D0.setOK(true);
if(!StringUtil.isEmpty(searchstr)) { if (!StringUtil.isEmpty(searchstr)) {
hql=hql+" and orderId = '" + searchstr + "'"; hql = hql + " and orderId = '" + searchstr + "'";
} }
if(!StringUtil.isEmpty(searchstr2)) { if (!StringUtil.isEmpty(searchstr2)) {
try{ try {
String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2); String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2);
if(StringUtil.isNotEmpty(shpbianma)){ if (StringUtil.isNotEmpty(shpbianma)) {
searchstr2=shpbianma; searchstr2 = shpbianma;
} }
}catch (Exception e){ } catch (Exception e) {
} }
// hql=hql+" and goodsId = '" + searchstr2 + "'"; // hql=hql+" and goodsId = '" + searchstr2 + "'";
String[] ss = searchstr2.split(","); String[] ss = searchstr2.split(",");
if (ss.length == 1) { if (ss.length == 1) {
hql = hql + " and goodsId = '" + searchstr2 + "'"; hql = hql + " and goodsId = '" + searchstr2 + "'";
} else { } else {
String insearch = ""; String insearch = "";
for (String s : ss) { for (String s : ss) {
if (StringUtil.isNotEmpty(insearch)) { if (StringUtil.isNotEmpty(insearch)) {
insearch = insearch + " or goodsId = '" + s + "'"; insearch = insearch + " or goodsId = '" + s + "'";
} else { } else {
insearch = "goodsId = '" + s + "'"; 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); // List<WvGiEntity> listWvGis=wvGiService.getList(WvGiEntity.class);
D0.setOK(true); D0.setOK(true);
List<WvGiEntity> result = new ArrayList<WvGiEntity>(); List<WvGiEntity> result = new ArrayList<WvGiEntity>();
int i = 0; int i = 0;
for (WvGiEntity t :listWvGis){ for (WvGiEntity t : listWvGis) {
i++; i++;
if(i>100){ if (i > 100) {
break; break;
} }
result.add(t); result.add(t);
} }
D0.setObj(result); D0.setObj(result);
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
@RequestMapping(value = "/{id}", method = RequestMethod.GET) @RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResponseEntity<?> get(@PathVariable("id") String id) { public ResponseEntity<?> get(@PathVariable("id") String id) {
WvGiEntity task = wvGiService.get(WvGiEntity.class, id); WvGiEntity task = wvGiService.get(WvGiEntity.class, id);
if (task == null) { if (task == null) {
return new ResponseEntity(HttpStatus.NOT_FOUND); return new ResponseEntity(HttpStatus.NOT_FOUND);
} }
return new ResponseEntity(task, HttpStatus.OK); return new ResponseEntity(task, HttpStatus.OK);
} }
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody @ResponseBody
public ResponseEntity<?> create(@RequestBody WvGiEntity wvGi, UriComponentsBuilder uriBuilder) { public ResponseEntity<?> create(@RequestBody WvGiEntity wvGi, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息. //调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<WvGiEntity>> failures = validator.validate(wvGi); Set<ConstraintViolation<WvGiEntity>> failures = validator.validate(wvGi);
if (!failures.isEmpty()) { if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST); return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
} }
//保存 //保存
try{ try {
wvGiService.save(wvGi); wvGiService.save(wvGi);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
//按照Restful风格约定创建指向新任务的url, 也可以直接返回id或对象. //按照Restful风格约定创建指向新任务的url, 也可以直接返回id或对象.
String id = wvGi.getId(); String id = wvGi.getId();
URI uri = uriBuilder.path("/rest/wvGiController/" + id).build().toUri(); URI uri = uriBuilder.path("/rest/wvGiController/" + id).build().toUri();
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setLocation(uri); 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) @RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> update(@RequestBody WvGiEntity wvGi) { public ResponseEntity<?> update(@RequestBody WvGiEntity wvGi) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息. //调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<WvGiEntity>> failures = validator.validate(wvGi); Set<ConstraintViolation<WvGiEntity>> failures = validator.validate(wvGi);
if (!failures.isEmpty()) { if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST); return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
} }
//保存 //保存
try{ try {
wvGiService.saveOrUpdate(wvGi); wvGiService.saveOrUpdate(wvGi);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
//按Restful约定返回204状态码, 无内容. 也可以返回200状态码. //按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable("id") String id) { public void delete(@PathVariable("id") String id) {
wvGiService.deleteEntityById(WvGiEntity.class, id); wvGiService.deleteEntityById(WvGiEntity.class, id);
} }
} }

View File

@ -1,4 +1,5 @@
package com.zzjee.wmapi.controller; package com.zzjee.wmapi.controller;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
@ -55,442 +56,443 @@ import com.zzjee.wmapi.service.WvGiNoticeServiceI;
import com.zzjee.wmutil.wmUtil; import com.zzjee.wmutil.wmUtil;
/** /**
* @author erzhongxmu
* @version V1.0
* @Title: Controller * @Title: Controller
* @Description: wv_gi_notice * @Description: wv_gi_notice
* @author erzhongxmu
* @date 2018-05-30 20:20:38 * @date 2018-05-30 20:20:38
* @version V1.0
*
*/ */
@Controller @Controller
@RequestMapping("/wvGiNoticeController") @RequestMapping("/wvGiNoticeController")
public class WvGiNoticeController extends BaseController { public class WvGiNoticeController extends BaseController {
/** /**
* Logger for this class * Logger for this class
*/ */
private static final Logger logger = Logger.getLogger(WvGiNoticeController.class); private static final Logger logger = Logger.getLogger(WvGiNoticeController.class);
@Autowired @Autowired
private WvGiNoticeServiceI wvGiNoticeService; private WvGiNoticeServiceI wvGiNoticeService;
@Autowired @Autowired
private SystemService systemService; private SystemService systemService;
@Autowired @Autowired
private Validator validator; 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 * easyui AJAX
* *
* @return * @param request
*/ * @param response
@RequestMapping(params = "list") * @param dataGrid
public ModelAndView list(HttpServletRequest request) { */
return new ModelAndView("com/zzjee/wmapi/wvGiNoticeList");
}
/** @RequestMapping(params = "datagrid")
* easyui AJAX public void datagrid(WvGiNoticeEntity wvGiNotice, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
* CriteriaQuery cq = new CriteriaQuery(WvGiNoticeEntity.class, dataGrid);
* @param request //查询条件组装器
* @param response org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvGiNotice, request.getParameterMap());
* @param dataGrid 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) { * wv_gi_notice
CriteriaQuery cq = new CriteriaQuery(WvGiNoticeEntity.class, dataGrid); *
//查询条件组装器 * @return
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvGiNotice, request.getParameterMap()); */
try{ @RequestMapping(params = "doDel")
//自定义追加查询条件 @ResponseBody
}catch (Exception e) { public AjaxJson doDel(WvGiNoticeEntity wvGiNotice, HttpServletRequest request) {
throw new BusinessException(e.getMessage()); String message = null;
} AjaxJson j = new AjaxJson();
cq.add(); wvGiNotice = systemService.getEntity(WvGiNoticeEntity.class, wvGiNotice.getId());
this.wvGiNoticeService.getDataGridReturn(cq, true); message = "wv_gi_notice删除成功";
TagUtil.datagrid(response, dataGrid); 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 * wv_gi_notice
* *
* @return * @return
*/ */
@RequestMapping(params = "doDel") @RequestMapping(params = "doBatchDel")
@ResponseBody @ResponseBody
public AjaxJson doDel(WvGiNoticeEntity wvGiNotice, HttpServletRequest request) { public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
wvGiNotice = systemService.getEntity(WvGiNoticeEntity.class, wvGiNotice.getId()); message = "wv_gi_notice删除成功";
message = "wv_gi_notice删除成功"; try {
try{ for (String id : ids.split(",")) {
wvGiNoticeService.delete(wvGiNotice); WvGiNoticeEntity wvGiNotice = systemService.getEntity(WvGiNoticeEntity.class,
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); id
}catch(Exception e){ );
e.printStackTrace(); wvGiNoticeService.delete(wvGiNotice);
message = "wv_gi_notice删除失败"; systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
throw new BusinessException(e.getMessage()); }
} } catch (Exception e) {
j.setMsg(message); e.printStackTrace();
return j; message = "wv_gi_notice删除失败";
} throw new BusinessException(e.getMessage());
}
/** j.setMsg(message);
* wv_gi_notice return j;
* }
* @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 * wv_gi_notice
* *
* @return * @return
*/ */
@RequestMapping(params = "doAdd") @RequestMapping(params = "doAdd")
@ResponseBody @ResponseBody
public AjaxJson doAdd(WvGiNoticeEntity wvGiNotice, HttpServletRequest request) { public AjaxJson doAdd(WvGiNoticeEntity wvGiNotice, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "wv_gi_notice添加成功"; message = "wv_gi_notice添加成功";
try{ try {
wvGiNoticeService.save(wvGiNotice); wvGiNoticeService.save(wvGiNotice);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "wv_gi_notice添加失败"; message = "wv_gi_notice添加失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
} }
/** /**
* wv_gi_notice * wv_gi_notice
* *
* @return * @return
*/ */
@RequestMapping(params = "doUpdate") @RequestMapping(params = "doUpdate")
@ResponseBody @ResponseBody
public AjaxJson doUpdate(WvGiNoticeEntity wvGiNotice, HttpServletRequest request) { public AjaxJson doUpdate(WvGiNoticeEntity wvGiNotice, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "wv_gi_notice更新成功"; message = "wv_gi_notice更新成功";
WvGiNoticeEntity t = wvGiNoticeService.get(WvGiNoticeEntity.class, wvGiNotice.getId()); WvGiNoticeEntity t = wvGiNoticeService.get(WvGiNoticeEntity.class, wvGiNotice.getId());
try { try {
MyBeanUtils.copyBeanNotNull2Bean(wvGiNotice, t); MyBeanUtils.copyBeanNotNull2Bean(wvGiNotice, t);
wvGiNoticeService.saveOrUpdate(t); wvGiNoticeService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "wv_gi_notice更新失败"; message = "wv_gi_notice更新失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
} }
/** /**
* wv_gi_notice * wv_gi_notice
* *
* @return * @return
*/ */
@RequestMapping(params = "goAdd") @RequestMapping(params = "goAdd")
public ModelAndView goAdd(WvGiNoticeEntity wvGiNotice, HttpServletRequest req) { public ModelAndView goAdd(WvGiNoticeEntity wvGiNotice, HttpServletRequest req) {
if (StringUtil.isNotEmpty(wvGiNotice.getId())) { if (StringUtil.isNotEmpty(wvGiNotice.getId())) {
wvGiNotice = wvGiNoticeService.getEntity(WvGiNoticeEntity.class, wvGiNotice.getId()); wvGiNotice = wvGiNoticeService.getEntity(WvGiNoticeEntity.class, wvGiNotice.getId());
req.setAttribute("wvGiNoticePage", wvGiNotice); req.setAttribute("wvGiNoticePage", wvGiNotice);
} }
return new ModelAndView("com/zzjee/wmapi/wvGiNotice-add"); 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 * @return
*/ */
@RequestMapping(params = "upload") @RequestMapping(params = "goUpdate")
public ModelAndView upload(HttpServletRequest req) { public ModelAndView goUpdate(WvGiNoticeEntity wvGiNotice, HttpServletRequest req) {
req.setAttribute("controller_name","wvGiNoticeController"); if (StringUtil.isNotEmpty(wvGiNotice.getId())) {
return new ModelAndView("common/upload/pub_excel_upload"); wvGiNotice = wvGiNoticeService.getEntity(WvGiNoticeEntity.class, wvGiNotice.getId());
} req.setAttribute("wvGiNoticePage", wvGiNotice);
}
return new ModelAndView("com/zzjee/wmapi/wvGiNotice-update");
}
/** /**
* excel *
* *
* @param request * @return
* @param response */
*/ @RequestMapping(params = "upload")
@RequestMapping(params = "exportXls") public ModelAndView upload(HttpServletRequest req) {
public String exportXls(WvGiNoticeEntity wvGiNotice,HttpServletRequest request,HttpServletResponse response req.setAttribute("controller_name", "wvGiNoticeController");
, DataGrid dataGrid,ModelMap modelMap) { return new ModelAndView("common/upload/pub_excel_upload");
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;
}
@SuppressWarnings("unchecked") /**
@RequestMapping(params = "importExcel", method = RequestMethod.POST) * excel
@ResponseBody *
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) { * @param request
AjaxJson j = new AjaxJson(); * @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(); * excel 使
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { *
MultipartFile file = entity.getValue();// 获取上传文件对象 * @param request
ImportParams params = new ImportParams(); * @param response
params.setTitleRows(2); */
params.setHeadRows(1); @RequestMapping(params = "exportXlsByT")
params.setNeedSave(true); public String exportXlsByT(WvGiNoticeEntity wvGiNotice, HttpServletRequest request, HttpServletResponse response
try { , DataGrid dataGrid, ModelMap modelMap) {
List<WvGiNoticeEntity> listWvGiNoticeEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WvGiNoticeEntity.class,params); modelMap.put(NormalExcelConstants.FILE_NAME, "wv_gi_notice");
for (WvGiNoticeEntity wvGiNotice : listWvGiNoticeEntitys) { modelMap.put(NormalExcelConstants.CLASS, WvGiNoticeEntity.class);
wvGiNoticeService.save(wvGiNotice); modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("wv_gi_notice列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
} "导出信息"));
j.setMsg("文件导入成功!"); modelMap.put(NormalExcelConstants.DATA_LIST, new ArrayList());
} catch (Exception e) { return NormalExcelConstants.JEECG_EXCEL_VIEW;
j.setMsg("文件导入失败!"); }
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{
try {
file.getInputStream().close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return j;
}
@RequestMapping(method = RequestMethod.GET) @SuppressWarnings("unchecked")
@ResponseBody @RequestMapping(params = "importExcel", method = RequestMethod.POST)
public ResponseEntity<?> list() { @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) { // public ResponseEntity<?> list(@RequestParam String username, @RequestParam String searchstr) {
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
List<WvGiNoticeEntity> listWvGiNotices=wvGiNoticeService.getList(WvGiNoticeEntity.class); List<WvGiNoticeEntity> listWvGiNotices = wvGiNoticeService.getList(WvGiNoticeEntity.class);
D0.setOK(true); D0.setOK(true);
D0.setObj(listWvGiNotices); D0.setObj(listWvGiNotices);
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
//下架任务 PDA接口 //下架任务 PDA接口
@RequestMapping(value = "/search",method = RequestMethod.GET) @RequestMapping(value = "/search", method = RequestMethod.GET)
@ResponseBody @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) { 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; // return listWvGis;
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
String hql = " from WvGiNoticeEntity where 1 = 1 "; String hql = " from WvGiNoticeEntity where 1 = 1 ";
D0.setOK(true); D0.setOK(true);
if(!StringUtil.isEmpty(searchstr)) { if (!StringUtil.isEmpty(searchstr)) {
hql=hql+" and omNoticeId like '%" + searchstr + "%'" +" or imCusCode like '%" + searchstr + "%'"; hql = hql + " and omNoticeId like '%" + searchstr + "%'" + " or imCusCode like '%" + searchstr + "%'";
} }
if(!StringUtil.isEmpty(searchstr2)) { if (!StringUtil.isEmpty(searchstr2)) {
try{ try {
String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2); String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2);
if(StringUtil.isNotEmpty(shpbianma)){ if (StringUtil.isNotEmpty(shpbianma)) {
searchstr2=shpbianma; searchstr2 = shpbianma;
} }
}catch (Exception e){ } catch (Exception e) {
} }
// hql=hql+" and goodsId = '" + searchstr2 + "'"; // hql=hql+" and goodsId = '" + searchstr2 + "'";
String[] ss = searchstr2.split(","); String[] ss = searchstr2.split(",");
if (ss.length == 1) { if (ss.length == 1) {
hql = hql + " and goodsId like '%" + searchstr2 + "%'"; hql = hql + " and goodsId like '%" + searchstr2 + "%'";
} else { } else {
String insearch = ""; String insearch = "";
for (String s : ss) { for (String s : ss) {
if (StringUtil.isNotEmpty(insearch)) { if (StringUtil.isNotEmpty(insearch)) {
insearch = insearch + " or goodsId = '" + s + "'"; insearch = insearch + " or goodsId = '" + s + "'";
} else { } else {
insearch = "goodsId = '" + s + "'"; insearch = "goodsId = '" + s + "'";
} }
} }
hql = hql + " and (" + insearch + ")"; hql = hql + " and (" + insearch + ")";
} }
} }
if(!StringUtil.isEmpty(searchstr3)) { if (!StringUtil.isEmpty(searchstr3)) {
hql=hql+" and binId = '" + searchstr3 + "'"; hql = hql + " and binId = '" + searchstr3 + "'";
} }
List<WvGiNoticeEntity> listWvGiNotices=wvGiNoticeService.findHql(hql); List<WvGiNoticeEntity> listWvGiNotices = wvGiNoticeService.findHql(hql);
if(listWvGiNotices==null||listWvGiNotices.size()==0){ if (listWvGiNotices == null || listWvGiNotices.size() == 0) {
hql = " from WvGiNoticeEntity where 1 = 1 "; hql = " from WvGiNoticeEntity where 1 = 1 ";
if(!StringUtil.isEmpty(searchstr)) { if (!StringUtil.isEmpty(searchstr)) {
hql=hql+" and omNoticeId = '" + searchstr + "'"; hql = hql + " and omNoticeId = '" + searchstr + "'";
} }
listWvGiNotices=wvGiNoticeService.findHql(hql); listWvGiNotices = wvGiNoticeService.findHql(hql);
} }
// public ResponseEntity<?> list(@RequestParam String username, @RequestParam String searchstr) { // public ResponseEntity<?> list(@RequestParam String username, @RequestParam String searchstr) {
// ResultDO D0 = new ResultDO(); // ResultDO D0 = new ResultDO();
// List<WvGiNoticeEntity> listWvGiNotices=wvGiNoticeService.getList(WvGiNoticeEntity.class); // List<WvGiNoticeEntity> listWvGiNotices=wvGiNoticeService.getList(WvGiNoticeEntity.class);
D0.setOK(true); D0.setOK(true);
List<WvGiNoticeEntity> result = new ArrayList<WvGiNoticeEntity>(); List<WvGiNoticeEntity> result = new ArrayList<WvGiNoticeEntity>();
int i = 0; int i = 0;
for (WvGiNoticeEntity t :listWvGiNotices){ for (WvGiNoticeEntity t : listWvGiNotices) {
if(StringUtil.isNotEmpty(username)&&StringUtil.isNotEmpty(t.getAssignTo())){ if (StringUtil.isNotEmpty(username) && StringUtil.isNotEmpty(t.getAssignTo())) {
if(!username.equals(t.getAssignTo())){ if (!username.equals(t.getAssignTo())) {
continue; continue;
} }
} }
i++; i++;
if(i>100){ if (i > 100) {
break; break;
} }
try{ try {
String siji = ""; String siji = "";
String chehao = ""; String chehao = "";
WmOmNoticeHEntity wmom = systemService.findUniqueByProperty(WmOmNoticeHEntity.class,"omNoticeId",t.getOmNoticeId()); WmOmNoticeHEntity wmom = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "omNoticeId", t.getOmNoticeId());
siji = wmom.getReMember(); siji = wmom.getReMember();
chehao = wmom.getReCarno(); chehao = wmom.getReCarno();
if(StringUtil.isNotEmpty(t.getOmBeiZhu())){ if (StringUtil.isNotEmpty(t.getOmBeiZhu())) {
t.setOmBeiZhu(t.getOmBeiZhu()+siji+chehao); t.setOmBeiZhu(t.getOmBeiZhu() + siji + chehao);
}else{ } else {
t.setOmBeiZhu(siji+chehao); t.setOmBeiZhu(siji + chehao);
} }
}catch (Exception e){ } catch (Exception e) {
} }
result.add(t); result.add(t);
} }
D0.setObj(result); D0.setObj(result);
return new ResponseEntity(D0, HttpStatus.OK); 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);
}
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResponseEntity<?> create(@RequestBody WvGiNoticeEntity wvGiNotice, UriComponentsBuilder uriBuilder) { public ResponseEntity<?> get(@PathVariable("id") String id) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息. WvGiNoticeEntity task = wvGiNoticeService.get(WvGiNoticeEntity.class, id);
Set<ConstraintViolation<WvGiNoticeEntity>> failures = validator.validate(wvGiNotice); if (task == null) {
if (!failures.isEmpty()) { return new ResponseEntity(HttpStatus.NOT_FOUND);
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST); }
} return new ResponseEntity(task, HttpStatus.OK);
}
//保存 @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
try{ @ResponseBody
wvGiNoticeService.save(wvGiNotice); public ResponseEntity<?> create(@RequestBody WvGiNoticeEntity wvGiNotice, UriComponentsBuilder uriBuilder) {
} catch (Exception e) { //调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
e.printStackTrace(); Set<ConstraintViolation<WvGiNoticeEntity>> failures = validator.validate(wvGiNotice);
return new ResponseEntity(HttpStatus.NO_CONTENT); if (!failures.isEmpty()) {
} return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
//按照Restful风格约定创建指向新任务的url, 也可以直接返回id或对象. }
String id = wvGiNotice.getId();
URI uri = uriBuilder.path("/rest/wvGiNoticeController/" + id).build().toUri();
HttpHeaders headers = new HttpHeaders();
headers.setLocation(uri);
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) return new ResponseEntity(headers, HttpStatus.CREATED);
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);
}
//保存 @RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
try{ public ResponseEntity<?> update(@RequestBody WvGiNoticeEntity wvGiNotice) {
wvGiNoticeService.saveOrUpdate(wvGiNotice); //调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
} catch (Exception e) { Set<ConstraintViolation<WvGiNoticeEntity>> failures = validator.validate(wvGiNotice);
e.printStackTrace(); if (!failures.isEmpty()) {
return new ResponseEntity(HttpStatus.NO_CONTENT); 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) //按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
@ResponseStatus(HttpStatus.NO_CONTENT) return new ResponseEntity(HttpStatus.NO_CONTENT);
public void delete(@PathVariable("id") String id) { }
wvGiNoticeService.deleteEntityById(WvGiNoticeEntity.class, id);
} @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable("id") String id) {
wvGiNoticeService.deleteEntityById(WvGiNoticeEntity.class, id);
}
} }

View File

@ -1,4 +1,5 @@
package com.zzjee.wmapi.controller; package com.zzjee.wmapi.controller;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.ArrayList;
@ -54,393 +55,394 @@ import com.zzjee.wmapi.service.WvNoticeServiceI;
import com.zzjee.wmutil.wmUtil; import com.zzjee.wmutil.wmUtil;
/** /**
* @author erzhongxmu
* @version V1.0
* @Title: Controller * @Title: Controller
* @Description: wv_notice * @Description: wv_notice
* @author erzhongxmu
* @date 2018-05-30 20:21:05 * @date 2018-05-30 20:21:05
* @version V1.0
*
*/ */
@Controller @Controller
@RequestMapping("/wvNoticeController") @RequestMapping("/wvNoticeController")
public class WvNoticeController extends BaseController { public class WvNoticeController extends BaseController {
/** /**
* Logger for this class * Logger for this class
*/ */
private static final Logger logger = Logger.getLogger(WvNoticeController.class); private static final Logger logger = Logger.getLogger(WvNoticeController.class);
@Autowired @Autowired
private WvNoticeServiceI wvNoticeService; private WvNoticeServiceI wvNoticeService;
@Autowired @Autowired
private SystemService systemService; private SystemService systemService;
@Autowired @Autowired
private Validator validator; private Validator validator;
/**
* wv_notice
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wmapi/wvNoticeList");
}
/** /**
* wv_notice * easyui AJAX
* *
* @return * @param request
*/ * @param response
@RequestMapping(params = "list") * @param dataGrid
public ModelAndView list(HttpServletRequest request) { * @param user
return new ModelAndView("com/zzjee/wmapi/wvNoticeList"); */
}
/** @RequestMapping(params = "datagrid")
* easyui AJAX public void datagrid(WvNoticeEntity wvNotice, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
* CriteriaQuery cq = new CriteriaQuery(WvNoticeEntity.class, dataGrid);
* @param request //查询条件组装器
* @param response org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvNotice, request.getParameterMap());
* @param dataGrid try {
* @param user //自定义追加查询条件
*/ } 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) { * wv_notice
CriteriaQuery cq = new CriteriaQuery(WvNoticeEntity.class, dataGrid); *
//查询条件组装器 * @return
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wvNotice, request.getParameterMap()); */
try{ @RequestMapping(params = "doDel")
//自定义追加查询条件 @ResponseBody
}catch (Exception e) { public AjaxJson doDel(WvNoticeEntity wvNotice, HttpServletRequest request) {
throw new BusinessException(e.getMessage()); String message = null;
} AjaxJson j = new AjaxJson();
cq.add(); wvNotice = systemService.getEntity(WvNoticeEntity.class, wvNotice.getId());
this.wvNoticeService.getDataGridReturn(cq, true); message = "wv_notice删除成功";
TagUtil.datagrid(response, dataGrid); 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 * wv_notice
* *
* @return * @return
*/ */
@RequestMapping(params = "doDel") @RequestMapping(params = "doBatchDel")
@ResponseBody @ResponseBody
public AjaxJson doDel(WvNoticeEntity wvNotice, HttpServletRequest request) { public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
wvNotice = systemService.getEntity(WvNoticeEntity.class, wvNotice.getId()); message = "wv_notice删除成功";
message = "wv_notice删除成功"; try {
try{ for (String id : ids.split(",")) {
wvNoticeService.delete(wvNotice); WvNoticeEntity wvNotice = systemService.getEntity(WvNoticeEntity.class,
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); id
}catch(Exception e){ );
e.printStackTrace(); wvNoticeService.delete(wvNotice);
message = "wv_notice删除失败"; systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
throw new BusinessException(e.getMessage()); }
} } catch (Exception e) {
j.setMsg(message); e.printStackTrace();
return j; message = "wv_notice删除失败";
} throw new BusinessException(e.getMessage());
}
/** j.setMsg(message);
* wv_notice return j;
* }
* @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 * wv_notice
* *
* @param ids * @param ids
* @return * @return
*/ */
@RequestMapping(params = "doAdd") @RequestMapping(params = "doAdd")
@ResponseBody @ResponseBody
public AjaxJson doAdd(WvNoticeEntity wvNotice, HttpServletRequest request) { public AjaxJson doAdd(WvNoticeEntity wvNotice, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "wv_notice添加成功"; message = "wv_notice添加成功";
try{ try {
wvNoticeService.save(wvNotice); wvNoticeService.save(wvNotice);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
}catch(Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "wv_notice添加失败"; message = "wv_notice添加失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
} }
/** /**
* wv_notice * wv_notice
* *
* @param ids * @param ids
* @return * @return
*/ */
@RequestMapping(params = "doUpdate") @RequestMapping(params = "doUpdate")
@ResponseBody @ResponseBody
public AjaxJson doUpdate(WvNoticeEntity wvNotice, HttpServletRequest request) { public AjaxJson doUpdate(WvNoticeEntity wvNotice, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "wv_notice更新成功"; message = "wv_notice更新成功";
WvNoticeEntity t = wvNoticeService.get(WvNoticeEntity.class, wvNotice.getId()); WvNoticeEntity t = wvNoticeService.get(WvNoticeEntity.class, wvNotice.getId());
try { try {
MyBeanUtils.copyBeanNotNull2Bean(wvNotice, t); MyBeanUtils.copyBeanNotNull2Bean(wvNotice, t);
wvNoticeService.saveOrUpdate(t); wvNoticeService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO); systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "wv_notice更新失败"; message = "wv_notice更新失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
} }
/** /**
* wv_notice * wv_notice
* *
* @return * @return
*/ */
@RequestMapping(params = "goAdd") @RequestMapping(params = "goAdd")
public ModelAndView goAdd(WvNoticeEntity wvNotice, HttpServletRequest req) { public ModelAndView goAdd(WvNoticeEntity wvNotice, HttpServletRequest req) {
if (StringUtil.isNotEmpty(wvNotice.getId())) { if (StringUtil.isNotEmpty(wvNotice.getId())) {
wvNotice = wvNoticeService.getEntity(WvNoticeEntity.class, wvNotice.getId()); wvNotice = wvNoticeService.getEntity(WvNoticeEntity.class, wvNotice.getId());
req.setAttribute("wvNoticePage", wvNotice); req.setAttribute("wvNoticePage", wvNotice);
} }
return new ModelAndView("com/zzjee/wmapi/wvNotice-add"); 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 * @return
*/ */
@RequestMapping(params = "upload") @RequestMapping(params = "goUpdate")
public ModelAndView upload(HttpServletRequest req) { public ModelAndView goUpdate(WvNoticeEntity wvNotice, HttpServletRequest req) {
req.setAttribute("controller_name","wvNoticeController"); if (StringUtil.isNotEmpty(wvNotice.getId())) {
return new ModelAndView("common/upload/pub_excel_upload"); wvNotice = wvNoticeService.getEntity(WvNoticeEntity.class, wvNotice.getId());
} req.setAttribute("wvNoticePage", wvNotice);
}
return new ModelAndView("com/zzjee/wmapi/wvNotice-update");
}
/** /**
* excel *
* *
* @param request * @return
* @param response */
*/ @RequestMapping(params = "upload")
@RequestMapping(params = "exportXls") public ModelAndView upload(HttpServletRequest req) {
public String exportXls(WvNoticeEntity wvNotice,HttpServletRequest request,HttpServletResponse response req.setAttribute("controller_name", "wvNoticeController");
, DataGrid dataGrid,ModelMap modelMap) { return new ModelAndView("common/upload/pub_excel_upload");
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;
}
@SuppressWarnings("unchecked") /**
@RequestMapping(params = "importExcel", method = RequestMethod.POST) * excel
@ResponseBody *
public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) { * @param request
AjaxJson j = new AjaxJson(); * @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(); * excel 使
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { *
MultipartFile file = entity.getValue();// 获取上传文件对象 * @param request
ImportParams params = new ImportParams(); * @param response
params.setTitleRows(2); */
params.setHeadRows(1); @RequestMapping(params = "exportXlsByT")
params.setNeedSave(true); public String exportXlsByT(WvNoticeEntity wvNotice, HttpServletRequest request, HttpServletResponse response
try { , DataGrid dataGrid, ModelMap modelMap) {
List<WvNoticeEntity> listWvNoticeEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WvNoticeEntity.class,params); modelMap.put(NormalExcelConstants.FILE_NAME, "wv_notice");
for (WvNoticeEntity wvNotice : listWvNoticeEntitys) { modelMap.put(NormalExcelConstants.CLASS, WvNoticeEntity.class);
wvNoticeService.save(wvNotice); modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("wv_notice列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
} "导出信息"));
j.setMsg("文件导入成功!"); modelMap.put(NormalExcelConstants.DATA_LIST, new ArrayList());
} catch (Exception e) { return NormalExcelConstants.JEECG_EXCEL_VIEW;
j.setMsg("文件导入失败!"); }
logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{ @SuppressWarnings("unchecked")
try { @RequestMapping(params = "importExcel", method = RequestMethod.POST)
file.getInputStream().close(); @ResponseBody
} catch (IOException e) { public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
e.printStackTrace(); AjaxJson j = new AjaxJson();
}
} MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
} Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
return j; for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
} MultipartFile file = entity.getValue();// 获取上传文件对象
//PDA接口 ImportParams params = new ImportParams();
@RequestMapping(method = RequestMethod.GET) params.setTitleRows(2);
@ResponseBody params.setHeadRows(1);
public ResponseEntity<?> list( @RequestParam(value="username", required=false) String username, @RequestParam(value="searchstr", required=false)String searchstr, @RequestParam(value="searchstr2", required=false)String searchstr2) { 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; // return listWvGis;
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
String hql = " from WvNoticeEntity where 1 = 1 "; String hql = " from WvNoticeEntity where 1 = 1 ";
D0.setOK(true); D0.setOK(true);
if(!StringUtil.isEmpty(searchstr)) { if (!StringUtil.isEmpty(searchstr)) {
hql=hql+" and noticeId like '%" + searchstr + "%'" +" or imCusCode like '%" + searchstr + "%'"; hql = hql + " and noticeId like '%" + searchstr + "%'" + " or imCusCode like '%" + searchstr + "%'";
} }
if(!StringUtil.isEmpty(searchstr2)) { if (!StringUtil.isEmpty(searchstr2)) {
try{ try {
String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2); String shpbianma = wmUtil.getmdgoodsbytiaoma(searchstr2);
if(StringUtil.isNotEmpty(shpbianma)){ if (StringUtil.isNotEmpty(shpbianma)) {
searchstr2=shpbianma; searchstr2 = shpbianma;
} }
}catch (Exception e){ } catch (Exception e) {
} }
String[] ss = searchstr2.split(","); String[] ss = searchstr2.split(",");
if (ss.length == 1) { if (ss.length == 1) {
hql = hql + " and (goodsCode like '%" + searchstr2 + "%'"+"or shp_ming_cheng like '%"+searchstr2+"%')"; hql = hql + " and (goodsCode like '%" + searchstr2 + "%'" + "or shp_ming_cheng like '%" + searchstr2 + "%')";
} else { } else {
String insearch = ""; String insearch = "";
for (String s : ss) { for (String s : ss) {
if (StringUtil.isNotEmpty(insearch)) { if (StringUtil.isNotEmpty(insearch)) {
insearch = insearch + " or goodsCode = '" + s + "'"; insearch = insearch + " or goodsCode = '" + s + "'";
} else { } else {
insearch = "goodsCode = '" + s + "'"; insearch = "goodsCode = '" + s + "'";
} }
} }
hql = hql + " and (" + insearch + ")"; hql = hql + " and (" + insearch + ")";
} }
// hql=hql+" and goodsCode in (:alist)"; // hql=hql+" and goodsCode in (:alist)";
} }
List<WvNoticeEntity> listWvNotices=wvNoticeService.findHql(hql); List<WvNoticeEntity> listWvNotices = wvNoticeService.findHql(hql);
D0.setOK(true); D0.setOK(true);
List<WvNoticeEntity> result = new ArrayList<WvNoticeEntity>(); List<WvNoticeEntity> result = new ArrayList<WvNoticeEntity>();
int i = 0; int i = 0;
for (WvNoticeEntity t :listWvNotices){ for (WvNoticeEntity t : listWvNotices) {
i++; i++;
if(i>100){ if (i > 100) {
break; break;
} }
result.add(t); result.add(t);
} }
D0.setObj(result); D0.setObj(result);
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
@RequestMapping(value = "/{id}", method = RequestMethod.GET) @RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResponseEntity<?> get(@PathVariable("id") String id) { public ResponseEntity<?> get(@PathVariable("id") String id) {
WvNoticeEntity task = wvNoticeService.get(WvNoticeEntity.class, id); WvNoticeEntity task = wvNoticeService.get(WvNoticeEntity.class, id);
if (task == null) { if (task == null) {
return new ResponseEntity(HttpStatus.NOT_FOUND); return new ResponseEntity(HttpStatus.NOT_FOUND);
} }
return new ResponseEntity(task, HttpStatus.OK); return new ResponseEntity(task, HttpStatus.OK);
} }
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody @ResponseBody
public ResponseEntity<?> create(@RequestBody WvNoticeEntity wvNotice, UriComponentsBuilder uriBuilder) { public ResponseEntity<?> create(@RequestBody WvNoticeEntity wvNotice, UriComponentsBuilder uriBuilder) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息. //调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<WvNoticeEntity>> failures = validator.validate(wvNotice); Set<ConstraintViolation<WvNoticeEntity>> failures = validator.validate(wvNotice);
if (!failures.isEmpty()) { if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST); return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
} }
//保存 //保存
try{ try {
wvNoticeService.save(wvNotice); wvNoticeService.save(wvNotice);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
//按照Restful风格约定创建指向新任务的url, 也可以直接返回id或对象. //按照Restful风格约定创建指向新任务的url, 也可以直接返回id或对象.
String id = wvNotice.getId(); String id = wvNotice.getId();
URI uri = uriBuilder.path("/rest/wvNoticeController/" + id).build().toUri(); URI uri = uriBuilder.path("/rest/wvNoticeController/" + id).build().toUri();
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.setLocation(uri); 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) @RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> update(@RequestBody WvNoticeEntity wvNotice) { public ResponseEntity<?> update(@RequestBody WvNoticeEntity wvNotice) {
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息. //调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
Set<ConstraintViolation<WvNoticeEntity>> failures = validator.validate(wvNotice); Set<ConstraintViolation<WvNoticeEntity>> failures = validator.validate(wvNotice);
if (!failures.isEmpty()) { if (!failures.isEmpty()) {
return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST); return new ResponseEntity(BeanValidators.extractPropertyAndMessage(failures), HttpStatus.BAD_REQUEST);
} }
//保存 //保存
try{ try {
wvNoticeService.saveOrUpdate(wvNotice); wvNoticeService.saveOrUpdate(wvNotice);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
//按Restful约定返回204状态码, 无内容. 也可以返回200状态码. //按Restful约定返回204状态码, 无内容. 也可以返回200状态码.
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE) @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT) @ResponseStatus(HttpStatus.NO_CONTENT)
public void delete(@PathVariable("id") String id) { public void delete(@PathVariable("id") String id) {
wvNoticeService.deleteEntityById(WvNoticeEntity.class, id); wvNoticeService.deleteEntityById(WvNoticeEntity.class, id);
} }
} }

View File

@ -50,238 +50,241 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
/** /**
* @author erzhongxmu
* @version V1.0
* @Title: wmBaseControllerController * @Title: wmBaseControllerController
* @Description: wmBaseController * @Description: wmBaseController
* @author erzhongxmu
* @date 2018-05-30 20:21:50 * @date 2018-05-30 20:21:50
* @version V1.0
*
*/ */
@Controller @Controller
@RequestMapping("/wmBaseController") @RequestMapping("/wmBaseController")
public class wmBaseController extends BaseController { public class wmBaseController extends BaseController {
/** /**
* Logger for this class * Logger for this class
*/ */
private static final Logger logger = Logger.getLogger(wmBaseController.class); private static final Logger logger = Logger.getLogger(wmBaseController.class);
// @Autowired // @Autowired
// private WvGiServiceI wvGiService; // private WvGiServiceI wvGiService;
@Autowired @Autowired
private SystemService systemService; private SystemService systemService;
@Autowired @Autowired
private SmsSendTask smsSendTask; private SmsSendTask smsSendTask;
@Autowired @Autowired
private CostTask costTask; private CostTask costTask;
// @Autowired // @Autowired
// private Validator validator; // 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"); @RequestMapping(value = "showOrDownbarcodeByurl", method = RequestMethod.GET)
String dbpath = qrvalue+".jpg"; public void getbarcodeImgByurl(HttpServletResponse response, HttpServletRequest request) throws Exception {
String localPath=ResourceUtil.getConfigByName("webUploadpath"); request.setCharacterEncoding("UTF-8");
String flag = request.getParameter("down");//是否下载否则展示图片
try{ String qrvalue = request.getParameter("qrvalue");
String imgurl = localPath+File.separator+dbpath; String dbpath = qrvalue + ".jpg";
String localPath = ResourceUtil.getConfigByName("webUploadpath");
try {
String imgurl = localPath + File.separator + dbpath;
// QRcodeUtil.encode(qrvalue,imgurl); // QRcodeUtil.encode(qrvalue,imgurl);
BarcodeUtil.generateFile(qrvalue,imgurl); BarcodeUtil.generateFile(qrvalue, imgurl);
}catch (Exception e){ } catch (Exception e) {
} }
if("1".equals(flag)){ if ("1".equals(flag)) {
response.setContentType("application/x-msdownload;charset=utf-8"); response.setContentType("application/x-msdownload;charset=utf-8");
String fileName=dbpath.substring(dbpath.lastIndexOf(File.separator)+1); String fileName = dbpath.substring(dbpath.lastIndexOf(File.separator) + 1);
String userAgent = request.getHeader("user-agent").toLowerCase(); String userAgent = request.getHeader("user-agent").toLowerCase();
if (userAgent.contains("msie") || userAgent.contains("like gecko") ) { if (userAgent.contains("msie") || userAgent.contains("like gecko")) {
fileName = URLEncoder.encode(fileName, "UTF-8"); fileName = URLEncoder.encode(fileName, "UTF-8");
}else { } else {
fileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1"); fileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1");
} }
response.setHeader("Content-disposition", "attachment; filename="+ fileName); response.setHeader("Content-disposition", "attachment; filename=" + fileName);
}else{ } else {
response.setContentType("image/jpeg;charset=utf-8"); response.setContentType("image/jpeg;charset=utf-8");
} }
InputStream inputStream = null; InputStream inputStream = null;
OutputStream outputStream=null; OutputStream outputStream = null;
try { try {
String imgurl = localPath+File.separator+dbpath; String imgurl = localPath + File.separator + dbpath;
inputStream = new BufferedInputStream(new FileInputStream(imgurl)); inputStream = new BufferedInputStream(new FileInputStream(imgurl));
outputStream = response.getOutputStream(); outputStream = response.getOutputStream();
byte[] buf = new byte[1024]; byte[] buf = new byte[1024];
int len; int len;
while ((len = inputStream.read(buf)) > 0) { while ((len = inputStream.read(buf)) > 0) {
outputStream.write(buf, 0, len); outputStream.write(buf, 0, len);
} }
response.flushBuffer(); response.flushBuffer();
} catch (Exception e) { } catch (Exception e) {
logger.error(ExceptionUtil.getExceptionMessage(e)); logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{ } finally {
if(inputStream!=null){ if (inputStream != null) {
inputStream.close(); inputStream.close();
} }
if(outputStream!=null){ if (outputStream != null) {
outputStream.close(); outputStream.close();
} }
} }
} }
/** /**
* / * /
* @param response *
* @param request * @param response
* @throws Exception * @param request
* http://localhost:8080/zzjee/wmOmNoticeHController/showOrDownqrcodeByurl.do?&qrvalue=1111223333 调用 * @throws Exception http://localhost:8080/zzjee/wmOmNoticeHController/showOrDownqrcodeByurl.do?&qrvalue=1111223333 调用
*/ */
@RequestMapping(value="showOrDownqrcodeByurl",method = RequestMethod.GET) @RequestMapping(value = "showOrDownqrcodeByurl", method = RequestMethod.GET)
public void getQrImgByurl(HttpServletResponse response, HttpServletRequest request) throws Exception{ public void getQrImgByurl(HttpServletResponse response, HttpServletRequest request) throws Exception {
request.setCharacterEncoding("UTF-8"); request.setCharacterEncoding("UTF-8");
String flag=request.getParameter("down");//是否下载否则展示图片 String flag = request.getParameter("down");//是否下载否则展示图片
String qrvalue = request.getParameter("qrvalue"); String qrvalue = request.getParameter("qrvalue");
String dbpath = qrvalue+".jpg"; String dbpath = qrvalue + ".jpg";
String localPath=ResourceUtil.getConfigByName("webUploadpath"); String localPath = ResourceUtil.getConfigByName("webUploadpath");
try{ try {
String imgurl = localPath+File.separator+dbpath; String imgurl = localPath + File.separator + dbpath;
QRcodeUtil.encode(qrvalue,imgurl); QRcodeUtil.encode(qrvalue, imgurl);
}catch (Exception e){ } catch (Exception e) {
} }
if("1".equals(flag)){ if ("1".equals(flag)) {
response.setContentType("application/x-msdownload;charset=utf-8"); response.setContentType("application/x-msdownload;charset=utf-8");
String fileName=dbpath.substring(dbpath.lastIndexOf(File.separator)+1); String fileName = dbpath.substring(dbpath.lastIndexOf(File.separator) + 1);
String userAgent = request.getHeader("user-agent").toLowerCase(); String userAgent = request.getHeader("user-agent").toLowerCase();
if (userAgent.contains("msie") || userAgent.contains("like gecko") ) { if (userAgent.contains("msie") || userAgent.contains("like gecko")) {
fileName = URLEncoder.encode(fileName, "UTF-8"); fileName = URLEncoder.encode(fileName, "UTF-8");
}else { } else {
fileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1"); fileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1");
} }
response.setHeader("Content-disposition", "attachment; filename="+ fileName); response.setHeader("Content-disposition", "attachment; filename=" + fileName);
}else{ } else {
response.setContentType("image/jpeg;charset=utf-8"); response.setContentType("image/jpeg;charset=utf-8");
} }
InputStream inputStream = null; InputStream inputStream = null;
OutputStream outputStream=null; OutputStream outputStream = null;
try { try {
String imgurl = localPath+File.separator+dbpath; String imgurl = localPath + File.separator + dbpath;
inputStream = new BufferedInputStream(new FileInputStream(imgurl)); inputStream = new BufferedInputStream(new FileInputStream(imgurl));
outputStream = response.getOutputStream(); outputStream = response.getOutputStream();
byte[] buf = new byte[1024]; byte[] buf = new byte[1024];
int len; int len;
while ((len = inputStream.read(buf)) > 0) { while ((len = inputStream.read(buf)) > 0) {
outputStream.write(buf, 0, len); outputStream.write(buf, 0, len);
} }
response.flushBuffer(); response.flushBuffer();
} catch (Exception e) { } catch (Exception e) {
logger.error(ExceptionUtil.getExceptionMessage(e)); logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{ } finally {
if(inputStream!=null){ if (inputStream != null) {
inputStream.close(); inputStream.close();
} }
if(outputStream!=null){ if (outputStream != null) {
outputStream.close(); 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,
@RequestParam(value="searchstr", required=false)String searchstr, @RequestMapping(value = "geterpim", method = RequestMethod.GET)
@RequestParam(value="searchstr2", required=false)String searchstr2, @ResponseBody
@RequestParam(value="searchstrin1", required=false)String searchstrin1, public ResponseEntity<?> listim(@RequestParam(value = "username", required = false) String username,
@RequestParam(value="searchstrin2", required=false)String searchstrin2, @RequestParam(value = "all", required = false) String all,
@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 WmToUpGoodsErpEntity where 1 = 1 "; String hql = " from WmToUpGoodsErpEntity where 1 = 1 ";
D0.setOK(true); D0.setOK(true);
List<WmToUpGoodsErpEntity> listerp = systemService.findHql(hql); List<WmToUpGoodsErpEntity> listerp = systemService.findHql(hql);
D0.setOK(true); D0.setOK(true);
D0.setObj(listerp); D0.setObj(listerp);
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
@RequestMapping(value="geterpom",method = RequestMethod.GET) @RequestMapping(value = "geterpom", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ResponseEntity<?> listom( @RequestParam(value="username", required=false) String username, public ResponseEntity<?> listom(@RequestParam(value = "username", required = false) String username,
@RequestParam(value="all", required=false)String all, @RequestParam(value = "all", required = false) String all,
@RequestParam(value="searchstr", required=false)String searchstr, @RequestParam(value = "searchstr", required = false) String searchstr,
@RequestParam(value="searchstr2", required=false)String searchstr2, @RequestParam(value = "searchstr2", required = false) String searchstr2,
@RequestParam(value="searchstrin1", required=false)String searchstrin1, @RequestParam(value = "searchstrin1", required = false) String searchstrin1,
@RequestParam(value="searchstrin2", required=false)String searchstrin2, @RequestParam(value = "searchstrin2", required = false) String searchstrin2,
@RequestParam(value="searchstrin3", required=false)String searchstrin3) { @RequestParam(value = "searchstrin3", required = false) String searchstrin3) {
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
String hql = " from WmToDownGoodsErpEntity where 1 = 1 "; String hql = " from WmToDownGoodsErpEntity where 1 = 1 ";
D0.setOK(true); D0.setOK(true);
List<WmToDownGoodsErpEntity> listerp = systemService.findHql(hql); List<WmToDownGoodsErpEntity> listerp = systemService.findHql(hql);
D0.setOK(true); D0.setOK(true);
D0.setObj(listerp); D0.setObj(listerp);
return new ResponseEntity(D0, HttpStatus.OK); 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,
@RequestParam(value="searchstr", required=false)String searchstr, @RequestMapping(value = "runtask", method = RequestMethod.GET)
@RequestParam(value="searchstr2", required=false)String searchstr2, @ResponseBody
@RequestParam(value="searchstrin1", required=false)String searchstrin1, public ResponseEntity<?> runtask(@RequestParam(value = "username", required = false) String username,
@RequestParam(value="searchstrin2", required=false)String searchstrin2, @RequestParam(value = "all", required = false) String all,
@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();
smsSendTask.run(); smsSendTask.run();
return new ResponseEntity(D0, HttpStatus.OK); 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,
@RequestParam(value="searchstr", required=false)String searchstr, //结转库存
@RequestParam(value="searchstr2", required=false)String searchstr2, @RequestMapping(value = "runtaskone", method = RequestMethod.GET)
@RequestParam(value="searchstrin1", required=false)String searchstrin1, @ResponseBody
@RequestParam(value="searchstrin2", required=false)String searchstrin2, public ResponseEntity<?> runtaskone(@RequestParam(value = "username", required = false) String username,
@RequestParam(value="searchstrin3", required=false)String searchstrin3) { @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();
costTask.run(); costTask.run();
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
} }