代码规范

master
erzhongxmu 2024-01-12 21:51:17 +08:00
parent f95d3a534e
commit b326ad568f
2 changed files with 1078 additions and 1089 deletions

View File

@ -73,12 +73,11 @@ 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: * @Description:
* @author erzhongxmu
* @date 2017-09-11 14:57:43 * @date 2017-09-11 14:57:43
* @version V1.0
*
*/ */
@Controller @Controller
@RequestMapping("/wmOmQmIController") @RequestMapping("/wmOmQmIController")
@ -96,7 +95,6 @@ public class WmOmQmIController extends BaseController {
private Validator validator; private Validator validator;
/** /**
* *
* *
@ -106,14 +104,17 @@ public class WmOmQmIController extends BaseController {
public ModelAndView list(HttpServletRequest request) { public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wm/wmOmQmIList"); return new ModelAndView("com/zzjee/wm/wmOmQmIList");
} }
@RequestMapping(params = "listd") @RequestMapping(params = "listd")
public ModelAndView listd(HttpServletRequest request) { public ModelAndView listd(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wm/wmOmQmIdList"); return new ModelAndView("com/zzjee/wm/wmOmQmIdList");
} }
@RequestMapping(params = "assignlist") @RequestMapping(params = "assignlist")
public ModelAndView assignlist(HttpServletRequest request) { public ModelAndView assignlist(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wm/wmOmQmIassignList"); return new ModelAndView("com/zzjee/wm/wmOmQmIassignList");
} }
/** /**
* easyui AJAX * easyui AJAX
* *
@ -123,43 +124,44 @@ public class WmOmQmIController extends BaseController {
*/ */
@RequestMapping(params = "datagrid") @RequestMapping(params = "datagrid")
public void datagrid(WmOmQmIEntity wmOmQmI,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { public void datagrid(WmOmQmIEntity wmOmQmI, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmOmQmIEntity.class, dataGrid); CriteriaQuery cq = new CriteriaQuery(WmOmQmIEntity.class, dataGrid);
//查询条件组装器 //查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmOmQmI, request.getParameterMap()); org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmOmQmI, request.getParameterMap());
try{ try {
//自定义追加查询条件 //自定义追加查询条件
}catch (Exception e) { } catch (Exception e) {
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
Map<String,Object> map1 = new HashMap<String,Object>(); Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("createDate", "desc"); map1.put("createDate", "desc");
cq.setOrder(map1); cq.setOrder(map1);
if(wmOmQmI.getBinSta()==null){ if (wmOmQmI.getBinSta() == null) {
cq.eq("binSta", "N"); cq.eq("binSta", "N");
} }
if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ if (StringUtil.isNotEmpty(wmUtil.getCusCode())) {
cq.eq("cusCode", wmUtil.getCusCode()); cq.eq("cusCode", wmUtil.getCusCode());
} }
cq.add(); cq.add();
this.wmOmQmIService.getDataGridReturn(cq, true); this.wmOmQmIService.getDataGridReturn(cq, true);
TagUtil.datagrid(response, dataGrid); TagUtil.datagrid(response, dataGrid);
} }
@RequestMapping(params = "datagridassign") @RequestMapping(params = "datagridassign")
public void datagridassign(WmOmQmIEntity wmOmQmI,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { public void datagridassign(WmOmQmIEntity wmOmQmI, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmOmQmIEntity.class, dataGrid); CriteriaQuery cq = new CriteriaQuery(WmOmQmIEntity.class, dataGrid);
//查询条件组装器 //查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmOmQmI, request.getParameterMap()); org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmOmQmI, request.getParameterMap());
try{ try {
//自定义追加查询条件 //自定义追加查询条件
}catch (Exception e) { } catch (Exception e) {
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
Map<String,Object> map1 = new HashMap<String,Object>(); Map<String, Object> map1 = new HashMap<String, Object>();
map1.put("createDate", "desc"); map1.put("createDate", "desc");
cq.setOrder(map1); cq.setOrder(map1);
cq.eq("binSta", "I"); cq.eq("binSta", "I");
if(StringUtil.isNotEmpty(wmUtil.getCusCode())){ if (StringUtil.isNotEmpty(wmUtil.getCusCode())) {
cq.eq("cusCode", wmUtil.getCusCode()); cq.eq("cusCode", wmUtil.getCusCode());
} }
cq.add(); cq.add();
@ -168,8 +170,8 @@ public class WmOmQmIController extends BaseController {
} }
@RequestMapping(params = "dogetbin", method = { RequestMethod.GET, @RequestMapping(params = "dogetbin", method = {RequestMethod.GET,
RequestMethod.POST }) RequestMethod.POST})
@ResponseBody @ResponseBody
public AjaxJson dogetbin(HttpServletRequest request) { public AjaxJson dogetbin(HttpServletRequest request) {
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
@ -183,7 +185,7 @@ public class WmOmQmIController extends BaseController {
+ " and ws.goods_id = ? " + " and ws.goods_id = ? "
+ " group by ws.ku_wei_bian_ma,ws.bin_id,ws.goods_id,mb.qu_huo_ci_xu, ws.goods_pro_data order by ws.goods_pro_data , ws.goods_qua ,mb.qu_huo_ci_xu,ws.create_date desc limit 1"; + " group by ws.ku_wei_bian_ma,ws.bin_id,ws.goods_id,mb.qu_huo_ci_xu, ws.goods_pro_data order by ws.goods_pro_data , ws.goods_qua ,mb.qu_huo_ci_xu,ws.create_date desc limit 1";
List<Map<String, Object>> result = systemService.findForJdbc(tsql,tinid, goods); List<Map<String, Object>> result = systemService.findForJdbc(tsql, tinid, goods);
if (result.size() > 0) { if (result.size() > 0) {
wmOmQmI.setBinId(result.get(0).get("ku_wei_bian_ma").toString()); wmOmQmI.setBinId(result.get(0).get("ku_wei_bian_ma").toString());
wmOmQmI.setProData(result.get(0).get("goods_pro_data").toString()); wmOmQmI.setProData(result.get(0).get("goods_pro_data").toString());
@ -210,19 +212,19 @@ public class WmOmQmIController extends BaseController {
wmOmQmI.setAssignTo(usernameList.get(0)); wmOmQmI.setAssignTo(usernameList.get(0));
} }
if(!wmUtil.checkstcoka( t.getBinId(),t.getTinId(),t.getGoodsId(),t.getProData(),t.getBaseGoodscount())){ if (!wmUtil.checkstcoka(t.getBinId(), t.getTinId(), t.getGoodsId(), t.getProData(), t.getBaseGoodscount())) {
message = "库存不足"; message = "库存不足";
j.setMsg(message); j.setMsg(message);
return j; return j;
}else{ } else {
try { try {
t.setBinSta("N"); t.setBinSta("N");
systemService.updateEntitie(t);; systemService.updateEntitie(t);
;
systemService.addLog(message, Globals.Log_Type_UPDATE, systemService.addLog(message, Globals.Log_Type_UPDATE,
Globals.Log_Leavel_INFO); Globals.Log_Leavel_INFO);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "添加到下架任务清单失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
} }
@ -233,7 +235,7 @@ public class WmOmQmIController extends BaseController {
@RequestMapping(params = "doassignwave") @RequestMapping(params = "doassignwave")
@ResponseBody @ResponseBody
public AjaxJson dowavebatch(String ids, String waveid,HttpServletRequest request) { public AjaxJson dowavebatch(String ids, String waveid, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "波次生成成功"; message = "波次生成成功";
@ -244,20 +246,18 @@ public class WmOmQmIController extends BaseController {
for (String id : ids.split(",")) { for (String id : ids.split(",")) {
WmOmQmIEntity t = wmOmQmIService.get(WmOmQmIEntity.class, id); WmOmQmIEntity t = wmOmQmIService.get(WmOmQmIEntity.class, id);
try { try {
t.setWaveId("BC"+waveId); t.setWaveId("BC" + waveId);
t.setBinSta("N");//波次直接设置为未下架 t.setBinSta("N");//波次直接设置为未下架
t.setFirstRq(""); t.setFirstRq("");
if(StringUtil.isNotEmpty(firstrongqi)){ if (StringUtil.isNotEmpty(firstrongqi)) {
t.setFirstRq(firstrongqi); t.setFirstRq(firstrongqi);
} }
String recarno = ""; String recarno = "";
try{ try {
WmOmNoticeHEntity wmOmNoticeHEntity = systemService.findUniqueByProperty(WmOmNoticeHEntity.class,"omNoticeId",t.getOmNoticeId()); WmOmNoticeHEntity wmOmNoticeHEntity = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "omNoticeId", t.getOmNoticeId());
recarno = wmOmNoticeHEntity.getReCarno(); recarno = wmOmNoticeHEntity.getReCarno();
}catch (Exception e){ } catch (Exception e) {
} }
t.setSecondRq(recarno); t.setSecondRq(recarno);
@ -266,7 +266,6 @@ public class WmOmQmIController extends BaseController {
Globals.Log_Leavel_INFO); Globals.Log_Leavel_INFO);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "波次生成失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
@ -293,7 +292,7 @@ public class WmOmQmIController extends BaseController {
for (String id : ids.split(",")) { for (String id : ids.split(",")) {
WmOmQmIEntity t = wmOmQmIService.get(WmOmQmIEntity.class, id); WmOmQmIEntity t = wmOmQmIService.get(WmOmQmIEntity.class, id);
try { try {
if("N".equals(t.getBinSta())){ if ("N".equals(t.getBinSta())) {
t.setWaveId(null); t.setWaveId(null);
systemService.updateEntitie(t); systemService.updateEntitie(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, systemService.addLog(message, Globals.Log_Type_UPDATE,
@ -311,7 +310,6 @@ public class WmOmQmIController extends BaseController {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "波次删除失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
@ -330,11 +328,11 @@ public class WmOmQmIController extends BaseController {
for (String id : ids.split(",")) { for (String id : ids.split(",")) {
WmOmQmIEntity t = wmOmQmIService.get(WmOmQmIEntity.class, id); WmOmQmIEntity t = wmOmQmIService.get(WmOmQmIEntity.class, id);
try { try {
if(!wmUtil.checkstcoka( t.getBinId(),t.getTinId(),t.getGoodsId(),t.getProData(),t.getBaseGoodscount())){ if (!wmUtil.checkstcoka(t.getBinId(), t.getTinId(), t.getGoodsId(), t.getProData(), t.getBaseGoodscount())) {
message = "库存不足"; message = "库存不足";
j.setMsg(message); j.setMsg(message);
return j; return j;
}else{ } else {
t.setBinSta("N"); t.setBinSta("N");
systemService.updateEntitie(t); systemService.updateEntitie(t);
systemService.addLog(message, Globals.Log_Type_UPDATE, systemService.addLog(message, Globals.Log_Type_UPDATE,
@ -350,7 +348,6 @@ public class WmOmQmIController extends BaseController {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "添加到下架任务清单失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
@ -358,7 +355,6 @@ public class WmOmQmIController extends BaseController {
} }
/** /**
* *
* *
@ -371,12 +367,11 @@ public class WmOmQmIController extends BaseController {
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
wmOmQmI = systemService.getEntity(WmOmQmIEntity.class, wmOmQmI.getId()); wmOmQmI = systemService.getEntity(WmOmQmIEntity.class, wmOmQmI.getId());
message = "下架任务删除成功"; message = "下架任务删除成功";
try{ try {
wmOmQmIService.delete(wmOmQmI); wmOmQmIService.delete(wmOmQmI);
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 = "下架任务删除失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
@ -392,7 +387,7 @@ public class WmOmQmIController extends BaseController {
try { try {
WmOmQmIEntity wmOmQmI = systemService.getEntity( WmOmQmIEntity wmOmQmI = systemService.getEntity(
WmOmQmIEntity.class, request.getParameter("id").toString()); WmOmQmIEntity.class, request.getParameter("id").toString());
if (wmOmQmI != null&&wmOmQmI.getBinSta().equals("N")) { if (wmOmQmI != null && wmOmQmI.getBinSta().equals("N")) {
WmToDownGoodsEntity wmToDownGoods = new WmToDownGoodsEntity(); WmToDownGoodsEntity wmToDownGoods = new WmToDownGoodsEntity();
wmToDownGoods.setBinIdFrom(wmOmQmI.getTinId());//下架托盘 wmToDownGoods.setBinIdFrom(wmOmQmI.getTinId());//下架托盘
wmToDownGoods.setKuWeiBianMa(wmOmQmI.getBinId());//储位 wmToDownGoods.setKuWeiBianMa(wmOmQmI.getBinId());//储位
@ -414,25 +409,23 @@ public class WmOmQmIController extends BaseController {
systemService.save(wmToDownGoods); systemService.save(wmToDownGoods);
wmOmQmI.setBinSta("H"); wmOmQmI.setBinSta("H");
systemService.saveOrUpdate(wmOmQmI); systemService.saveOrUpdate(wmOmQmI);
try{ try {
String orderId = wmOmQmI.getOmNoticeId(); String orderId = wmOmQmI.getOmNoticeId();
String type = "jh"; String type = "jh";
String username = ResourceUtil.getSessionUserName().getRealName(); String username = ResourceUtil.getSessionUserName().getRealName();
updateUser(orderId,type,username); updateUser(orderId, type, username);
}catch (Exception e){ } catch (Exception e) {
} }
systemService.addLog(message, Globals.Log_Type_DEL, systemService.addLog(message, Globals.Log_Type_DEL,
Globals.Log_Leavel_INFO); Globals.Log_Leavel_INFO);
} else { } else {
j.setSuccess(false); j.setSuccess(false);
message = "下架任务找不到"; message = "下架任务找不到";
} }
} catch (Exception e) { } catch (Exception e) {
j.setSuccess(false); j.setSuccess(false);
e.printStackTrace(); e.printStackTrace();
message = "下架失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
@ -440,8 +433,6 @@ public class WmOmQmIController extends BaseController {
} }
@RequestMapping(params = "dotodown") @RequestMapping(params = "dotodown")
@ResponseBody @ResponseBody
public synchronized AjaxJson dotodown(HttpServletRequest request) { public synchronized AjaxJson dotodown(HttpServletRequest request) {
@ -450,7 +441,7 @@ public class WmOmQmIController extends BaseController {
message = "下架成功"; message = "下架成功";
String id = request.getParameter("id").toString(); String id = request.getParameter("id").toString();
boolean isok = todown(id); boolean isok = todown(id);
if (!isok){ if (!isok) {
j.setSuccess(isok); j.setSuccess(isok);
message = "下架失败"; message = "下架失败";
} }
@ -459,11 +450,11 @@ public class WmOmQmIController extends BaseController {
} }
public boolean todown(String id){ public boolean todown(String id) {
try { try {
WmOmQmIEntity wmOmQmI = systemService.getEntity( WmOmQmIEntity wmOmQmI = systemService.getEntity(
WmOmQmIEntity.class, id); WmOmQmIEntity.class, id);
if (wmOmQmI != null&&wmOmQmI.getBinSta().equals("N")) { if (wmOmQmI != null && wmOmQmI.getBinSta().equals("N")) {
WmToDownGoodsEntity wmToDownGoods = new WmToDownGoodsEntity(); WmToDownGoodsEntity wmToDownGoods = new WmToDownGoodsEntity();
wmToDownGoods.setBinIdFrom(wmOmQmI.getTinId());//下架托盘 wmToDownGoods.setBinIdFrom(wmOmQmI.getTinId());//下架托盘
wmToDownGoods.setKuWeiBianMa(wmOmQmI.getBinId());//储位 wmToDownGoods.setKuWeiBianMa(wmOmQmI.getBinId());//储位
@ -485,12 +476,12 @@ public class WmOmQmIController extends BaseController {
systemService.save(wmToDownGoods); systemService.save(wmToDownGoods);
wmOmQmI.setBinSta("Y"); wmOmQmI.setBinSta("Y");
systemService.saveOrUpdate(wmOmQmI); systemService.saveOrUpdate(wmOmQmI);
try{ try {
String orderId = wmOmQmI.getOmNoticeId(); String orderId = wmOmQmI.getOmNoticeId();
String type = "jh"; String type = "jh";
String username = ResourceUtil.getSessionUserName().getRealName(); String username = ResourceUtil.getSessionUserName().getRealName();
updateUser(orderId,type,username); updateUser(orderId, type, username);
}catch (Exception e){ } catch (Exception e) {
} }
return true; return true;
} else { } else {
@ -508,21 +499,20 @@ public class WmOmQmIController extends BaseController {
*/ */
@RequestMapping(params = "doBatchDel") @RequestMapping(params = "doBatchDel")
@ResponseBody @ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){ public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "下架任务删除成功"; message = "下架任务删除成功";
try{ try {
for(String id:ids.split(",")){ for (String id : ids.split(",")) {
WmOmQmIEntity wmOmQmI = systemService.getEntity(WmOmQmIEntity.class, WmOmQmIEntity wmOmQmI = systemService.getEntity(WmOmQmIEntity.class,
id id
); );
wmOmQmIService.delete(wmOmQmI); wmOmQmIService.delete(wmOmQmI);
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 = "下架任务删除失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
@ -541,12 +531,11 @@ public class WmOmQmIController extends BaseController {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "下架任务添加成功"; message = "下架任务添加成功";
try{ try {
wmOmQmIService.save(wmOmQmI); wmOmQmIService.save(wmOmQmI);
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 = "下架任务添加失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
@ -555,23 +544,22 @@ public class WmOmQmIController extends BaseController {
/** /**
*
* @param page * @param page
* @return * @return
*/ */
@RequestMapping(params = "saveRows") @RequestMapping(params = "saveRows")
@ResponseBody @ResponseBody
public AjaxJson saveRows(omqmpage page){ public AjaxJson saveRows(omqmpage page) {
String message = null; String message = null;
List<WmOmQmIEntity> demos=page.getOmqmrows(); List<WmOmQmIEntity> demos = page.getOmqmrows();
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
if(CollectionUtils.isNotEmpty(demos)){ if (CollectionUtils.isNotEmpty(demos)) {
for(WmOmQmIEntity jeecgDemo:demos){ for (WmOmQmIEntity jeecgDemo : demos) {
if (StringUtil.isNotEmpty(jeecgDemo.getId())) { if (StringUtil.isNotEmpty(jeecgDemo.getId())) {
WmOmQmIEntity t =systemService.get(WmOmQmIEntity.class, jeecgDemo.getId()); WmOmQmIEntity t = systemService.get(WmOmQmIEntity.class, jeecgDemo.getId());
try { try {
if(!wmUtil.checkstcok( jeecgDemo.getBinId(),jeecgDemo.getTinId(),jeecgDemo.getGoodsId(),jeecgDemo.getProData(),jeecgDemo.getBaseGoodscount())) { if (!wmUtil.checkstcok(jeecgDemo.getBinId(), jeecgDemo.getTinId(), jeecgDemo.getGoodsId(), jeecgDemo.getProData(), jeecgDemo.getBaseGoodscount())) {
}else{ } else {
message = "批量保存成功"; message = "批量保存成功";
MyBeanUtils.copyBeanNotNull2Bean(jeecgDemo, t); MyBeanUtils.copyBeanNotNull2Bean(jeecgDemo, t);
systemService.saveOrUpdate(t); systemService.saveOrUpdate(t);
@ -587,7 +575,6 @@ public class WmOmQmIController extends BaseController {
} }
/** /**
* *
* *
@ -601,11 +588,11 @@ public class WmOmQmIController extends BaseController {
message = "下架任务更新成功"; message = "下架任务更新成功";
WmOmQmIEntity t = wmOmQmIService.get(WmOmQmIEntity.class, wmOmQmI.getId()); WmOmQmIEntity t = wmOmQmIService.get(WmOmQmIEntity.class, wmOmQmI.getId());
try { try {
if(!wmUtil.checkstcok( wmOmQmI.getBinId(),wmOmQmI.getTinId(),wmOmQmI.getGoodsId(),wmOmQmI.getProData(),wmOmQmI.getBaseGoodscount())){ if (!wmUtil.checkstcok(wmOmQmI.getBinId(), wmOmQmI.getTinId(), wmOmQmI.getGoodsId(), wmOmQmI.getProData(), wmOmQmI.getBaseGoodscount())) {
message = "库存不足"; message = "库存不足";
j.setMsg(message); j.setMsg(message);
return j; return j;
}else{ } else {
double goods = Double.parseDouble(wmOmQmI.getBaseGoodscount()); double goods = Double.parseDouble(wmOmQmI.getBaseGoodscount());
wmOmQmI.setQmOkQuat(wmOmQmI.getBaseGoodscount()); wmOmQmI.setQmOkQuat(wmOmQmI.getBaseGoodscount());
wmOmQmI.setOmQuat(wmOmQmI.getBaseGoodscount()); wmOmQmI.setOmQuat(wmOmQmI.getBaseGoodscount());
@ -616,12 +603,12 @@ public class WmOmQmIController extends BaseController {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
message = "下架任务更新失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
} }
/** /**
* *
* *
@ -629,7 +616,7 @@ public class WmOmQmIController extends BaseController {
*/ */
@RequestMapping(params = "dobatchassgnto") @RequestMapping(params = "dobatchassgnto")
@ResponseBody @ResponseBody
public AjaxJson dobatchassgnto(String id,String assgnTo, HttpServletRequest request) { public AjaxJson dobatchassgnto(String id, String assgnTo, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "下架任务更新成功"; message = "下架任务更新成功";
@ -640,7 +627,6 @@ public class WmOmQmIController 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 = "下架任务更新失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
@ -660,6 +646,7 @@ public class WmOmQmIController extends BaseController {
} }
return new ModelAndView("com/zzjee/wm/wmOmQmI-add"); return new ModelAndView("com/zzjee/wm/wmOmQmI-add");
} }
/** /**
* *
* *
@ -681,7 +668,7 @@ public class WmOmQmIController extends BaseController {
*/ */
@RequestMapping(params = "upload") @RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) { public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","wmOmQmIController"); req.setAttribute("controller_name", "wmOmQmIController");
return new ModelAndView("common/upload/pub_excel_upload"); return new ModelAndView("common/upload/pub_excel_upload");
} }
@ -692,18 +679,19 @@ public class WmOmQmIController extends BaseController {
* @param response * @param response
*/ */
@RequestMapping(params = "exportXls") @RequestMapping(params = "exportXls")
public String exportXls(WmOmQmIEntity wmOmQmI,HttpServletRequest request,HttpServletResponse response public String exportXls(WmOmQmIEntity wmOmQmI, HttpServletRequest request, HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) { , DataGrid dataGrid, ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(WmOmQmIEntity.class, dataGrid); CriteriaQuery cq = new CriteriaQuery(WmOmQmIEntity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmOmQmI, request.getParameterMap()); org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmOmQmI, request.getParameterMap());
List<WmOmQmIEntity> wmOmQmIs = this.wmOmQmIService.getListByCriteriaQuery(cq,false); List<WmOmQmIEntity> wmOmQmIs = this.wmOmQmIService.getListByCriteriaQuery(cq, false);
modelMap.put(NormalExcelConstants.FILE_NAME,"下架任务"); modelMap.put(NormalExcelConstants.FILE_NAME, "下架任务");
modelMap.put(NormalExcelConstants.CLASS,WmOmQmIEntity.class); modelMap.put(NormalExcelConstants.CLASS, WmOmQmIEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("下架任务列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(), modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("下架任务列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
"导出信息")); "导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,wmOmQmIs); modelMap.put(NormalExcelConstants.DATA_LIST, wmOmQmIs);
return NormalExcelConstants.JEECG_EXCEL_VIEW; return NormalExcelConstants.JEECG_EXCEL_VIEW;
} }
/** /**
* excel 使 * excel 使
* *
@ -711,13 +699,13 @@ public class WmOmQmIController extends BaseController {
* @param response * @param response
*/ */
@RequestMapping(params = "exportXlsByT") @RequestMapping(params = "exportXlsByT")
public String exportXlsByT(WmOmQmIEntity wmOmQmI,HttpServletRequest request,HttpServletResponse response public String exportXlsByT(WmOmQmIEntity wmOmQmI, HttpServletRequest request, HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) { , DataGrid dataGrid, ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"下架任务"); modelMap.put(NormalExcelConstants.FILE_NAME, "下架任务");
modelMap.put(NormalExcelConstants.CLASS,WmOmQmIEntity.class); modelMap.put(NormalExcelConstants.CLASS, WmOmQmIEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("下架任务列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(), modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("下架任务列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
"导出信息")); "导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList()); modelMap.put(NormalExcelConstants.DATA_LIST, new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW; return NormalExcelConstants.JEECG_EXCEL_VIEW;
} }
@ -736,7 +724,7 @@ public class WmOmQmIController extends BaseController {
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
try { try {
List<WmOmQmIEntity> listWmOmQmIEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WmOmQmIEntity.class,params); List<WmOmQmIEntity> listWmOmQmIEntitys = ExcelImportUtil.importExcel(file.getInputStream(), WmOmQmIEntity.class, params);
for (WmOmQmIEntity wmOmQmI : listWmOmQmIEntitys) { for (WmOmQmIEntity wmOmQmI : listWmOmQmIEntitys) {
wmOmQmIService.save(wmOmQmI); wmOmQmIService.save(wmOmQmI);
} }
@ -744,7 +732,7 @@ public class WmOmQmIController extends BaseController {
} catch (Exception e) { } catch (Exception e) {
j.setMsg("文件导入失败!"); j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e)); logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{ } finally {
try { try {
file.getInputStream().close(); file.getInputStream().close();
} catch (IOException e) { } catch (IOException e) {
@ -758,7 +746,7 @@ public class WmOmQmIController extends BaseController {
@RequestMapping(method = RequestMethod.GET) @RequestMapping(method = RequestMethod.GET)
@ResponseBody @ResponseBody
public List<WmOmQmIEntity> list() { public List<WmOmQmIEntity> list() {
List<WmOmQmIEntity> listWmOmQmIs=wmOmQmIService.getList(WmOmQmIEntity.class); List<WmOmQmIEntity> listWmOmQmIs = wmOmQmIService.getList(WmOmQmIEntity.class);
return listWmOmQmIs; return listWmOmQmIs;
} }
@ -782,7 +770,7 @@ public class WmOmQmIController extends BaseController {
} }
//保存 //保存
try{ try {
wmOmQmIService.save(wmOmQmI); wmOmQmIService.save(wmOmQmI);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -806,7 +794,7 @@ public class WmOmQmIController extends BaseController {
} }
//保存 //保存
try{ try {
wmOmQmIService.saveOrUpdate(wmOmQmI); wmOmQmIService.saveOrUpdate(wmOmQmI);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -818,17 +806,17 @@ public class WmOmQmIController extends BaseController {
} }
void updateUser(String orderId,String type,String userName){ void updateUser(String orderId, String type, String userName) {
try{ try {
WmOmNoticeHEntity wmOmNoticeHEntity = systemService.findUniqueByProperty(WmOmNoticeHEntity.class,"omNoticeId",orderId); WmOmNoticeHEntity wmOmNoticeHEntity = systemService.findUniqueByProperty(WmOmNoticeHEntity.class, "omNoticeId", orderId);
if ("jh".equals(type)){ if ("jh".equals(type)) {
wmOmNoticeHEntity.setJhUser(userName); wmOmNoticeHEntity.setJhUser(userName);
} }
if ("fh".equals(type)){ if ("fh".equals(type)) {
wmOmNoticeHEntity.setFhUser(userName); wmOmNoticeHEntity.setFhUser(userName);
} }
systemService.updateEntitie(wmOmNoticeHEntity); systemService.updateEntitie(wmOmNoticeHEntity);
}catch (Exception e){ } catch (Exception e) {
} }

View File

@ -1,4 +1,5 @@
package com.zzjee.wm.controller; package com.zzjee.wm.controller;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -55,12 +56,11 @@ import com.zzjee.wm.entity.WmPlatIoEntity;
import com.zzjee.wm.service.WmPlatIoServiceI; import com.zzjee.wm.service.WmPlatIoServiceI;
/** /**
* @author erzhongxmu
* @version V1.0
* @Title: Controller * @Title: Controller
* @Description: * @Description:
* @author erzhongxmu
* @date 2017-08-15 23:20:14 * @date 2017-08-15 23:20:14
* @version V1.0
*
*/ */
@Controller @Controller
@RequestMapping("/wmPlatIoController") @RequestMapping("/wmPlatIoController")
@ -78,7 +78,6 @@ public class WmPlatIoController extends BaseController {
private Validator validator; private Validator validator;
/** /**
* *
* *
@ -88,10 +87,12 @@ public class WmPlatIoController extends BaseController {
public ModelAndView list(HttpServletRequest request) { public ModelAndView list(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wm/wmPlatIoList"); return new ModelAndView("com/zzjee/wm/wmPlatIoList");
} }
@RequestMapping(params = "listplan") @RequestMapping(params = "listplan")
public ModelAndView listplan(HttpServletRequest request) { public ModelAndView listplan(HttpServletRequest request) {
return new ModelAndView("com/zzjee/wm/wmPlatIoplanList"); return new ModelAndView("com/zzjee/wm/wmPlatIoplanList");
} }
/** /**
* easyui AJAX * easyui AJAX
* *
@ -102,26 +103,27 @@ public class WmPlatIoController extends BaseController {
*/ */
@RequestMapping(params = "datagrid") @RequestMapping(params = "datagrid")
public void datagrid(WmPlatIoEntity wmPlatIo,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { public void datagrid(WmPlatIoEntity wmPlatIo, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmPlatIoEntity.class, dataGrid); CriteriaQuery cq = new CriteriaQuery(WmPlatIoEntity.class, dataGrid);
//查询条件组装器 //查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmPlatIo, request.getParameterMap()); org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmPlatIo, request.getParameterMap());
try{ try {
//自定义追加查询条件 //自定义追加查询条件
String query_planIndata_begin = DateUtils.date2Str(new Date(),DateUtils.date_sdf); String query_planIndata_begin = DateUtils.date2Str(new Date(), DateUtils.date_sdf);
Date today = new Date(); Date today = new Date();
Calendar c = Calendar.getInstance(); Calendar c = Calendar.getInstance();
c.setTime(today); c.setTime(today);
c.add(Calendar.DAY_OF_MONTH, 1);// 今天+1天 c.add(Calendar.DAY_OF_MONTH, 1);// 今天+1天
String query_planIndata_end = DateUtils.date2Str(c.getTime(),DateUtils.date_sdf);; String query_planIndata_end = DateUtils.date2Str(c.getTime(), DateUtils.date_sdf);
if(StringUtil.isNotEmpty(query_planIndata_begin)){ ;
if (StringUtil.isNotEmpty(query_planIndata_begin)) {
cq.ge("planIndata", new SimpleDateFormat("yyyy-MM-dd").parse(query_planIndata_begin)); cq.ge("planIndata", new SimpleDateFormat("yyyy-MM-dd").parse(query_planIndata_begin));
} }
if(StringUtil.isNotEmpty(query_planIndata_end)){ if (StringUtil.isNotEmpty(query_planIndata_end)) {
cq.le("planIndata", new SimpleDateFormat("yyyy-MM-dd").parse(query_planIndata_end)); cq.le("planIndata", new SimpleDateFormat("yyyy-MM-dd").parse(query_planIndata_end));
} }
}catch (Exception e) { } catch (Exception e) {
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
cq.notEq("platSta", "完成"); cq.notEq("platSta", "完成");
@ -131,23 +133,25 @@ public class WmPlatIoController extends BaseController {
} }
@RequestMapping(params = "datagridplan") @RequestMapping(params = "datagridplan")
public void datagridplan(WmPlatIoEntity wmPlatIo,HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) { public void datagridplan(WmPlatIoEntity wmPlatIo, HttpServletRequest request, HttpServletResponse response, DataGrid dataGrid) {
CriteriaQuery cq = new CriteriaQuery(WmPlatIoEntity.class, dataGrid); CriteriaQuery cq = new CriteriaQuery(WmPlatIoEntity.class, dataGrid);
//查询条件组装器 //查询条件组装器
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmPlatIo, request.getParameterMap()); org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmPlatIo, request.getParameterMap());
try{ try {
//自定义追加查询条件 //自定义追加查询条件
String query_planIndata_begin = request.getParameter("planIndata_begin1"); ; String query_planIndata_begin = request.getParameter("planIndata_begin1");
;
String query_planIndata_end = request.getParameter("planIndata_end2"); ; String query_planIndata_end = request.getParameter("planIndata_end2");
if(StringUtil.isNotEmpty(query_planIndata_begin)){ ;
if (StringUtil.isNotEmpty(query_planIndata_begin)) {
cq.ge("planIndata", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(query_planIndata_begin)); cq.ge("planIndata", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(query_planIndata_begin));
} }
if(StringUtil.isNotEmpty(query_planIndata_end)){ if (StringUtil.isNotEmpty(query_planIndata_end)) {
cq.le("planIndata", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(query_planIndata_end)); cq.le("planIndata", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(query_planIndata_end));
} }
}catch (Exception e) { } catch (Exception e) {
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
cq.add(); cq.add();
@ -167,12 +171,11 @@ public class WmPlatIoController extends BaseController {
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
wmPlatIo = systemService.getEntity(WmPlatIoEntity.class, wmPlatIo.getId()); wmPlatIo = systemService.getEntity(WmPlatIoEntity.class, wmPlatIo.getId());
message = "月台进出删除成功"; message = "月台进出删除成功";
try{ try {
wmPlatIoService.delete(wmPlatIo); wmPlatIoService.delete(wmPlatIo);
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 = "月台进出删除失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
@ -186,21 +189,20 @@ public class WmPlatIoController extends BaseController {
*/ */
@RequestMapping(params = "doBatchDel") @RequestMapping(params = "doBatchDel")
@ResponseBody @ResponseBody
public AjaxJson doBatchDel(String ids,HttpServletRequest request){ public AjaxJson doBatchDel(String ids, HttpServletRequest request) {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "月台进出删除成功"; message = "月台进出删除成功";
try{ try {
for(String id:ids.split(",")){ for (String id : ids.split(",")) {
WmPlatIoEntity wmPlatIo = systemService.getEntity(WmPlatIoEntity.class, WmPlatIoEntity wmPlatIo = systemService.getEntity(WmPlatIoEntity.class,
id id
); );
wmPlatIoService.delete(wmPlatIo); wmPlatIoService.delete(wmPlatIo);
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 = "月台进出删除失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
@ -220,13 +222,12 @@ public class WmPlatIoController extends BaseController {
String message = null; String message = null;
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "月台进出添加成功"; message = "月台进出添加成功";
try{ try {
wmPlatIo.setPlatSta("计划"); wmPlatIo.setPlatSta("计划");
wmPlatIoService.save(wmPlatIo); wmPlatIoService.save(wmPlatIo);
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 = "月台进出添加失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
@ -252,7 +253,6 @@ public class WmPlatIoController 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 = "月台进出更新失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
@ -280,7 +280,6 @@ public class WmPlatIoController 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 = "月台释放失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
@ -300,10 +299,10 @@ public class WmPlatIoController extends BaseController {
AjaxJson j = new AjaxJson(); AjaxJson j = new AjaxJson();
message = "月台占用成功"; message = "月台占用成功";
WmPlatIoEntity t = wmPlatIoService.get(WmPlatIoEntity.class, wmPlatIo.getId()); WmPlatIoEntity t = wmPlatIoService.get(WmPlatIoEntity.class, wmPlatIo.getId());
String sql = "select count(*) as count from wm_plat_io wp where wp.plat_sta = '占用' and wp.plat_id = '"+t.getPlatId()+"' and TO_DAYS(wp.in_data) = TO_DAYS(NOW());"; String sql = "select count(*) as count from wm_plat_io wp where wp.plat_sta = '占用' and wp.plat_id = '" + t.getPlatId() + "' and TO_DAYS(wp.in_data) = TO_DAYS(NOW());";
Map<String, Object> countMap = systemService Map<String, Object> countMap = systemService
.findOneForJdbc(sql); .findOneForJdbc(sql);
if(countMap!=null&&((Long) countMap.get("count")).intValue() > 0){ if (countMap != null && ((Long) countMap.get("count")).intValue() > 0) {
j.setSuccess(false); j.setSuccess(false);
message = "月台正在使用中"; message = "月台正在使用中";
j.setMsg(message); j.setMsg(message);
@ -318,12 +317,12 @@ public class WmPlatIoController 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 = "月台占用失败";
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
} }
j.setMsg(message); j.setMsg(message);
return j; return j;
} }
/** /**
* *
* *
@ -337,6 +336,7 @@ public class WmPlatIoController extends BaseController {
} }
return new ModelAndView("com/zzjee/wm/wmPlatIo-add"); return new ModelAndView("com/zzjee/wm/wmPlatIo-add");
} }
/** /**
* *
* *
@ -358,7 +358,7 @@ public class WmPlatIoController extends BaseController {
*/ */
@RequestMapping(params = "upload") @RequestMapping(params = "upload")
public ModelAndView upload(HttpServletRequest req) { public ModelAndView upload(HttpServletRequest req) {
req.setAttribute("controller_name","wmPlatIoController"); req.setAttribute("controller_name", "wmPlatIoController");
return new ModelAndView("common/upload/pub_excel_upload"); return new ModelAndView("common/upload/pub_excel_upload");
} }
@ -369,18 +369,19 @@ public class WmPlatIoController extends BaseController {
* @param response * @param response
*/ */
@RequestMapping(params = "exportXls") @RequestMapping(params = "exportXls")
public String exportXls(WmPlatIoEntity wmPlatIo,HttpServletRequest request,HttpServletResponse response public String exportXls(WmPlatIoEntity wmPlatIo, HttpServletRequest request, HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) { , DataGrid dataGrid, ModelMap modelMap) {
CriteriaQuery cq = new CriteriaQuery(WmPlatIoEntity.class, dataGrid); CriteriaQuery cq = new CriteriaQuery(WmPlatIoEntity.class, dataGrid);
org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmPlatIo, request.getParameterMap()); org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil.installHql(cq, wmPlatIo, request.getParameterMap());
List<WmPlatIoEntity> wmPlatIos = this.wmPlatIoService.getListByCriteriaQuery(cq,false); List<WmPlatIoEntity> wmPlatIos = this.wmPlatIoService.getListByCriteriaQuery(cq, false);
modelMap.put(NormalExcelConstants.FILE_NAME,"月台进出"); modelMap.put(NormalExcelConstants.FILE_NAME, "月台进出");
modelMap.put(NormalExcelConstants.CLASS,WmPlatIoEntity.class); modelMap.put(NormalExcelConstants.CLASS, WmPlatIoEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("月台进出列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(), modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("月台进出列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
"导出信息")); "导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,wmPlatIos); modelMap.put(NormalExcelConstants.DATA_LIST, wmPlatIos);
return NormalExcelConstants.JEECG_EXCEL_VIEW; return NormalExcelConstants.JEECG_EXCEL_VIEW;
} }
/** /**
* excel 使 * excel 使
* *
@ -388,13 +389,13 @@ public class WmPlatIoController extends BaseController {
* @param response * @param response
*/ */
@RequestMapping(params = "exportXlsByT") @RequestMapping(params = "exportXlsByT")
public String exportXlsByT(WmPlatIoEntity wmPlatIo,HttpServletRequest request,HttpServletResponse response public String exportXlsByT(WmPlatIoEntity wmPlatIo, HttpServletRequest request, HttpServletResponse response
, DataGrid dataGrid,ModelMap modelMap) { , DataGrid dataGrid, ModelMap modelMap) {
modelMap.put(NormalExcelConstants.FILE_NAME,"月台进出"); modelMap.put(NormalExcelConstants.FILE_NAME, "月台进出");
modelMap.put(NormalExcelConstants.CLASS,WmPlatIoEntity.class); modelMap.put(NormalExcelConstants.CLASS, WmPlatIoEntity.class);
modelMap.put(NormalExcelConstants.PARAMS,new ExportParams("月台进出列表", "导出人:"+ResourceUtil.getSessionUserName().getRealName(), modelMap.put(NormalExcelConstants.PARAMS, new ExportParams("月台进出列表", "导出人:" + ResourceUtil.getSessionUserName().getRealName(),
"导出信息")); "导出信息"));
modelMap.put(NormalExcelConstants.DATA_LIST,new ArrayList()); modelMap.put(NormalExcelConstants.DATA_LIST, new ArrayList());
return NormalExcelConstants.JEECG_EXCEL_VIEW; return NormalExcelConstants.JEECG_EXCEL_VIEW;
} }
@ -413,7 +414,7 @@ public class WmPlatIoController extends BaseController {
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
try { try {
List<WmPlatIoEntity> listWmPlatIoEntitys = ExcelImportUtil.importExcel(file.getInputStream(),WmPlatIoEntity.class,params); List<WmPlatIoEntity> listWmPlatIoEntitys = ExcelImportUtil.importExcel(file.getInputStream(), WmPlatIoEntity.class, params);
for (WmPlatIoEntity wmPlatIo : listWmPlatIoEntitys) { for (WmPlatIoEntity wmPlatIo : listWmPlatIoEntitys) {
wmPlatIoService.save(wmPlatIo); wmPlatIoService.save(wmPlatIo);
} }
@ -421,7 +422,7 @@ public class WmPlatIoController extends BaseController {
} catch (Exception e) { } catch (Exception e) {
j.setMsg("文件导入失败!"); j.setMsg("文件导入失败!");
logger.error(ExceptionUtil.getExceptionMessage(e)); logger.error(ExceptionUtil.getExceptionMessage(e));
}finally{ } finally {
try { try {
file.getInputStream().close(); file.getInputStream().close();
} catch (IOException e) { } catch (IOException e) {
@ -435,7 +436,7 @@ public class WmPlatIoController extends BaseController {
@RequestMapping(method = RequestMethod.GET) @RequestMapping(method = RequestMethod.GET)
@ResponseBody @ResponseBody
public List<WmPlatIoEntity> list() { public List<WmPlatIoEntity> list() {
List<WmPlatIoEntity> listWmPlatIos=wmPlatIoService.getList(WmPlatIoEntity.class); List<WmPlatIoEntity> listWmPlatIos = wmPlatIoService.getList(WmPlatIoEntity.class);
return listWmPlatIos; return listWmPlatIos;
} }
@ -459,7 +460,7 @@ public class WmPlatIoController extends BaseController {
} }
//保存 //保存
try{ try {
wmPlatIoService.save(wmPlatIo); wmPlatIoService.save(wmPlatIo);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -483,7 +484,7 @@ public class WmPlatIoController extends BaseController {
} }
//保存 //保存
try{ try {
wmPlatIoService.saveOrUpdate(wmPlatIo); wmPlatIoService.saveOrUpdate(wmPlatIo);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();