예제 #1
0
 @Override
 public String listjson() {
   parseCondition();
   pager = employeeService.findPager(objectQuery);
   actionJsonResult = new ActionJsonResult(pager);
   return JSONALL;
 }
예제 #2
0
 private List<ActionResource> findResources() {
   Employee employee = (Employee) getSession().get(LOGIN_USER);
   SystemSetting setting = (SystemSetting) getApplication().get(ConstValue.SYS_SETTING);
   Boolean opened = setting.getCompanyInfo().getOpened();
   List<ActionResource> resources = employeeService.findUserResources(employee.getId(), !opened);
   Collections.sort(resources, new LftRgtTreeNodeComparator()); // 按左值排序。
   return resources;
 }
예제 #3
0
 @Override
 public String delete() {
   logger.debug("Employee delete.....");
   // id对应的记录不存在已经在Dao作了处理
   if (id != null) {
     employeeService.delete(id);
   }
   actionJsonResult = new ActionJsonResult(true, null);
   return JSONLIST; // 删除和保存都不需要跳转页面,如需跳转用RELOAD
 }
예제 #4
0
 @Override
 public String save() {
   if (employee.getDepartment() == null
       || employee.getDepartment().getId() == null
       || employee.getDepartment().getId() == -1) {
     employee.setDepartment(null);
   }
   // 修改后传过来的ids数组
   if (StringUtils.isNotBlank(ids)) {
     String[] idsStr = ids.split(",");
     Long[] idsLong = ArrayConverter.Strings2Longs(idsStr);
     for (Long idL : idsLong) {
       employee.getUser().getRoles().add(new Role(idL));
     }
   }
   if (StringUtils.isNotBlank(id)) {
     employeeService.update(employee);
   } else {
     employeeService.save(employee);
   }
   actionJsonResult = new ActionJsonResult(employee);
   return JSONLIST;
 }
예제 #5
0
 @Test
 public void testSave() {
   List<Product> allProducts = productService.getAll();
   List<Warehouse> allHouse = warehouseService.getAll();
   List<Employee> allemps = employeeService.getAll();
   // periodStock.setItem(periodStockService.)
   for (int i = 0; i < allProducts.size(); i++) {
     PeriodStock periodStock = new PeriodStock(); // 如果出错请把字符串长度改短
     periodStock.setWarehouse((Warehouse) getRandomObject(allHouse));
     periodStock.setProduct(allProducts.get(i));
     periodStock.setQuantity(new Random().nextInt(20) + 1);
     periodStock.setAmount(new BigDecimal(new Random().nextInt(400)));
     periodStockService.save(periodStock);
   }
 }
예제 #6
0
 @Override
 protected void beforInputSave() {
   logger.debug("beforInputSave...");
   if (StringUtils.isNotBlank(id)) {
     employee = employeeService.getById(id);
     employee.setDepartment(null);
     employee.getUser().getRoles().clear();
     // Set<Role> roles = employee.getRoles();
     if (isEditSave()) {
       // 如果是修改后的保存,因为prepare到save前会执行一次Set操作(modelDriven),
       // 所以要在保存前将其关联的对象置空
     } else {
       // 修改前的数据回显准备
       // ids = new Long[roles.size()];
       // int i = 0;
       // for (Role role : roles) {
       // ids[i++] = role.getId();
       // }
     }
   }
 }
예제 #7
0
 @Override
 public String listall() {
   actionJsonResult = new ActionJsonResult(employeeService.getAll());
   return JSONALL;
 }