Search in sources :

Example 6 with SysProgVO

use of com.netsteadfast.greenstep.vo.SysProgVO in project bamboobsc by billchen198318.

the class SystemProgramLogicServiceImpl method delete.

/**
	 * 刪除 TB_SYS_PROG 資料
	 * 
	 * @param sysProg
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(SysProgVO sysProg) throws ServiceException, Exception {
    if (sysProg == null || StringUtils.isBlank(sysProg.getOid())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    DefaultResult<SysProgVO> sysProgResult = this.sysProgService.findObjectByOid(sysProg);
    if (sysProgResult.getValue() == null) {
        throw new ServiceException(sysProgResult.getSystemMessage().getValue());
    }
    sysProg = sysProgResult.getValue();
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("progId", sysProg.getProgId());
    if (this.sysMenuService.countByParams(params) > 0) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
    }
    // 刪除 TB_SYS_MENU_ROLE 資料
    List<TbSysMenuRole> sysMenuRoleList = this.sysMenuRoleService.findListByParams(params);
    for (int i = 0; sysMenuRoleList != null && i < sysMenuRoleList.size(); i++) {
        TbSysMenuRole sysMenuRole = sysMenuRoleList.get(i);
        this.sysMenuRoleService.delete(sysMenuRole);
    }
    // 刪除名稱語言資料 tb_sys_prog_multi_name
    List<TbSysProgMultiName> progMultiNames = this.sysProgMultiNameService.findListByParams(params);
    for (int i = 0; progMultiNames != null && i < progMultiNames.size(); i++) {
        this.sysProgMultiNameService.delete(progMultiNames.get(i));
    }
    return this.sysProgService.deleteObject(sysProg);
}
Also used : TbSysMenuRole(com.netsteadfast.greenstep.po.hbm.TbSysMenuRole) TbSysProgMultiName(com.netsteadfast.greenstep.po.hbm.TbSysProgMultiName) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) SysProgVO(com.netsteadfast.greenstep.vo.SysProgVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 7 with SysProgVO

use of com.netsteadfast.greenstep.vo.SysProgVO in project bamboobsc by billchen198318.

the class SystemProgramLogicServiceImpl method createMultiName.

/**
	 * 產生 tb_sys_prog_multi_name 資料
	 * 
	 * @param multiName
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysProgMultiNameVO> createMultiName(SysProgMultiNameVO multiName) throws ServiceException, Exception {
    if (null == multiName || super.isBlank(multiName.getProgId()) || super.isBlank(multiName.getName()) || super.isBlank(multiName.getLocaleCode())) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    if (LocaleLanguageUtils.getMap().get(multiName.getLocaleCode()) == null) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    SysProgVO sysProg = new SysProgVO();
    sysProg.setProgId(multiName.getProgId());
    DefaultResult<SysProgVO> progResult = this.sysProgService.findByUK(sysProg);
    if (progResult.getValue() == null) {
        throw new ServiceException(progResult.getSystemMessage().getValue());
    }
    super.setStringValueMaxLength(multiName, "name", 100);
    return this.sysProgMultiNameService.saveObject(multiName);
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysProgVO(com.netsteadfast.greenstep.vo.SysProgVO) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority) Transactional(org.springframework.transaction.annotation.Transactional)

Example 8 with SysProgVO

use of com.netsteadfast.greenstep.vo.SysProgVO in project bamboobsc by billchen198318.

the class SystemMenuLogicServiceImpl method findForMenuSettingsEnableAndAll.

/**
	 * 找出選單設定功能要的
	 * 已在選單的程式 與 同SYS的程式
	 * 
	 * map 中的  key 
	 * enable	- 已在選單的程式
	 * all	- 同SYS的程式
	 * 
	 * @param folderProgramOid
	 * @return
	 * @throws ServiceException
	 * @throws Exception
	 */
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public Map<String, List<SysProgVO>> findForMenuSettingsEnableAndAll(String folderProgramOid) throws ServiceException, Exception {
    if (StringUtils.isBlank(folderProgramOid)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
    }
    SysProgVO sysProg = new SysProgVO();
    sysProg.setOid(folderProgramOid);
    DefaultResult<SysProgVO> spResult = this.sysProgService.findObjectByOid(sysProg);
    if (spResult.getValue() == null) {
        throw new ServiceException(spResult.getSystemMessage().getValue());
    }
    sysProg = spResult.getValue();
    Map<String, List<SysProgVO>> dataMap = new HashMap<String, List<SysProgVO>>();
    SysMenuVO sysMenu = new SysMenuVO();
    List<SysProgVO> enableList = null;
    List<SysProgVO> allList = null;
    sysMenu.setProgId(sysProg.getProgId());
    sysMenu.setParentOid(ZeroKeyProvide.OID_KEY);
    DefaultResult<SysMenuVO> smResult = this.sysMenuService.findByUK(sysMenu);
    if (smResult.getValue() != null) {
        sysMenu = smResult.getValue();
        enableList = this.sysProgService.findForInTheFolderMenuItems(sysProg.getProgSystem(), sysMenu.getOid(), MenuItemType.ITEM);
    }
    allList = this.sysProgService.findForSystemItems(sysProg.getProgSystem());
    if (enableList == null) {
        enableList = new ArrayList<SysProgVO>();
    }
    if (allList == null) {
        allList = new ArrayList<SysProgVO>();
    }
    dataMap.put("enable", enableList);
    dataMap.put("all", allList);
    return dataMap;
}
Also used : ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) HashMap(java.util.HashMap) SysMenuVO(com.netsteadfast.greenstep.vo.SysMenuVO) SysProgVO(com.netsteadfast.greenstep.vo.SysProgVO) ArrayList(java.util.ArrayList) List(java.util.List) ServiceMethodAuthority(com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)

Example 9 with SysProgVO

use of com.netsteadfast.greenstep.vo.SysProgVO in project bamboobsc by billchen198318.

the class CommonSelectItemsDataAction method queryItems.

private void queryItems() throws ServiceException, Exception {
    boolean pleaseSelect = YesNo.YES.equals(this.getFields().get("pleaseSelect"));
    if ("SYS".equals(this.getFields().get("type"))) {
        // 取 sys
        Map<String, String> sysMap = this.sysService.findSysMap(super.getBasePath(), pleaseSelect);
        this.resetPleaseSelectDataMapFromLocaleLang(sysMap);
        for (Map.Entry<String, String> entry : sysMap.entrySet()) {
            Map<String, String> dataMap = new HashMap<String, String>();
            dataMap.put("key", entry.getKey());
            dataMap.put("value", entry.getValue());
            this.items.add(dataMap);
        }
        this.success = IS_YES;
    }
    if ("SYS_PROG".equals(this.getFields().get("type"))) {
        // 取 sys_prog ITEM_TYPE='FOLDER'
        String sysOid = this.getFields().get("sysOid");
        SysVO sys = this.loadSysValueObj(sysOid);
        Map<String, String> sysProgMap = this.sysProgService.findSysProgFolderMap(super.getBasePath(), sys.getSysId(), MenuItemType.FOLDER, pleaseSelect);
        this.resetPleaseSelectDataMapFromLocaleLang(sysProgMap);
        for (Map.Entry<String, String> entry : sysProgMap.entrySet()) {
            Map<String, String> dataMap = new HashMap<String, String>();
            dataMap.put("key", entry.getKey());
            dataMap.put("value", entry.getValue());
            this.items.add(dataMap);
        }
        this.success = IS_YES;
    }
    if ("SYS_PROG_IN_MENU".equals(this.getFields().get("type"))) {
        // 取 sys_prog.prog_id 存在 tb_sys_menu 的資料 
        String sysOid = this.getFields().get("sysOid");
        SysVO sys = this.loadSysValueObj(sysOid);
        List<SysProgVO> menuProgList = this.sysProgService.findForInTheFolderMenuItems(sys.getSysId(), null, null);
        //this.items.add(super.providedSelectZeroDataMap(true));
        Map<String, String> dataMapFirst = new HashMap<String, String>();
        dataMapFirst.put("key", Constants.HTML_SELECT_NO_SELECT_ID);
        dataMapFirst.put("value", Constants.HTML_SELECT_NO_SELECT_NAME);
        this.resetPleaseSelectDataMapFromLocaleLang(dataMapFirst);
        this.items.add(dataMapFirst);
        if (menuProgList != null) {
            for (SysProgVO sysProg : menuProgList) {
                Map<String, String> dataMap = new HashMap<String, String>();
                dataMap.put("key", sysProg.getOid());
                dataMap.put("value", IconUtils.getMenuIcon(super.getBasePath(), sysProg.getIcon()) + StringEscapeUtils.escapeHtml4(sysProg.getName()));
                this.items.add(dataMap);
            }
        }
        this.success = IS_YES;
    }
}
Also used : HashMap(java.util.HashMap) SysProgVO(com.netsteadfast.greenstep.vo.SysProgVO) SysVO(com.netsteadfast.greenstep.vo.SysVO) HashMap(java.util.HashMap) Map(java.util.Map)

Example 10 with SysProgVO

use of com.netsteadfast.greenstep.vo.SysProgVO in project bamboobsc by billchen198318.

the class SystemProgramManagementSaveOrUpdateAction method save.

/**
	 * 產生 TB_SYS_PROG 資料
	 * 
	 * @throws ControllerException
	 * @throws AuthorityException
	 * @throws ServiceException
	 * @throws Exception
	 */
private void save() throws ControllerException, AuthorityException, ServiceException, Exception {
    this.checkFields("A");
    SysProgVO sysProg = new SysProgVO();
    this.transformFields2ValueObject(sysProg, new String[] { "progId", "name", "url", "itemType", "isWindow" }, new String[] { "CORE_PROG001D0002A_progId", "CORE_PROG001D0002A_name", "CORE_PROG001D0002A_url", "CORE_PROG001D0002A_itemType", "CORE_PROG001D0002A_isWindow" });
    sysProg.setEditMode(YesNo.NO);
    sysProg.setIsDialog(YesNo.NO);
    if ("true".equals(this.getFields().get("CORE_PROG001D0002A_editMode"))) {
        sysProg.setEditMode(YesNo.YES);
    }
    if ("true".equals(this.getFields().get("CORE_PROG001D0002A_isDialog"))) {
        sysProg.setIsDialog(YesNo.YES);
        sysProg.setDialogW(SimpleUtils.getInt(this.getFields().get("CORE_PROG001D0002A_dialogW"), 50));
        sysProg.setDialogH(SimpleUtils.getInt(this.getFields().get("CORE_PROG001D0002A_dialogH"), 25));
    }
    DefaultResult<SysProgVO> result = this.systemProgramLogicService.create(sysProg, this.getFields().get("CORE_PROG001D0002A_progSystem"), this.getFields().get("CORE_PROG001D0002A_icon"));
    this.message = result.getSystemMessage().getValue();
    if (result.getValue() == null) {
        return;
    }
    this.success = IS_YES;
}
Also used : SysProgVO(com.netsteadfast.greenstep.vo.SysProgVO)

Aggregations

SysProgVO (com.netsteadfast.greenstep.vo.SysProgVO)12 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)8 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)5 HashMap (java.util.HashMap)5 Transactional (org.springframework.transaction.annotation.Transactional)4 SysMenuVO (com.netsteadfast.greenstep.vo.SysMenuVO)3 DefaultResult (com.netsteadfast.greenstep.base.model.DefaultResult)2 SystemMessage (com.netsteadfast.greenstep.base.model.SystemMessage)2 TbSysMenuRole (com.netsteadfast.greenstep.po.hbm.TbSysMenuRole)2 RoleVO (com.netsteadfast.greenstep.vo.RoleVO)2 SysMenuRoleVO (com.netsteadfast.greenstep.vo.SysMenuRoleVO)2 UserRoleVO (com.netsteadfast.greenstep.vo.UserRoleVO)2 List (java.util.List)2 TbSys (com.netsteadfast.greenstep.po.hbm.TbSys)1 TbSysIcon (com.netsteadfast.greenstep.po.hbm.TbSysIcon)1 TbSysProgMultiName (com.netsteadfast.greenstep.po.hbm.TbSysProgMultiName)1 SysVO (com.netsteadfast.greenstep.vo.SysVO)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1