示例#1
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/component/save",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object saveComponent(@RequestBody PieceworkComponentEntity componentEntity) {

    if (componentEntity.getId() == null) {
      DoorTemplateEntity doorTemplateEntity =
          (DoorTemplateEntity)
              baseService.getObject(
                  DoorTemplateEntity.class, componentEntity.getDoor_template_id());
      componentEntity.setDoorTemplateEntity(doorTemplateEntity);
      doorTemplateEntity.getPieceworkComponentEntities().add(componentEntity);
      baseService.saveEntity(componentEntity);

    } else {
      PieceworkComponentEntity entity =
          (PieceworkComponentEntity)
              baseService.getObject(PieceworkComponentEntity.class, componentEntity.getId());
      entity.setName(componentEntity.getName());
      entity.setFnumber(componentEntity.getFnumber());
      baseService.updateEntity(entity);
    }

    return componentEntity;
  }
示例#2
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/pieceworkConfigs/clone/list",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object clonePieceworkConfigsEntitys(@RequestBody IdLongsBean bean) {

    if (bean.getId() == null || bean.getId() == 0L) {
      return bean;
    }
    PieceworkComponentEntity componentEntity =
        (PieceworkComponentEntity)
            baseService.getObject(PieceworkComponentEntity.class, bean.getId());
    String hql =
        "from PieceworkConfigEntity pieceworkConfigEntity where pieceworkConfigEntity.id in(:ids)";
    Map<String, Object> params = new ConcurrentHashMap<String, Object>();
    params.put("ids", bean.getLongs());
    List<PieceworkConfigEntity> clone_entities = baseService.getlist(hql, params);

    for (PieceworkConfigEntity _clone_entity : clone_entities) {
      PieceworkConfigEntity has = null;

      has = new PieceworkConfigEntity();
      has.setConditionScript(_clone_entity.getConditionScript());
      has.setFname(_clone_entity.getFname());
      has.setUsageScript(_clone_entity.getUsageScript());
      has.setPieceworkComponentEntity(componentEntity);
      componentEntity.getPieceworkConfigEntities().add(has);
      baseService.saveEntity(has);
    }

    return bean;
  }
示例#3
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/areaMaterialConfigs/clone/list",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object cloneMaterialConfigsEntitys(@RequestBody IdLongsBean bean) {

    if (bean.getId() == null || bean.getId() == 0L) {
      return bean;
    }
    AreaComponentEntity componentEntity =
        (AreaComponentEntity) baseService.getObject(AreaComponentEntity.class, bean.getId());
    //    	List<AreaMaterialsConfigEntity> old_entities =
    // componentEntity.getAreaMaterialsConfigEntities();
    String hql = "from AreaMaterialsConfigEntity entity where entity.id in(:ids)";
    Map<String, Object> params = new ConcurrentHashMap<String, Object>();
    params.put("ids", bean.getLongs());
    List<AreaMaterialsConfigEntity> clone_entities = baseService.getlist(hql, params);

    for (AreaMaterialsConfigEntity _clone_entity : clone_entities) {
      AreaMaterialsConfigEntity has = null;
      has = new AreaMaterialsConfigEntity();
      has.setUsageScript(_clone_entity.getUsageScript());
      has.setHelpCodeScript(_clone_entity.getHelpCodeScript());
      has.setParamScript(_clone_entity.getParamScript());
      has.setConditionScript(_clone_entity.getConditionScript());
      has.setQuerySqlId(_clone_entity.getQuerySqlId());
      has.setFname(_clone_entity.getFname());
      has.setAreaComponentEntity(componentEntity);
      componentEntity.getAreaMaterialsConfigEntities().add(has);
      baseService.saveEntity(has);
    }

    return bean;
  }
示例#4
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/areaMaterialConfigs/remove/{materialConfigId}",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object delMaterialConfigsEntity(@PathVariable Long areaMaterialConfigId) {

    AreaMaterialsConfigEntity entity =
        (AreaMaterialsConfigEntity)
            baseService.getObject(AreaMaterialsConfigEntity.class, areaMaterialConfigId);
    entity.getAreaComponentEntity().getAreaMaterialsConfigEntities().remove(entity);
    entity.setAreaComponentEntity(null);
    baseService.deleteEntity(entity);
    return entity;
  }
示例#5
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/pieceworkConfigs/remove/{pieceworkConfigId}",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object delPieceworkConfigsEntity(@PathVariable Long pieceworkConfigId) {

    PieceworkConfigEntity entity =
        (PieceworkConfigEntity)
            baseService.getObject(PieceworkConfigEntity.class, pieceworkConfigId);
    entity.getPieceworkComponentEntity().getPieceworkConfigEntities().remove(entity);
    entity.setPieceworkComponentEntity(null);
    baseService.deleteEntity(entity);

    return entity;
  }
示例#6
0
 @SuppressWarnings("unchecked")
 @RequestMapping(
     value = "/component/{componentId}",
     method = {RequestMethod.GET, RequestMethod.POST})
 @ResponseBody
 public Object getComponent(@PathVariable Long componentId) {
   AreaComponentEntity componentEntity =
       (AreaComponentEntity) baseService.getObject(AreaComponentEntity.class, componentId);
   return componentEntity;
 }
示例#7
0
 @SuppressWarnings("unchecked")
 @RequestMapping(
     value = "/door/piecework/index/{door_id}",
     method = {RequestMethod.GET, RequestMethod.POST})
 public ModelAndView getDoorRequireIndex(@PathVariable Long door_id) {
   Door door = (Door) baseService.getObject(Door.class, door_id);
   ModelAndView view = new ModelAndView();
   view.addObject("door", door);
   view.setViewName("piecework/doorPieceworks");
   return view;
 }
示例#8
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/areaMaterialConfigs/remove/list",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object delMaterialConfigsEntitys(@RequestBody List<AreaMaterialsConfigEntity> entities) {
    for (AreaMaterialsConfigEntity _entity : entities) {
      if (_entity.getId() == null || _entity.getId() == 0L) {
        continue;
      }
      AreaMaterialsConfigEntity configEntity =
          (AreaMaterialsConfigEntity)
              baseService.getObject(AreaMaterialsConfigEntity.class, _entity.getId());
      configEntity.getAreaComponentEntity().getAreaMaterialsConfigEntities().remove(configEntity);
      configEntity.setAreaComponentEntity(null);
      baseService.deleteEntity(configEntity);
    }

    return entities;
  }
示例#9
0
 @SuppressWarnings("unchecked")
 private void findComponentTree(List<PieceworkComponentEntity> result, Long componentId) {
   List<PieceworkComponentEntity> componentEntities =
       baseService.getlist(
           "from PieceworkComponentEntity pieceworkComponentEntity where pieceworkComponentEntity.super_id = "
               + componentId);
   for (PieceworkComponentEntity _entity : componentEntities) {
     result.add(_entity);
     findComponentTree(result, _entity.getId());
   }
 }
示例#10
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/component/piecework/{componentId}",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object getMaterialConfigs(@PathVariable Long componentId) {
    PieceworkComponentEntity componentEntity =
        (PieceworkComponentEntity)
            baseService.getObject(PieceworkComponentEntity.class, componentId);

    return componentEntity.getPieceworkConfigEntities();
  }
示例#11
0
 @SuppressWarnings("unchecked")
 @RequestMapping(
     value = "/pieceworkConfigs/clone/index/{id}",
     method = {RequestMethod.GET, RequestMethod.POST})
 public ModelAndView getCloneIndex(@PathVariable Long id) {
   ModelAndView view = new ModelAndView();
   PieceworkComponentEntity componentEntity =
       (PieceworkComponentEntity) baseService.getObject(PieceworkComponentEntity.class, id);
   view.addObject("component", componentEntity);
   view.setViewName("piecework/clonePieceworkIndex");
   return view;
 }
示例#12
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/pieceworkConfigs/save",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object savePieceworkConfigs(@RequestBody PieceworkConfigEntity _entity) {
    if (_entity.getId() == null) {
      PieceworkComponentEntity componentEntity =
          (PieceworkComponentEntity)
              baseService.getObject(PieceworkComponentEntity.class, _entity.getComponent_id());
      _entity.setPieceworkComponentEntity(componentEntity);
      baseService.saveEntity(_entity);
    } else {
      PieceworkConfigEntity entity =
          (PieceworkConfigEntity)
              baseService.getObject(PieceworkConfigEntity.class, _entity.getId());
      entity.setFname(_entity.getFname());
      baseService.updateEntity(entity);
    }

    return _entity;
  }
示例#13
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/component/remove/{componentId}",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object delComponentEntity(@PathVariable Long componentId) {
    AreaComponentEntity componentEntity =
        (AreaComponentEntity) baseService.getObject(AreaComponentEntity.class, componentId);
    componentEntity.getDoorTemplateEntity().getAreaComponentEntities().remove(componentEntity);
    componentEntity.setDoorTemplateEntity(null);
    baseService.deleteEntity(componentEntity);

    List<AreaComponentEntity> result = new ArrayList<AreaComponentEntity>();
    findComponentTree(result, componentId);
    for (AreaComponentEntity _entity : result) {
      _entity.getDoorTemplateEntity().getAreaComponentEntities().remove(_entity);
      _entity.setDoorTemplateEntity(null);
      baseService.deleteEntity(_entity);
    }

    return componentEntity;
  }
示例#14
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/components/tree/{templateId}",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object getComponentsTree(@PathVariable Long templateId) {
    DoorTemplateEntity doorTemplateEntity =
        (DoorTemplateEntity) baseService.getObject(DoorTemplateEntity.class, templateId);
    List<AreaComponentEntity> componentEntities = doorTemplateEntity.getAreaComponentEntities();

    List<TreeNode> roots = getCompoentTree(componentEntities, null);

    return roots;
  }
示例#15
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/areaMaterialConfigs/save",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object saveMaterialConfigs(@RequestBody AreaMaterialsConfigEntity _entity) {
    if (_entity.getId() == null) {
      AreaComponentEntity componentEntity =
          (AreaComponentEntity)
              baseService.getObject(AreaComponentEntity.class, _entity.getComponent_id());
      _entity.setAreaComponentEntity(componentEntity);
      baseService.saveEntity(_entity);
    } else {
      AreaMaterialsConfigEntity entity =
          (AreaMaterialsConfigEntity)
              baseService.getObject(AreaMaterialsConfigEntity.class, _entity.getId());
      entity.setFname(_entity.getFname());
      entity.setQuerySqlId(_entity.getQuerySqlId());
      baseService.updateEntity(entity);
    }

    return _entity;
  }
示例#16
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/door/materials/{door_id}",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object getMaterials(@PathVariable Long door_id) {

    Door door = (Door) baseService.getObject(Door.class, door_id);
    List<MaterialUsageEntity> usageEntities = door.getMaterials();
    List<MaterialUsageWebBean> webBeans = new ArrayList<MaterialUsageWebBean>();
    for (MaterialUsageEntity _entity : usageEntities) {
      MaterialUsageWebBean webBean = new MaterialUsageWebBean(_entity);
      webBeans.add(webBean);
    }
    return webBeans;
  }
示例#17
0
  @SuppressWarnings("unchecked")
  @RequestMapping(
      value = "/door/pieceworks/{door_id}",
      method = {RequestMethod.GET, RequestMethod.POST})
  @ResponseBody
  public Object getPieceworks(@PathVariable Long door_id) {

    Door door = (Door) baseService.getObject(Door.class, door_id);
    List<PieceworkEntity> pieceworkEntities = door.getPieceworkEntities();
    List<PieceworkWebBean> webBeans = new ArrayList<PieceworkWebBean>();
    for (PieceworkEntity _entity : pieceworkEntities) {
      PieceworkWebBean webBean = new PieceworkWebBean(_entity);
      webBeans.add(webBean);
    }
    return webBeans;
  }
示例#18
0
 @SuppressWarnings("unchecked")
 @RequestMapping(
     value = "/department/group/list",
     method = {RequestMethod.GET, RequestMethod.POST})
 @ResponseBody
 public Object getT_departments_group() {
   List<AreaComponentEntity> componentEntities =
       baseService.getlist("from AreaComponentEntity entity group by entity.name");
   Map<String, StrObjData> maps = new ConcurrentHashMap<String, StrObjData>();
   for (AreaComponentEntity _component : componentEntities) {
     String name = _component.getName();
     if (maps.get(name) == null) {
       maps.put(name, new StrObjData(_component.getName(), _component.getName()));
     }
   }
   return maps.values();
 }
示例#19
0
 @SuppressWarnings("unchecked")
 @RequestMapping(
     value = "/component/areaMaterials/{componentId}",
     method = {RequestMethod.GET, RequestMethod.POST})
 @ResponseBody
 public Object getAreaMaterialConfigs(@PathVariable Long componentId) {
   AreaComponentEntity componentEntity =
       (AreaComponentEntity) baseService.getObject(AreaComponentEntity.class, componentId);
   List<AreaMaterialsConfigEntity> materialsConfigEntities =
       componentEntity.getAreaMaterialsConfigEntities();
   //		for(AreaMaterialsConfigEntity materialsConfigEntity : materialsConfigEntities){
   //			MaterialBean bean =
   // materialListManager.getEntityByFNumber(materialsConfigEntity.getFNumber());
   //			if(bean == null){
   //				continue;
   //			}
   //			materialsConfigEntity.setFname(bean.getFname());
   //			materialsConfigEntity.setFmodel(bean.getFmodel());
   //			materialsConfigEntity.setUnit(bean.getUnit());
   //		}
   return materialsConfigEntities;
 }