code format

master
erzhongxmu 2024-02-23 18:26:51 +08:00
parent 7ea711d21d
commit e3c411950e
2 changed files with 403 additions and 434 deletions

View File

@ -75,13 +75,6 @@ import org.springframework.web.util.UriComponentsBuilder;
import static com.xiaoleilu.hutool.date.DateTime.now; import static com.xiaoleilu.hutool.date.DateTime.now;
/**
* @author onlineGenerator
* @version V1.0
* @Title: Controller
* @Description: wave_to_down
* @date 2019-12-11 11:32:25
*/
@Controller @Controller
@RequestMapping("/waveToDownController") @RequestMapping("/waveToDownController")
public class WaveToDownController extends BaseController { public class WaveToDownController extends BaseController {
@ -115,10 +108,6 @@ public class WaveToDownController extends BaseController {
public ModelAndView doPrint(String waveid, HttpServletRequest request) { public ModelAndView doPrint(String waveid, HttpServletRequest request) {
String hql = "from WmOmQmIEntity where waveId = ? "; String hql = "from WmOmQmIEntity where waveId = ? ";
List<WmOmQmIEntity> wavelist = systemService.findHql(hql, waveid); List<WmOmQmIEntity> wavelist = systemService.findHql(hql, waveid);
// for(WmOmQmIEntity t: wavelist ){
// t.setFirstRq("已打印");
// systemService.updateEntitie(t);
// }
request.setAttribute("kprq", DateUtils.date2Str(DateUtils.date_sdf)); request.setAttribute("kprq", DateUtils.date2Str(DateUtils.date_sdf));
request.setAttribute("comname", ResourceUtil.getConfigByName("comname")); request.setAttribute("comname", ResourceUtil.getConfigByName("comname"));
request.setAttribute("waveid", waveid); request.setAttribute("waveid", waveid);
@ -134,11 +123,6 @@ public class WaveToDownController extends BaseController {
CriteriaQuery cq = new CriteriaQuery(WaveToDownEntity.class, dataGrid); CriteriaQuery cq = new CriteriaQuery(WaveToDownEntity.class, dataGrid);
//查询条件组装器 //查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, waveToDown, request.getParameterMap()); org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, waveToDown, request.getParameterMap());
try {
//自定义追加查询条件
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add(); cq.add();
this.waveToDownService.getDataGridReturn(cq, true); this.waveToDownService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid); TagUtil.datagrid(response, dataGrid);
@ -161,8 +145,7 @@ public class WaveToDownController extends BaseController {
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO); systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "wave_to_down删除失败"; throw new BusinessException(e.getMessage());
throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
@ -189,8 +172,7 @@ public class WaveToDownController extends BaseController {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "wave_to_down删除失败"; throw new BusinessException(e.getMessage());
throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
@ -213,8 +195,7 @@ public class WaveToDownController extends BaseController {
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 = "wave_to_down添加失败"; throw new BusinessException(e.getMessage());
throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
@ -238,8 +219,7 @@ public class WaveToDownController extends BaseController {
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 = "wave_to_down更新失败"; throw new BusinessException(e.getMessage());
throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
@ -467,18 +447,13 @@ public class WaveToDownController extends BaseController {
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
D0.setOK(true); D0.setOK(true);
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
@RequestMapping(value = "/jsondown", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/jsondown", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> update(@RequestBody WaveToDownEntity waveToDown) { public ResponseEntity<?> update(@RequestBody WaveToDownEntity waveToDown) {
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息. //调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
//保存 //保存
try { try {
String hql = "from WmOmQmIEntity where waveId = ? and goodsId = ? and proData = ? and tinId = ? and binId = ? and binSta = ?"; String hql = "from WmOmQmIEntity where waveId = ? and goodsId = ? and proData = ? and tinId = ? and binId = ? and binSta = ?";
@ -504,7 +479,6 @@ public class WaveToDownController extends BaseController {
wmToDownGoods.setImCusCode(wmOmQmI.getImCusCode());//客户单号 wmToDownGoods.setImCusCode(wmOmQmI.getImCusCode());//客户单号
wmToDownGoods.setOrderType("99");//默认为01 wmToDownGoods.setOrderType("99");//默认为01
wmToDownGoods.setCreateDate(now()); wmToDownGoods.setCreateDate(now());
systemService.save(wmToDownGoods); systemService.save(wmToDownGoods);
wmOmQmI.setBinSta("H"); wmOmQmI.setBinSta("H");
wmOmQmI.setFirstRq(waveToDown.getFirstRq()); wmOmQmI.setFirstRq(waveToDown.getFirstRq());

View File

@ -1,8 +1,10 @@
package com.zzjee.wave.controller; package com.zzjee.wave.controller;
import com.zzjee.api.ResultDO; import com.zzjee.api.ResultDO;
import com.zzjee.wave.entity.WaveToDownEntity; import com.zzjee.wave.entity.WaveToDownEntity;
import com.zzjee.wave.entity.WaveToFjEntity; import com.zzjee.wave.entity.WaveToFjEntity;
import com.zzjee.wave.service.WaveToFjServiceI; import com.zzjee.wave.service.WaveToFjServiceI;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -46,6 +48,7 @@ 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;
@ -57,452 +60,444 @@ 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;
/**
* @Title: Controller
* @Description: wave_to_fj
* @author onlineGenerator
* @date 2019-12-11 11:32:18
* @version V1.0
*
*/
@Controller @Controller
@RequestMapping("/waveToFjController") @RequestMapping("/waveToFjController")
public class WaveToFjController extends BaseController { public class WaveToFjController extends BaseController {
/** /**
* Logger for this class * Logger for this class
*/ */
private static final Logger logger = Logger.getLogger(WaveToFjController.class); private static final Logger logger = Logger.getLogger(WaveToFjController.class);
@Autowired @Autowired
private WaveToFjServiceI waveToFjService; private WaveToFjServiceI waveToFjService;
@Autowired @Autowired
private SystemService systemService; private SystemService systemService;
@Autowired
private Validator validator;
/**
* wave_to_fj
*
* @return
*/
@RequestMapping(params = "list")
public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wave/waveToFjList");
}
/** /**
* wave_to_fj * easyui AJAX
* *
* @return * @param request
*/ * @param response
@RequestMapping(params = "list") * @param dataGrid
public ModelAndView list(HttpServletRequest request) { */
return new ModelAndView("com/zzjee/wave/waveToFjList");
}
/** @RequestMapping(params = "datagrid")
* easyui AJAX public void datagrid(WaveToFjEntity waveToFj, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
* CriteriaQuery cq = new CriteriaQuery(WaveToFjEntity.class, dataGrid);
* @param request //查询条件组装器
* @param response org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, waveToFj, request.getParameterMap());
* @param dataGrid try {
//自定义追加查询条件
} catch (Exception e) {
throw new BusinessException(e.getMessage());
}
cq.add();
this.waveToFjService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid);
}
*/ /**
* wave_to_fj
*
* @return
*/
@RequestMapping(params = "doDel")
@ResponseBody
public AjaxJson doDel(WaveToFjEntity waveToFj, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
waveToFj = systemService.getEntity(WaveToFjEntity.class, waveToFj.getId());
message = "wave_to_fj";
try {
waveToFjService.delete(waveToFj);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "wave_to_fj";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
@RequestMapping(params = "datagrid") /**
public void datagrid(WaveToFjEntity waveToFj,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { * wave_to_fj
CriteriaQuery cq = new CriteriaQuery(WaveToFjEntity.class, dataGrid); *
//查询条件组装器 * @return
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, waveToFj, request.getParameterMap()); */
try{ @RequestMapping(params = "doBatchDel")
//自定义追加查询条件 @ResponseBody
}catch (Exception e) { public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
throw new BusinessException(e.getMessage()); String message = null;
} AjaxJson j = new AjaxJson();
cq.add(); message = "wave_to_fj";
this.waveToFjService.getDataGridReturn(cq, true); try {
TagUtil.datagrid(response, dataGrid); for (String id : ids.split(",")) {
} WaveToFjEntity waveToFj = systemService.getEntity(WaveToFjEntity.class,
id
/** );
* wave_to_fj waveToFjService.delete(waveToFj);
* systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
* @return }
*/ } catch (Exception e) {
@RequestMapping(params = "doDel") e.printStackTrace();
@ResponseBody message = "wave_to_fj";
public AjaxJson doDel(WaveToFjEntity waveToFj, HttpServletRequest request) { throw new BusinessException(e.getMessage());
String message = null; }
AjaxJson j = new AjaxJson(); j.setMsg(message);
waveToFj = systemService.getEntity(WaveToFjEntity.class, waveToFj.getId()); return j;
message = "wave_to_fj"; }
try{
waveToFjService.delete(waveToFj);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}catch(Exception e){
e.printStackTrace();
message = "wave_to_fj";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/**
* wave_to_fj
*
* @return
*/
@RequestMapping(params = "doBatchDel")
@ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){
String message = null;
AjaxJson j = new AjaxJson();
message = "wave_to_fj";
try{
for(String id:ids.split(",")){
WaveToFjEntity waveToFj = systemService.getEntity(WaveToFjEntity.class,
id
);
waveToFjService.delete(waveToFj);
systemService.addLog(message, Globals.Log_Type_DEL, Globals.Log_Leavel_INFO);
}
}catch(Exception e){
e.printStackTrace();
message = "wave_to_fj";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/** /**
* wave_to_fj * wave_to_fj
* *
* @return
*/
@RequestMapping(params = "doAdd")
@ResponseBody
public AjaxJson doAdd(WaveToFjEntity waveToFj, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "wave_to_fj添加成功";
try {
waveToFjService.save(waveToFj);
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "wave_to_fj添加失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
* @return /**
*/ * wave_to_fj
@RequestMapping(params = "doAdd") *
@ResponseBody * @return
public AjaxJson doAdd(WaveToFjEntity waveToFj, HttpServletRequest request) { */
String message = null; @RequestMapping(params = "doUpdate")
AjaxJson j = new AjaxJson(); @ResponseBody
message = "wave_to_fj添加成功"; public AjaxJson doUpdate(WaveToFjEntity waveToFj, HttpServletRequest request) {
try{ String message = null;
waveToFjService.save(waveToFj); AjaxJson j = new AjaxJson();
systemService.addLog(message, Globals.Log_Type_INSERT, Globals.Log_Leavel_INFO); message = "wave_to_fj更新成功";
}catch(Exception e){ WaveToFjEntity t = waveToFjService.get(WaveToFjEntity.class, waveToFj.getId());
e.printStackTrace(); try {
message = "wave_to_fj添加失败"; MyBeanUtils.copyBeanNotNull2Bean(waveToFj, t);
throw new BusinessException(e.getMessage()); waveToFjService.saveOrUpdate(t);
} systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
j.setMsg(message); } catch (Exception e) {
return j; e.printStackTrace();
} message = "wave_to_fj更新失败";
throw new BusinessException(e.getMessage());
/** }
* wave_to_fj j.setMsg(message);
* return j;
}
* @return
*/
@RequestMapping(params = "doUpdate")
@ResponseBody
public AjaxJson doUpdate(WaveToFjEntity waveToFj, HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "wave_to_fj更新成功";
WaveToFjEntity t = waveToFjService.get(WaveToFjEntity.class, waveToFj.getId());
try {
MyBeanUtils.copyBeanNotNull2Bean(waveToFj, t);
waveToFjService.saveOrUpdate(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, Globals.Log_Leavel_INFO);
} catch (Exception e) {
e.printStackTrace();
message = "wave_to_fj更新失败";
throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
/** /**
* wave_to_fj * wave_to_fj
* *
* @return * @return
*/ */
@RequestMapping(params = "goAdd") @RequestMapping(params = "goAdd")
public ModelAndView goAdd(WaveToFjEntity waveToFj, HttpServletRequest req) { public ModelAndView goAdd(WaveToFjEntity waveToFj, HttpServletRequest req) {
if (StringUtil.isNotEmpty(waveToFj.getId())) { if (StringUtil.isNotEmpty(waveToFj.getId())) {
waveToFj = waveToFjService.getEntity(WaveToFjEntity.class, waveToFj.getId()); waveToFj = waveToFjService.getEntity(WaveToFjEntity.class, waveToFj.getId());
req.setAttribute("waveToFjPage", waveToFj); req.setAttribute("waveToFjPage", waveToFj);
} }
return new ModelAndView("com/zzjee/wave/waveToFj-add"); return new ModelAndView("com/zzjee/wave/waveToFj-add");
} }
/**
* wave_to_fj
*
* @return
*/
@RequestMapping(params = "goUpdate")
public ModelAndView goUpdate(WaveToFjEntity waveToFj, HttpServletRequest req) {
if (StringUtil.isNotEmpty(waveToFj.getId())) {
waveToFj = waveToFjService.getEntity(WaveToFjEntity.class, waveToFj.getId());
req.setAttribute("waveToFjPage", waveToFj);
}
return new ModelAndView("com/zzjee/wave/waveToFj-update");
}
/** /**
* * wave_to_fj
* *
* @return * @return
*/ */
@RequestMapping(params = "upload") @RequestMapping(params = "goUpdate")
public ModelAndView upload(HttpServletRequest req) { public ModelAndView goUpdate(WaveToFjEntity waveToFj, HttpServletRequest req) {
req.setAttribute("controller_name","waveToFjController"); if (StringUtil.isNotEmpty(waveToFj.getId())) {
return new ModelAndView("common/upload/pub_excel_upload"); waveToFj = waveToFjService.getEntity(WaveToFjEntity.class, waveToFj.getId());
} req.setAttribute("waveToFjPage", waveToFj);
}
return new ModelAndView("com/zzjee/wave/waveToFj-update");
}
/** /**
* excel *
* *
* @param request * @return
* @param response */
*/ @RequestMapping(params = "upload")
@RequestMapping(params = "exportXls") public ModelAndView upload(HttpServletRequest req) {
public String exportXls(WaveToFjEntity waveToFj,HttpServletRequest request,HttpServletResponse response req.setAttribute("controller_name", "waveToFjController");
, DataGrid dataGrid,ModelMap modelMap) { return new ModelAndView("common/upload/pub_excel_upload");
CriteriaQuery cq = new CriteriaQuery(WaveToFjEntity.class, dataGrid); }
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, waveToFj, request.getParameterMap());
List<WaveToFjEntity> waveToFjs = this.waveToFjService.getListByCriteriaQuery(cq,false);
modelMap.put(NormalExcelConstants.FILE_NAME,"wave_to_fj");
modelMap.put(NormalExcelConstants.CLASS,WaveToFjEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("wave_to_fj列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,waveToFjs);
return NormalExcelConstants.JEECG_EXCEL_VIEW;
}
/**
* excel 使
*
* @param request
* @param response
*/
@RequestMapping(params = "exportXlsByT")
public String exportXlsByT(WaveToFjEntity waveToFj,HttpServletRequest request,HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"wave_to_fj");
modelMap.put(NormalExcelConstants.CLASS,WaveToFjEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("wave_to_fj列表", "导出人:"+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(WaveToFjEntity waveToFj, HttpServletRequest request, HttpServletResponse response
, DataGrid dataGrid, ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(WaveToFjEntity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, waveToFj, request.getParameterMap());
List<WaveToFjEntity> waveToFjs = this.waveToFjService.getListByCriteriaQuery(cq, false);
modelMap.put(NormalExcelConstants.FILE_NAME, "wave_to_fj");
modelMap.put(NormalExcelConstants.CLASS, WaveToFjEntity.class);
modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("wave_to_fj列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
"导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST, waveToFjs);
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(WaveToFjEntity waveToFj, HttpServletRequest request, HttpServletResponse response
try { , DataGrid dataGrid, ModelMap modelMap) {
List<WaveToFjEntity> listWaveToFjEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WaveToFjEntity.class,params); modelMap.put(NormalExcelConstants.FILE_NAME, "wave_to_fj");
for (WaveToFjEntity waveToFj : listWaveToFjEntitys) { modelMap.put(NormalExcelConstants.CLASS, WaveToFjEntity.class);
waveToFjService.save(waveToFj); modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("wave_to_fj列表", "导出人:" + 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 List<WaveToFjEntity> list() { @ResponseBody
List<WaveToFjEntity> listWaveToFjs=waveToFjService.getList(WaveToFjEntity.class); public AjaxJson importExcel(HttpServletRequest request, HttpServletResponse response) {
return listWaveToFjs; AjaxJson j = new AjaxJson();
}
@RequestMapping(value = "/list/tofj", 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,//一次容器
@RequestParam(value="searchstr3", required=false)String searchstr3,//商品编码
@RequestParam(value="searchstr4", required=false)String searchstr4,//二次容器
@RequestParam(value="searchstr5", required=false)String searchstr5)//排序方式
{
ResultDO D0 = new ResultDO();
D0.setOK(true);
String hql="from WaveToDownEntity where waveId = ? ";
List<WaveToFjEntity> listWaveToFjs =new ArrayList<>(); MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
List<WaveToFjEntity> listWaveToFjsnew =new ArrayList<>(); Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
if(StringUtil.isEmpty(searchstr5)||"null".equals(searchstr5)){ for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
searchstr5 = "asc"; MultipartFile file = entity.getValue();// 获取上传文件对象
} ImportParams params = new ImportParams();
String orderby = "order by secondRq " + searchstr5; params.setTitleRows(2);
if(StringUtil.isEmpty(searchstr)&&StringUtil.isEmpty(searchstr2)){ params.setHeadRows(1);
hql="from WaveToFjEntity where 1 = 1 "+orderby; params.setNeedSave(true);
listWaveToFjs=waveToFjService.findHql(hql); try {
} List<WaveToFjEntity> listWaveToFjEntitys = ExcelImportUtil.importExcel(file.getInputStream(), WaveToFjEntity.class, params);
if(StringUtil.isNotEmpty(searchstr)&&StringUtil.isEmpty(searchstr2)){ for (WaveToFjEntity waveToFj : listWaveToFjEntitys) {
hql="from WaveToFjEntity where waveId = ? "+orderby; waveToFjService.save(waveToFj);
listWaveToFjs=waveToFjService.findHql(hql,searchstr); }
} j.setMsg("文件导入成功!");
if(StringUtil.isEmpty(searchstr)&&StringUtil.isNotEmpty(searchstr2)){ } catch (Exception e) {
hql="from WaveToFjEntity where firstRq = ? "+orderby; j.setMsg("文件导入失败!");
listWaveToFjs=waveToFjService.findHql(hql,searchstr2); logger.error(ExceptionUtil.getExceptionMessage(e));
} } finally {
if(StringUtil.isNotEmpty(searchstr)&&StringUtil.isNotEmpty(searchstr2)){ try {
hql="from WaveToFjEntity where waveId = ? and firstRq = ?"+orderby; file.getInputStream().close();
listWaveToFjs=waveToFjService.findHql(hql,searchstr,searchstr2); } catch (IOException e) {
} e.printStackTrace();
}
}
}
return j;
}
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public List<WaveToFjEntity> list() {
List<WaveToFjEntity> listWaveToFjs = waveToFjService.getList(WaveToFjEntity.class);
return listWaveToFjs;
}
@RequestMapping(value = "/list/tofj", 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,//一次容器
@RequestParam(value = "searchstr3", required = false) String searchstr3,//商品编码
@RequestParam(value = "searchstr4", required = false) String searchstr4,//二次容器
@RequestParam(value = "searchstr5", required = false) String searchstr5)//排序方式
{
ResultDO D0 = new ResultDO();
D0.setOK(true);
String hql = "from WaveToDownEntity where waveId = ? ";
List<WaveToFjEntity> listWaveToFjs = new ArrayList<>();
List<WaveToFjEntity> listWaveToFjsnew = new ArrayList<>();
if (StringUtil.isEmpty(searchstr5) || "null".equals(searchstr5)) {
searchstr5 = "asc";
}
String orderby = "order by secondRq " + searchstr5;
if (StringUtil.isEmpty(searchstr) && StringUtil.isEmpty(searchstr2)) {
hql = "from WaveToFjEntity where 1 = 1 " + orderby;
listWaveToFjs = waveToFjService.findHql(hql);
}
if (StringUtil.isNotEmpty(searchstr) && StringUtil.isEmpty(searchstr2)) {
hql = "from WaveToFjEntity where waveId = ? " + orderby;
listWaveToFjs = waveToFjService.findHql(hql, searchstr);
}
if (StringUtil.isEmpty(searchstr) && StringUtil.isNotEmpty(searchstr2)) {
hql = "from WaveToFjEntity where firstRq = ? " + orderby;
listWaveToFjs = waveToFjService.findHql(hql, searchstr2);
}
if (StringUtil.isNotEmpty(searchstr) && StringUtil.isNotEmpty(searchstr2)) {
hql = "from WaveToFjEntity where waveId = ? and firstRq = ?" + orderby;
listWaveToFjs = waveToFjService.findHql(hql, searchstr, searchstr2);
}
// List<WaveToFjEntity> listWaveToFjs=waveToFjService.getList(WaveToFjEntity.class); // List<WaveToFjEntity> listWaveToFjs=waveToFjService.getList(WaveToFjEntity.class);
String omnoticeid="1"; String omnoticeid = "1";
String siji = ""; String siji = "";
String chehao = ""; String chehao = "";
System.out.println("11111searchstr3="+searchstr3); System.out.println("11111searchstr3=" + searchstr3);
for(WaveToFjEntity t:listWaveToFjs) { for (WaveToFjEntity t : listWaveToFjs) {
System.out.println("searchstr4="+searchstr4); System.out.println("searchstr4=" + searchstr4);
if(StringUtil.isNotEmpty(searchstr4)){ if (StringUtil.isNotEmpty(searchstr4)) {
if ( !StringUtil.strPos(t.getSecondRq(), searchstr4) ) { if (!StringUtil.strPos(t.getSecondRq(), searchstr4)) {
continue; continue;
} }
} }
if (StringUtil.isNotEmpty(searchstr3)) { if (StringUtil.isNotEmpty(searchstr3)) {
System.out.println("t.getGoodsId()="+t.getGoodsId()); System.out.println("t.getGoodsId()=" + t.getGoodsId());
System.out.println("searchstr3="+searchstr3); System.out.println("searchstr3=" + searchstr3);
try{ try {
if (!(StringUtil.strPos(t.getGoodsId(), searchstr3)||StringUtil.strPos(t.getShpTiaoMa(),searchstr3))) { if (!(StringUtil.strPos(t.getGoodsId(), searchstr3) || StringUtil.strPos(t.getShpTiaoMa(), searchstr3))) {
continue; continue;
} }
}catch (Exception e){ } catch (Exception e) {
} }
} }
WaveToFjEntity t1 = new WaveToFjEntity(); WaveToFjEntity t1 = new WaveToFjEntity();
try{ try {
MyBeanUtils.copyBean2Bean(t1,t); MyBeanUtils.copyBean2Bean(t1, t);
}catch (Exception e){ } catch (Exception e) {
} }
try { try {
if(omnoticeid.equals( t.getOmNoticeId())){ if (omnoticeid.equals(t.getOmNoticeId())) {
t1.setBy1(siji);//司机 t1.setBy1(siji);//司机
t1.setBy2(chehao);//车号 t1.setBy2(chehao);//车号
}else{ } else {
WmOmNoticeHEntity wmom = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "omNoticeId", t.getOmNoticeId()); WmOmNoticeHEntity wmom = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "omNoticeId", t.getOmNoticeId());
omnoticeid =t.getOmNoticeId(); omnoticeid = t.getOmNoticeId();
siji = wmom.getReMember(); siji = wmom.getReMember();
chehao = wmom.getReCarno(); chehao = wmom.getReCarno();
t1.setBy1(siji);//司机 t1.setBy1(siji);//司机
t1.setBy2(chehao);//车号 t1.setBy2(chehao);//车号
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
listWaveToFjsnew.add(t1); listWaveToFjsnew.add(t1);
} }
D0.setObj(listWaveToFjsnew); D0.setObj(listWaveToFjsnew);
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ResponseBody @RequestMapping(value = "/{id}", method = RequestMethod.GET)
public ResponseEntity<?> get(@PathVariable("id") String id) { @ResponseBody
WaveToFjEntity task = waveToFjService.get(WaveToFjEntity.class, id); public ResponseEntity<?> get(@PathVariable("id") String id) {
if (task == null) { WaveToFjEntity task = waveToFjService.get(WaveToFjEntity.class, id);
return new ResponseEntity(HttpStatus.NOT_FOUND); if (task == null) {
} 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(@RequestParam String waveToFjstr , UriComponentsBuilder uriBuilder) { public ResponseEntity<?> create(@RequestParam String waveToFjstr, UriComponentsBuilder uriBuilder) {
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息. //调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
WaveToFjEntity waveToFj = (WaveToFjEntity)JSONHelper.json2Object(waveToFjstr,WaveToFjEntity.class); WaveToFjEntity waveToFj = (WaveToFjEntity) JSONHelper.json2Object(waveToFjstr, WaveToFjEntity.class);
//保存 //保存
try{ try {
String omnoticeid =""; String omnoticeid = "";
WmOmQmIEntity wmOmQmI = systemService.getEntity( WmOmQmIEntity wmOmQmI = systemService.getEntity(
WmOmQmIEntity.class, waveToFj.getId()); WmOmQmIEntity.class, waveToFj.getId());
if (wmOmQmI != null&&wmOmQmI.getBinSta().equals("H")) { if (wmOmQmI != null && wmOmQmI.getBinSta().equals("H")) {
wmOmQmI.setBinSta("Y"); wmOmQmI.setBinSta("Y");
wmOmQmI.setSecondRq(waveToFj.getSecondRq()); wmOmQmI.setSecondRq(waveToFj.getSecondRq());
wmOmQmI.setUpdateBy(waveToFj.getCreateBy());//分拣人 wmOmQmI.setUpdateBy(waveToFj.getCreateBy());//分拣人
systemService.saveOrUpdate(wmOmQmI); systemService.saveOrUpdate(wmOmQmI);
String hql = "From WmOmQmIEntity where omNoticeId = ? and binSta = ?"; String hql = "From WmOmQmIEntity where omNoticeId = ? and binSta = ?";
List<WmOmQmIEntity> listom = systemService.findHql(hql,wmOmQmI.getOmNoticeId(),"H"); List<WmOmQmIEntity> listom = systemService.findHql(hql, wmOmQmI.getOmNoticeId(), "H");
omnoticeid = wmOmQmI.getOmNoticeId(); omnoticeid = wmOmQmI.getOmNoticeId();
for(WmOmQmIEntity tom: listom){ for (WmOmQmIEntity tom : listom) {
tom.setSecondRq(waveToFj.getSecondRq()); tom.setSecondRq(waveToFj.getSecondRq());
systemService.saveOrUpdate(tom); systemService.saveOrUpdate(tom);
} }
WmOmNoticeHEntity wmom = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "omNoticeId", omnoticeid); WmOmNoticeHEntity wmom = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "omNoticeId", omnoticeid);
wmom.setOmSta("操作中"); wmom.setOmSta("操作中");
systemService.updateEntitie(wmom); systemService.updateEntitie(wmom);
D0.setOK(true); D0.setOK(true);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
D0.setOK(false); D0.setOK(false);
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
return new ResponseEntity(D0, HttpStatus.OK); return new ResponseEntity(D0, HttpStatus.OK);
} }
@RequestMapping(value = "/jsonfj", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(value = "/jsonfj", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> update(@RequestBody WaveToFjEntity waveToFj) { public ResponseEntity<?> update(@RequestBody WaveToFjEntity waveToFj) {
ResultDO D0 = new ResultDO(); ResultDO D0 = new ResultDO();
//调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息. //调用JSR303 Bean Validator进行校验如果出错返回含400错误码及json格式的错误信息.
//保存 //保存
try{ try {
WmOmQmIEntity wmOmQmI = systemService.getEntity( WmOmQmIEntity wmOmQmI = systemService.getEntity(
WmOmQmIEntity.class, waveToFj.getId()); WmOmQmIEntity.class, waveToFj.getId());
if (wmOmQmI != null&&wmOmQmI.getBinSta().equals("H")) { if (wmOmQmI != null && wmOmQmI.getBinSta().equals("H")) {
wmOmQmI.setBinSta("Y"); wmOmQmI.setBinSta("Y");
systemService.saveOrUpdate(wmOmQmI); systemService.saveOrUpdate(wmOmQmI);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
return new ResponseEntity(waveToFj, HttpStatus.OK); return new ResponseEntity(waveToFj, HttpStatus.OK);
} }
@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) {
waveToFjService.deleteEntityById(WaveToFjEntity.class, id); waveToFjService.deleteEntityById(WaveToFjEntity.class, id);
} }
} }