/** * 新增样品 * * @return */ public String addSampleAction() { try { this.clearMessages(); // 数据验证 if (!checkData(addSampleDto)) { return "checkerror"; } // 当前操作用户ID String username = (String) ActionContext.getContext().getSession().get(Constants.SESSION_USER_ID); addSampleDto.setUpdateuid(username); addSampleDto.setCreateuid(username); addSampleDto.setRank(Constants.ROLE_RANK_OPERATOR); addSampleDto.setWarehousename( PropertiesConfig.getPropertiesValueByKey(Constants.SYSTEM_WAREHOUSE_NAME)); addSampleDto.setBelongto(PropertiesConfig.getPropertiesValueByKey(Constants.SYSTEM_BELONG)); // 默认状态=有效 addSampleDto.setStatus(Constants.STATUS_NORMAL); sampleService.insertSample(addSampleDto); this.addActionMessage("添加成功!"); addSampleDto = new SampleDto(); } catch (Exception e) { log.error("addSampleAction error:" + e); return ERROR; } return SUCCESS; }
/** * 修改样品 * * @return */ public String updSampleAction() { try { this.clearMessages(); // 数据验证 if (!checkData(updSampleDto)) { return "checkerror"; } // 当前操作用户ID String username = (String) ActionContext.getContext().getSession().get(Constants.SESSION_USER_ID); updSampleDto.setUpdateuid(username); sampleService.updateSample(updSampleDto); this.addActionMessage("修改成功!"); } catch (Exception e) { log.error("updSampleAction error:" + e); return ERROR; } return SUCCESS; }