code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
package com.legendshop.business.controller; import com.legendshop.business.service.UserAddressService; import com.legendshop.core.UserManager; import com.legendshop.core.base.AdminController; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.model.entity.UserAddress; import java.util.ResourceBundle; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping({"/admin/userAddress" }) public class UserAddressController extends BaseController implements AdminController<UserAddress, Long> { @Autowired private UserAddressService userAddressService; @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, UserAddress userAddress) { CriteriaQuery cq = new CriteriaQuery(UserAddress.class, curPageNO); cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); cq = hasAllDataFunction(cq, request, StringUtils.trim(userAddress.getUserName())); cq.add(); PageSupport ps = this.userAddressService.getUserAddress(cq); savePage(ps, request); request.setAttribute("userAddress", userAddress); return "/userAddress/userAddressList"; } @RequestMapping({"/save" }) public String save(HttpServletRequest request, HttpServletResponse response, UserAddress userAddress) { this.userAddressService.saveUserAddress(userAddress); saveMessage( request, ResourceBundle.getBundle("i18n/ApplicationResources").getString( "operation.successful")); return "forward:/admin/userAddress/query.htm"; } @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { UserAddress userAddress = this.userAddressService.getUserAddress(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), userAddress.getUserName()); if (result != null) { return result; } this.userAddressService.deleteUserAddress(userAddress); saveMessage( request, ResourceBundle.getBundle("i18n/ApplicationResources").getString( "entity.deleted")); return "forward:/admin/userAddress/query.htm"; } @RequestMapping({"/load/{id}" }) public String load(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { UserAddress userAddress = this.userAddressService.getUserAddress(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), userAddress.getUserName()); if (result != null) { return result; } request.setAttribute("#entityClassInstance", userAddress); return "/userAddress/userAddress"; } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse response) { return "/userAddress/userAddress"; } @RequestMapping({"/update" }) public String update(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { UserAddress userAddress = this.userAddressService.getUserAddress(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), userAddress.getUserName()); if (result != null) { return result; } request.setAttribute("userAddress", userAddress); return "forward:/admin/userAddress/query.htm"; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/UserAddressController.java
Java
oos
4,430
package com.legendshop.business.controller; import com.legendshop.business.common.CommonServiceUtil; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.common.page.FowardPage; import com.legendshop.business.service.AdvertisementService; import com.legendshop.core.UserManager; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.constant.PathResolver; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.exception.LimitationException; import com.legendshop.core.exception.NotFoundException; import com.legendshop.core.exception.PermissionException; import com.legendshop.core.helper.FileProcessor; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.core.helper.RealPathUtil; import com.legendshop.core.helper.ResourceBundleHelper; import com.legendshop.model.entity.Advertisement; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; @Controller @RequestMapping({"/admin/advertisement" }) public class AdvertisementAdminController extends BaseController { private final Logger log = LoggerFactory .getLogger(AdvertisementAdminController.class); @Autowired private AdvertisementService advertisementService; @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, Advertisement advertisement) { CriteriaQuery cq = new CriteriaQuery(Advertisement.class, curPageNO); cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); cq = hasAllDataFunction(cq, request, StringUtils.trim(advertisement.getUserName())); cq.addOrder("asc", "type"); cq.add(); PageSupport ps = this.advertisementService.getDataByCriteriaQuery(cq); savePage(ps, request); request.setAttribute("bean", advertisement); return PathResolver.getPath(request, BackPage.ADV_LIST_PAGE); } @RequestMapping({"/save" }) public String save(HttpServletRequest request, HttpServletResponse response, Advertisement advertisement) { Advertisement origin = null; String picUrl = null; String name = UserManager.getUsername(request.getSession()); String subPath = name + "/advertisement/"; if ((advertisement != null) && (advertisement.getId() != null)) { origin = this.advertisementService.getAdvertisement(advertisement .getId()); if (origin == null) { throw new NotFoundException("Origin Advertisement is NULL", "25"); } String originPicUrl = origin.getPicUrl(); if ((!CommonServiceUtil.haveViewAllDataFunction(request)) && (!name.equals(origin.getUserName()))) { throw new PermissionException( "Can't edit Advertisement does not own to you!", "25"); } origin.setLinkUrl(advertisement.getLinkUrl()); origin.setType(advertisement.getType()); origin.setSourceInput(advertisement.getSourceInput()); origin.setEnabled(advertisement.getEnabled()); origin.setTitle(advertisement.getTitle()); if (advertisement.getFile().getSize() > 0L) { picUrl = FileProcessor.uploadFileAndCallback( advertisement.getFile(), subPath, "adv" + name); origin.setPicUrl(picUrl); String url = RealPathUtil.getBigPicRealPath() + "/" + originPicUrl; FileProcessor.deleteFile(url); } this.advertisementService.update(origin); } else { if (!this.advertisementService.isMaxNum(name, advertisement.getType())) { throw new LimitationException("您已经达到广告上限,不能再增加", "25"); } picUrl = FileProcessor.uploadFileAndCallback( advertisement.getFile(), subPath, "adv" + name); advertisement.setPicUrl(picUrl); advertisement .setUserId(UserManager.getUserId(request.getSession())); advertisement.setUserName(UserManager.getUsername(request .getSession())); this.advertisementService.save(advertisement); } saveMessage(request, ResourceBundleHelper.getSucessfulString()); return PathResolver.getPath(request, FowardPage.ADV_LIST_QUERY); } @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Advertisement advertisement = this.advertisementService .getAdvertisement(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), advertisement.getUserName()); if (result != null) { return result; } this.log.info("{}, delete Advertisement Url {}", advertisement.getUserName(), advertisement.getLinkUrl()); this.advertisementService.delete(id); String url = RealPathUtil.getBigPicRealPath() + "/" + advertisement.getPicUrl(); FileProcessor.deleteFile(url); saveMessage(request, ResourceBundleHelper.getDeleteString()); return PathResolver.getPath(request, FowardPage.ADV_LIST_QUERY); } @RequestMapping({"/load/{id}" }) public String load(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Advertisement advertisement = this.advertisementService .getAdvertisement(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), advertisement.getUserName()); if (result != null) { return result; } request.setAttribute("bean", advertisement); return PathResolver.getPath(request, BackPage.ADV_EDIT_PAGE); } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse response) { return PathResolver.getPath(request, BackPage.ADV_EDIT_PAGE); } @RequestMapping({"/update" }) public String update(HttpServletRequest request, HttpServletResponse response, @PathVariable Advertisement advertisement) { Advertisement origin = this.advertisementService .getAdvertisement(advertisement.getId()); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), origin.getUserName()); if (result != null) { return result; } advertisement.setUserId(origin.getUserId()); advertisement.setUserName(origin.getUserName()); this.advertisementService.update(advertisement); return PathResolver.getPath(request, FowardPage.ADV_LIST_QUERY); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/AdvertisementAdminController.java
Java
oos
7,822
package com.legendshop.business.controller; import com.legendshop.business.service.EventService; import com.legendshop.core.UserManager; import com.legendshop.core.base.AdminController; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.model.entity.Event; import java.util.ResourceBundle; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping({"/admin/event" }) public class EventController extends BaseController implements AdminController<Event, Long> { @Autowired private EventService eventService; @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, Event event) { CriteriaQuery cq = new CriteriaQuery(Event.class, curPageNO); cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); cq = hasAllDataFunction(cq, request, StringUtils.trim(event.getUserName())); cq.add(); PageSupport ps = this.eventService.getEvent(cq); savePage(ps, request); request.setAttribute("event", event); return "/event/eventList"; } @RequestMapping({"/save" }) public String save(HttpServletRequest request, HttpServletResponse response, Event event) { this.eventService.saveEvent(event); saveMessage( request, ResourceBundle.getBundle("i18n/ApplicationResources").getString( "operation.successful")); return "forward:/admin/event/query.htm"; } @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Event event = this.eventService.getEvent(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), event.getUserName()); if (result != null) { return result; } this.eventService.deleteEvent(event); saveMessage( request, ResourceBundle.getBundle("i18n/ApplicationResources").getString( "entity.deleted")); return "forward:/admin/event/query.htm"; } @RequestMapping({"/load/{id}" }) public String load(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Event event = this.eventService.getEvent(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), event.getUserName()); if (result != null) { return result; } request.setAttribute("#entityClassInstance", event); return "/event/event"; } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse response) { return "/event/event"; } @RequestMapping({"/update" }) public String update(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Event event = this.eventService.getEvent(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), event.getUserName()); if (result != null) { return result; } request.setAttribute("event", event); return "forward:/admin/event/query.htm"; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/EventController.java
Java
oos
4,091
package com.legendshop.business.controller; import com.legendshop.business.common.CommonServiceUtil; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.common.page.FowardPage; import com.legendshop.business.service.IndexJpgService; import com.legendshop.core.UserManager; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.constant.PathResolver; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.exception.BusinessException; import com.legendshop.core.helper.FileProcessor; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.core.helper.RealPathUtil; import com.legendshop.core.helper.ResourceBundleHelper; import com.legendshop.model.UserMessages; import com.legendshop.model.entity.Indexjpg; import com.legendshop.util.AppUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; @Controller @RequestMapping({"/admin/indexjpg" }) public class IndexJpgAdminController extends BaseController { private final Logger log = LoggerFactory .getLogger(IndexJpgAdminController.class); @Autowired private IndexJpgService indexJpgService; @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, Indexjpg indexjpg) { CriteriaQuery cq = new CriteriaQuery(Indexjpg.class, curPageNO); if (CommonServiceUtil.haveViewAllDataFunction(request)) { if (!AppUtils.isBlank(indexjpg.getUserName())) cq.like("userName", "%" + indexjpg.getUserName() + "%"); } else { cq.eq("userName", UserManager.getUsername(request)); } if (!CommonServiceUtil.isDataForExport(cq, request)) { cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); } if (!CommonServiceUtil.isDataSortByExternal(cq, request)) { cq.addOrder("desc", "id"); } cq.add(); PageSupport ps = this.indexJpgService.getIndexJpg(cq); savePage(ps, request); request.setAttribute("indexJpg", indexjpg); return PathResolver.getPath(request, BackPage.IJPG_LIST_PAGE); } @RequestMapping({"/save" }) public String save(HttpServletRequest request, HttpServletResponse response, Indexjpg indexjpg) { String name = UserManager.getUsername(request); Long num = this.indexJpgService.getIndexJpgNum(name); String result = checkMaxJpgNum(request, num); if (result != null) { return result; } String subPath = name + "/indexjpg/"; String filename = null; MultipartFile formFile = indexjpg.getFile(); try { if (indexjpg.getId() != null) { String orginImg = null; Indexjpg origin = this.indexJpgService.getIndexJpgById(indexjpg .getId()); String checkPrivilegeResult = checkPrivilege(request, name, origin.getUserName()); if (checkPrivilegeResult != null) { return checkPrivilegeResult; } if ((formFile != null) && (formFile.getSize() > 0L)) { orginImg = RealPathUtil.getBigPicRealPath() + "/" + origin.getImg(); filename = FileProcessor.uploadFileAndCallback(formFile, subPath, "" + name); origin.setImg(filename); } updateIndexjpg(request, response, indexjpg, origin); if ((formFile != null) && (formFile.getSize() > 0L) && (orginImg != null)) { FileProcessor.deleteFile(orginImg); } } else { indexjpg.setUserId(UserManager.getUserId(request)); indexjpg.setUserName(name); if ((formFile != null) && (formFile.getSize() > 0L)) { filename = FileProcessor.uploadFileAndCallback(formFile, subPath, "" + name); indexjpg.setImg(filename); } saveIndexjpg(request, response, indexjpg); } } catch (Exception e) { if ((formFile != null) && (formFile.getSize() > 0L)) { FileProcessor.deleteFile(RealPathUtil.getBigPicRealPath() + "/" + subPath + filename); } throw new BusinessException(e, "save Indexjpg error", "26", "998"); } saveMessage(request, ResourceBundleHelper.getSucessfulString()); return PathResolver.getPath(request, FowardPage.IJPG_LIST_QUERY); } private void saveIndexjpg(HttpServletRequest request, HttpServletResponse response, Indexjpg indexjpg) { this.indexJpgService.saveIndexjpg(indexjpg); } private void updateIndexjpg(HttpServletRequest request, HttpServletResponse response, Indexjpg indexjpg, Indexjpg origin) { origin.setAlt(indexjpg.getAlt()); origin.setHref(indexjpg.getHref()); origin.setId(indexjpg.getId()); origin.setLink(indexjpg.getLink()); origin.setStitle(indexjpg.getStitle()); origin.setTitle(indexjpg.getTitle()); origin.setTitleLink(indexjpg.getTitleLink()); this.indexJpgService.updateIndexjpg(origin); } private String checkMaxJpgNum(HttpServletRequest request, Long num) { String result = null; Integer maxNum = (Integer) PropertiesUtil.getObject( ParameterEnum.MAX_INDEX_JPG, Integer.class); if ((num != null) && (num.longValue() >= maxNum.intValue())) { UserMessages uem = new UserMessages(); uem.setTitle("系统设置不能上传多于" + maxNum + "张图片"); uem.setCode("701"); uem.addCallBackList("重新上传", "", PathResolver.getPath(request, BackPage.IJPG_EDIT_PAGE)); request.setAttribute(UserMessages.MESSAGE_KEY, uem); result = handleException(request, uem); } return result; } @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Indexjpg indexjpg = this.indexJpgService.getIndexJpgById(id); checkNullable("indexjpg", indexjpg); String userName = UserManager.getUsername(request); String result = checkPrivilege(request, userName, indexjpg.getUserName()); if (result != null) { return result; } this.log.debug("{} delete indexjpg {}", userName, id); this.indexJpgService.deleteIndexJpg(indexjpg); FileProcessor.deleteFile(RealPathUtil.getBigPicRealPath() + "/" + indexjpg.getImg()); saveMessage(request, ResourceBundleHelper.getSucessfulString()); return PathResolver.getPath(request, FowardPage.IJPG_LIST_QUERY); } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse response) { return PathResolver.getPath(request, BackPage.IJPG_EDIT_PAGE); } @RequestMapping({"/update/{id}" }) public String update(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { if (AppUtils.isBlank(id)) { throw new BusinessException("indexjpg Id is non nullable", "405"); } Indexjpg indexjpg = this.indexJpgService.getIndexJpgById(id); String result = checkPrivilege(request, UserManager.getUsername(request), indexjpg.getUserName()); if (result != null) { return result; } request.setAttribute("index", indexjpg); return PathResolver.getPath(request, BackPage.IJPG_EDIT_PAGE); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/IndexJpgAdminController.java
Java
oos
8,780
package com.legendshop.business.controller; import com.legendshop.business.common.DynamicPropertiesHelper; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.common.page.FowardPage; import com.legendshop.business.service.AdminService; import com.legendshop.core.UserManager; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.PathResolver; import com.legendshop.model.entity.Product; import com.legendshop.model.entity.ProductDetail; import com.legendshop.util.AppUtils; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.sf.json.JSONArray; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class XmlController extends BaseController { private final Logger log = LoggerFactory.getLogger(XmlController.class); @Autowired private AdminService adminService; @RequestMapping({"/dynamic/attribute/{prodId}" }) public String queryAttribute(HttpServletRequest request, HttpServletResponse response, @PathVariable Long prodId) { ProductDetail prod = (ProductDetail) request.getAttribute("prod"); String attribute = null; if (prod != null) attribute = prod.getAttribute(); else { attribute = this.adminService.getAttributeprodAttribute(prodId); } if (AppUtils.isNotBlank(attribute)) { List modelList = JSONArray.fromObject(attribute); request.setAttribute("list", modelList); } return PathResolver.getPath(request, BackPage.SHOW_DYNAMIC_ATTRIBUTE); } @RequestMapping({"/dynamic/parameter/{prodId}" }) public String queryParameter(HttpServletRequest request, HttpServletResponse response, @PathVariable Long prodId) { ProductDetail prod = (ProductDetail) request.getAttribute("prod"); String parameter = null; if (prod != null) parameter = prod.getParameter(); else { parameter = this.adminService.getProdParameter(prodId); } if (AppUtils.isNotBlank(parameter)) { List modelList = JSONArray.fromObject(parameter); DynamicPropertiesHelper helper = new DynamicPropertiesHelper(); request.setAttribute( "dynamicProperties", "<table class='goodsAttributeTable'>" + helper.gerenateHTML(modelList) + "</table>"); } return PathResolver.getPath(request, BackPage.SHOW_DYNAMIC); } @RequestMapping({"/dynamic/save" }) public String save(HttpServletRequest request, HttpServletResponse response) { return PathResolver.getPath(request, FowardPage.DYNAMIC_QUERY); } @RequestMapping({"/admin/dynamic/loadAttribute/{prodId}" }) public String loadAttributeprodAttribute(HttpServletRequest request, HttpServletResponse response, @PathVariable Long prodId) { String userName = UserManager.getUsername(request.getSession()); Product product = this.adminService.getProd(prodId, userName); if (AppUtils.isNotBlank(product)) { request.setAttribute("prod", product); if (AppUtils.isNotBlank(product.getAttribute())) { JSONArray jsonArray = JSONArray.fromObject(product .getAttribute()); request.setAttribute("imgFileJSON", jsonArray); } } request.setAttribute("DYNAMIC_TYPE", Integer.valueOf(1)); return PathResolver.getPath(request, BackPage.DYNAMIC_ATTRIBUTE); } @RequestMapping({"/admin/dynamic/loadParameter/{prodId}" }) public String loadParameter(HttpServletRequest request, HttpServletResponse response, @PathVariable Long prodId) { String userName = UserManager.getUsername(request.getSession()); Product product = this.adminService.getProd(prodId, userName); if (AppUtils.isNotBlank(product)) { request.setAttribute("prod", product); if (AppUtils.isNotBlank(product.getAttribute())) { JSONArray jsonArray = JSONArray.fromObject(product .getParameter()); request.setAttribute("imgFileJSON", jsonArray); } } request.setAttribute("DYNAMIC_TYPE", Integer.valueOf(2)); return PathResolver.getPath(request, BackPage.DYNAMIC_ATTRIBUTE); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/XmlController.java
Java
oos
4,880
package com.legendshop.business.controller; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.common.page.FowardPage; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.PathResolver; import com.legendshop.util.AppUtils; import java.util.Locale; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.LocaleResolver; @Controller public class LocaleController extends BaseController { private final Logger log = LoggerFactory .getLogger(LocaleController.class); private final String LANGUAGE = "language"; private final String COUNTRY = "country"; private final String PAGE = "page"; @Autowired private LocaleResolver localeResolver; @RequestMapping({"/changeLocale" }) public String changeLocale(HttpServletRequest request, HttpServletResponse response) { String language = request.getParameter("language"); String country = request.getParameter("country"); Locale locale = null; this.log.debug("language = {}, country = {}", language, country); if ((AppUtils.isNotBlank(language)) && (AppUtils.isNotBlank(country))) locale = new Locale(language, country); else if (AppUtils.isNotBlank(language)) { locale = new Locale(language, ""); } if (locale != null) { this.localeResolver.setLocale(request, response, locale); } String target = request.getParameter("page"); if (AppUtils.isNotBlank(target)) { return PathResolver.getPath(request, target, BackPage.VARIABLE); } return PathResolver.getPath(request, FowardPage.INDEX_QUERY); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/LocaleController.java
Java
oos
2,142
package com.legendshop.business.controller; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.search.LuceneReindexer; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.PathResolver; import com.legendshop.core.helper.ResourceBundleHelper; import com.legendshop.search.LuceneReindexArgs; import java.util.Date; import java.util.GregorianCalendar; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping({"/system/lucene" }) public class LuceneController extends BaseController { private final Logger log = LoggerFactory .getLogger(LuceneController.class); @Autowired private LuceneReindexer luceneReindexer; @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO) { return PathResolver.getPath(request, BackPage.LUCENE_PAGE); } @RequestMapping({"/reindex" }) public String reindex(HttpServletRequest request, HttpServletResponse response) { LuceneReindexArgs args = buildReindexArgs(request); boolean recreate = "recreate".equals(request .getParameter("indexOperationType")); this.log.info("reindex starting, recreate {} ", Boolean.valueOf(recreate)); this.luceneReindexer.startBackgroundProcess(args, recreate); this.luceneReindexer.list(); saveMessage(request, ResourceBundleHelper.getSucessfulString()); return PathResolver.getPath(request, BackPage.LUCENE_PAGE); } private LuceneReindexArgs buildReindexArgs(HttpServletRequest request) { Date fromDate = buildDateFromRequest(request, "from"); Date toDate = buildDateFromRequest(request, "to"); int firstPostId = 0; int lastPostId = 0; int entityType = 0; if (!StringUtils.isEmpty(request.getParameter("firstPostId"))) { firstPostId = Integer.valueOf(request.getParameter("firstPostId")) .intValue(); } if (!StringUtils.isEmpty(request.getParameter("lastPostId"))) { lastPostId = Integer.valueOf(request.getParameter("lastPostId")) .intValue(); } if (!StringUtils.isEmpty(request.getParameter("entityType"))) { entityType = Integer.valueOf(request.getParameter("entityType")) .intValue(); } return new LuceneReindexArgs(fromDate, toDate, firstPostId, lastPostId, "yes".equals(request.getParameter("avoidDuplicatedRecords")), Integer.valueOf(request.getParameter("type")).intValue(), entityType); } private Date buildDateFromRequest(HttpServletRequest request, String prefix) { String day = request.getParameter(prefix + "Day"); String month = request.getParameter(prefix + "Month"); String year = request.getParameter(prefix + "Year"); String hour = request.getParameter(prefix + "Hour"); String minutes = request.getParameter(prefix + "Minutes"); Date date = null; if ((!StringUtils.isEmpty(day)) && (!StringUtils.isEmpty(month)) && (!StringUtils.isEmpty(year)) && (!StringUtils.isEmpty(hour)) && (!StringUtils.isEmpty(minutes))) { date = new GregorianCalendar(Integer.parseInt(year), Integer.parseInt(month) - 1, Integer.parseInt(year), Integer.parseInt(hour), Integer.parseInt(minutes), 0).getTime(); } return date; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/LuceneController.java
Java
oos
4,110
package com.legendshop.business.controller; import com.legendshop.business.common.CommonServiceUtil; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.common.page.FowardPage; import com.legendshop.business.service.SortService; import com.legendshop.core.UserManager; import com.legendshop.core.base.AdminController; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.constant.PathResolver; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.exception.BusinessException; import com.legendshop.core.helper.FileProcessor; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.core.helper.RealPathUtil; import com.legendshop.core.helper.ResourceBundleHelper; import com.legendshop.model.entity.Sort; import com.legendshop.util.AppUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; @Controller @RequestMapping({"/admin/sort" }) public class SortAdminController extends BaseController implements AdminController<Sort, Long> { private final Logger log = LoggerFactory .getLogger(SortAdminController.class); @Autowired private SortService sortService; @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, Sort sort) { CriteriaQuery cq = new CriteriaQuery(Sort.class, curPageNO); if (AppUtils.isNotBlank(sort.getSortName())) { cq.like("sortName", "%" + sort.getSortName() + "%"); } hasAllDataFunction(cq, request, "userName", sort.getUserName()); if (!CommonServiceUtil.isDataForExport(cq, request)) { cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); } if (!CommonServiceUtil.isDataSortByExternal(cq, request)) { cq.addOrder("asc", "seq"); } cq.add(); PageSupport ps = this.sortService.getSortList(cq); savePage(ps, request); request.setAttribute("sort", sort); return PathResolver.getPath(request, BackPage.SORT_LIST_PAGE); } @RequestMapping({"/save" }) public String save(HttpServletRequest request, HttpServletResponse response, Sort entity) { MultipartFile formFile = entity.getFile(); String userName = UserManager.getUsername(request); String subPath = userName + "/sort/"; String filename = null; try { if (entity.getSortId() != null) { String orginPicture = null; Sort origin = this.sortService.getSortById(entity.getSortId()); if ((formFile != null) && (formFile.getSize() > 0L)) { orginPicture = RealPathUtil.getBigPicRealPath() + "/" + origin.getPicture(); filename = FileProcessor.uploadFileAndCallback(formFile, subPath, "" + userName); origin.setPicture(filename); } updateSort(request, response, entity, origin); if ((formFile != null) && (formFile.getSize() > 0L)) { FileProcessor.deleteFile(orginPicture); FileProcessor.deleteFile(orginPicture); } } else { entity.setUserId(UserManager.getUserId(request)); entity.setUserName(userName); if ((formFile != null) && (formFile.getSize() > 0L)) { filename = FileProcessor.uploadFileAndCallback(formFile, subPath, "" + userName); entity.setPicture(filename); } saveSort(request, response, entity); } } catch (Exception e) { if ((formFile != null) && (formFile.getSize() > 0L)) { FileProcessor.deleteFile(RealPathUtil.getBigPicRealPath() + "/" + subPath + filename); } throw new BusinessException(e, "save sort error", "20", "998"); } saveMessage(request, ResourceBundleHelper.getSucessfulString()); return PathResolver.getPath(request, FowardPage.SORT_LIST_QUERY); } private void saveSort(HttpServletRequest request, HttpServletResponse response, Sort entity) { this.sortService.save(entity); } private void updateSort(HttpServletRequest request, HttpServletResponse response, Sort entity, Sort origin) { origin.setSeq(entity.getSeq()); origin.setSortName(entity.getSortName()); this.sortService.updateSort(origin); } @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Sort sort = this.sortService.getSortById(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), sort.getUserName()); if (result != null) { return result; } this.log.info("{} delete SortName {}", new Object[] { sort.getUserName(), sort.getSortName() }); this.sortService.delete(sort); FileProcessor.deleteFile(RealPathUtil.getBigPicRealPath() + "/" + sort.getPicture()); saveMessage(request, ResourceBundleHelper.getDeleteString()); return PathResolver.getPath(request, FowardPage.SORT_LIST_QUERY); } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse response) { return PathResolver.getPath(request, BackPage.SORT_EDIT_PAGE); } @RequestMapping({"/update/{id}" }) public String update(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { checkNullable("sortId", id); Sort sort = this.sortService.getSortById(id); String result = checkPrivilege(request, UserManager.getUsername(request), sort.getUserName()); if (result != null) { return result; } request.setAttribute("sort", sort); return PathResolver.getPath(request, BackPage.SORT_EDIT_PAGE); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/SortAdminController.java
Java
oos
7,047
package com.legendshop.business.controller; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.service.PaymentService; import com.legendshop.core.UserManager; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.PathResolver; import com.legendshop.core.exception.BusinessException; import com.legendshop.util.AppUtils; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping({"/payment" }) public class PaymentController extends BaseController { private final Logger log = LoggerFactory .getLogger(PaymentController.class); @Autowired private PaymentService paymentService; @RequestMapping({"/payto" }) public String payment(HttpServletRequest request, HttpServletResponse response) { String userName = UserManager.getUsername(request.getSession()); if (AppUtils.isBlank(userName)) { throw new RuntimeException("not logined yet!"); } String shopName = request.getParameter("shopName"); checkNull("shopName", shopName); String payTypeId = request.getParameter("payTypeId"); checkNull("payTypeId", payTypeId); String out_trade_no = request.getParameter("subNumber"); checkNull("out_trade_no", out_trade_no); String subject = request.getParameter("aliorder"); String body = request.getParameter("alibody"); String price = request.getParameter("alimoney"); checkNull("price", price); String payment_result = this.paymentService.payto(shopName, userName, Integer.valueOf(payTypeId), out_trade_no, subject, body, price, request.getRemoteAddr()); this.log.debug("payment result = {}", payment_result); request.setAttribute("payment_result", payment_result); return PathResolver.getPath(request, BackPage.PAY_PAGE); } private void checkNull(String name, String value) { if (AppUtils.isBlank(value)) throw new BusinessException(name + " can no be null", "405"); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/PaymentController.java
Java
oos
2,531
package com.legendshop.business.controller; import com.legendshop.business.common.CommonServiceUtil; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.event.EventId; import com.legendshop.business.service.BusinessService; import com.legendshop.business.service.IndexService; import com.legendshop.core.UserManager; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.PathResolver; import com.legendshop.event.EventContext; import com.legendshop.event.EventHome; import com.legendshop.event.GenericEvent; import com.legendshop.model.UserInfo; import com.legendshop.model.entity.ShopDetailView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class IndexAdminController extends BaseController { public String ADMIN_MENU = "/frame/menu"; private final Logger log = LoggerFactory .getLogger(IndexAdminController.class); @Autowired private IndexService indexService; @Autowired private BusinessService businessService; @RequestMapping({"/admin/dashboard" }) public String load(HttpServletRequest request, HttpServletResponse response) { this.log.debug("adminIndex starting"); String userName = UserManager.getUsername(request.getSession()); ShopDetailView shopDetail = this.businessService .getSimpleInfoShopDetail(userName); UserInfo userInfo = this.indexService.getAdminIndex(userName, shopDetail); request.setAttribute("userInfo", userInfo); EventContext eventContext = new EventContext(request); EventHome.publishEvent(new GenericEvent(eventContext, EventId.LICENSE_UPGRADE_CHECK_EVENT)); if ((eventContext.getBooleanResponse().booleanValue()) && (CommonServiceUtil.haveViewAllDataFunction(request))) { request.setAttribute("needUpgrade", Boolean.valueOf(true)); } return PathResolver.getPath(request, BackPage.DASH_BOARD); } @RequestMapping({"/admin/index" }) public String home(HttpServletRequest request, HttpServletResponse response) { return PathResolver.getPath(request, BackPage.ADMIN_HOME); } @RequestMapping({"/admin/menu/{id}" }) public String menu(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { String path = this.ADMIN_MENU; if ((id != null) && (id.longValue() != 0L)) { path = this.ADMIN_MENU + id; } return PathResolver.getPath(request, path, BackPage.VARIABLE); } @RequestMapping({"/admin/top" }) public String top(HttpServletRequest request, HttpServletResponse response) { return PathResolver.getPath(request, BackPage.ADMIN_TOP); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/IndexAdminController.java
Java
oos
3,300
package com.legendshop.business.controller; import com.legendshop.business.common.CommonServiceUtil; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.service.OrderService; import com.legendshop.business.service.timer.SubService; import com.legendshop.core.UserManager; import com.legendshop.core.base.AdminController; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.constant.PathResolver; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.exception.PermissionException; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.model.entity.Sub; import com.legendshop.util.AppUtils; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping({"/admin/order" }) public class OrderAdminController extends BaseController implements AdminController<Sub, Long> { private final Logger log = LoggerFactory .getLogger(OrderAdminController.class); public static String LIST_PAGE = "/order/orderList"; public static String EDIT_PAGE = "/order/order"; public static String LIST_QUERY = "/admin/order/query"; @Autowired private OrderService orderService; @Autowired private SubService subService; @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, Sub entity) { String loginName = UserManager.getUsername(request); String subNumber = entity.getSubNumber(); if ((entity != null) && (entity.getSubCheck() == null)) { entity.setSubCheck("N"); } if (!AppUtils.isBlank(subNumber)) { subNumber = subNumber.trim(); } CriteriaQuery cq = new CriteriaQuery(Sub.class, curPageNO); if (CommonServiceUtil.haveViewAllDataFunction(request)) { if (!AppUtils.isBlank(entity.getShopName())) cq.eq("shopName", entity.getShopName()); } else { cq.eq("shopName", loginName); } if (AppUtils.isNotBlank(subNumber)) { cq.like("subNumber", subNumber + "%"); } if (AppUtils.isNotBlank(entity.getUserName())) { cq.like("userName", entity.getUserName() + "%"); } cq.eq("status", entity.getStatus()); cq.eq("subCheck", entity.getSubCheck()); if (!CommonServiceUtil.isDataForExport(cq, request)) { cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.FRONT_PAGE_SIZE, Integer.class)).intValue()); } if (!CommonServiceUtil.isDataSortByExternal(cq, request)) { cq.addOrder("desc", "subDate"); } cq.add(); PageSupport ps = this.orderService.getOrderList(cq); savePage(ps, request); request.setAttribute("subForm", entity); return PathResolver.getPath(request, BackPage.ORDER_LIST_PAGE); } @RequestMapping({"/save" }) public String save(HttpServletRequest request, HttpServletResponse response, Sub entity) { return null; } @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, Long id) { return null; } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse response) { return null; } @RequestMapping({"/loadBySubnumber/{subNumber}" }) public String loadBySubNember(HttpServletRequest request, HttpServletResponse response, @PathVariable String subNumber) { List baskets = this.subService.getBasketBySubNumber(subNumber); if (!AppUtils.isBlank(baskets)) { Double totalcash = CommonServiceUtil.calculateTotalCash(baskets); Sub sub = this.subService.getSubBySubNumber(subNumber); String loginName = UserManager.getUsername(request); if ((!CommonServiceUtil.haveViewAllDataFunction(request)) && (!sub.getShopName().equals(loginName))) { throw new PermissionException(loginName + " cann't view Sub id is " + sub.getSubId(), "17"); } request.setAttribute("sub", sub); request.setAttribute("baskets", baskets); request.setAttribute("totalcash", totalcash); } return PathResolver.getPath(request, BackPage.ORDERDETAIL); } @RequestMapping({"/update" }) public String update(HttpServletRequest request, HttpServletResponse response, Long id) { return null; } @RequestMapping({"/modifyPrice" }) public String modifyPrice(HttpServletRequest request, HttpServletResponse response, Long id) { return PathResolver.getPath(request, BackPage.MODIFYPRICE); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/OrderAdminController.java
Java
oos
5,568
package com.legendshop.business.controller; import com.legendshop.business.common.CommonServiceUtil; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.common.page.FowardPage; import com.legendshop.business.service.NewsService; import com.legendshop.core.UserManager; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.constant.PathResolver; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.core.helper.ResourceBundleHelper; import com.legendshop.model.entity.News; import com.legendshop.util.AppUtils; import com.legendshop.util.CodeFilter; import com.legendshop.util.sql.ConfigCode; import java.util.Date; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping({"/admin/news" }) public class NewsAdminController extends BaseController { private final Logger log = LoggerFactory .getLogger(NewsAdminController.class); public static String LIST_PAGE = "/news/newsList"; public static String EDIT_PAGE = "/news/news"; public static String LIST_QUERY = "/admin/news/query"; @Autowired private NewsService newsService; @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, News news) { String userName = UserManager.getUsername(request.getSession()); Map map = new HashMap(); HqlQuery hql = new HqlQuery(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue(), curPageNO); if (!CommonServiceUtil.haveViewAllDataFunction(request)) { map.put("userName", userName); hql.addParams(userName); } else if (AppUtils.isNotBlank(news.getUserName())) { map.put("userName", news.getUserName()); hql.addParams(news.getUserName()); } if (!AppUtils.isBlank(news.getNewsCategoryId())) { map.put("newsCategoryId", String.valueOf(news.getNewsCategoryId())); hql.addParams(news.getNewsCategoryId()); } if (!AppUtils.isBlank(news.getSortId())) { map.put("sortId", String.valueOf(news.getSortId())); hql.addParams(news.getSortId()); } if (!AppUtils.isBlank(news.getNewsTitle())) { map.put("newsTitle", news.getNewsTitle()); hql.addParams("%" + news.getNewsTitle() + "%"); } if (!AppUtils.isBlank(news.getStatus())) { map.put("status", String.valueOf(news.getStatus())); hql.addParams(news.getStatus()); } if (!CommonServiceUtil.isDataForExport(hql, request)) { hql.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); } if (!CommonServiceUtil.isDataSortByExternal(hql, request, map)) { map.put("orderIndicator", "order by n.newsDate desc"); } String QueryNsortCount = ConfigCode.getInstance().getCode( "biz.QueryNewsCount", map); String QueryNsort = ConfigCode.getInstance().getCode("biz.QueryNews", map); hql.setAllCountString(QueryNsortCount); hql.setQueryString(QueryNsort); PageSupport ps = this.newsService.getNewsList(hql); savePage(ps, request); request.setAttribute("bean", news); return PathResolver.getPath(request, BackPage.NEWS_LIST_PAGE); } @RequestMapping({"/save" }) public String save(HttpServletRequest request, HttpServletResponse response, News news) { if (news.getNewsId() != null) { return update(request, response, news); } news.setNewsDate(new Date()); news.setUserId(UserManager.getUserId(request.getSession())); news.setUserName(UserManager.getUsername(request.getSession())); this.newsService.save(news); saveMessage(request, ResourceBundleHelper.getSucessfulString()); return PathResolver.getPath(request, FowardPage.NEWS_LIST_QUERY); } private void setNewsBrief(News news) { String newsContent = news.getNewsContent(); if ((newsContent != null) && (newsContent.length() > 0)) { Integer len = Integer.valueOf(newsContent.length()); int maxLength = 100; boolean max = len.intValue() > maxLength; if (max) news.setNewsBrief(CodeFilter.unHtml(news.getNewsContent() .substring(0, maxLength)) + "..."); else news.setNewsBrief(CodeFilter.unHtml(newsContent)); } } @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { News news = this.newsService.getNewsById(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), news.getUserName()); if (result != null) { return result; } this.log.info("{},delete News Title{}", news.getUserName(), news.getNewsTitle()); this.newsService.delete(id); saveMessage(request, ResourceBundleHelper.getDeleteString()); return PathResolver.getPath(request, FowardPage.NEWS_LIST_QUERY); } @RequestMapping({"/load/{id}" }) public String load(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { News news = this.newsService.getNewsById(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), news.getUserName()); if (result != null) { return result; } request.setAttribute("news", news); return PathResolver.getPath(request, BackPage.NEWS_EDIT_PAGE); } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse response) { return PathResolver.getPath(request, BackPage.NEWS_EDIT_PAGE); } public String update(HttpServletRequest request, HttpServletResponse response, News news) { News origin = this.newsService.getNewsById(news.getNewsId()); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), origin.getUserName()); if (result != null) { return result; } this.log.info("{} update News Title{}", origin.getUserName(), origin.getNewsTitle()); news.setUserId(origin.getUserId()); news.setUserName(origin.getUserName()); this.newsService.update(news); saveMessage(request, ResourceBundleHelper.getSucessfulString()); return PathResolver.getPath(request, FowardPage.NEWS_LIST_QUERY); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/NewsAdminController.java
Java
oos
7,696
package com.legendshop.business.controller; import com.legendshop.business.common.CommonServiceUtil; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.common.page.FowardPage; import com.legendshop.business.service.LogoService; import com.legendshop.core.UserManager; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.constant.PathResolver; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.exception.NotFoundException; import com.legendshop.core.exception.PermissionException; import com.legendshop.core.helper.FileProcessor; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.core.helper.RealPathUtil; import com.legendshop.core.helper.ResourceBundleHelper; import com.legendshop.model.entity.Logo; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; @Controller @RequestMapping({"/admin/logo" }) public class LogoAdminController extends BaseController { private final Logger log = LoggerFactory .getLogger(LogoAdminController.class); @Autowired private LogoService logoService; @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, Logo logo) { CriteriaQuery cq = new CriteriaQuery(Logo.class, curPageNO, "javascript:pager"); cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); cq = hasAllDataFunction(cq, request, StringUtils.trim(logo.getUserName())); cq.add(); PageSupport ps = this.logoService.getLogoList(cq); savePage(ps, request); request.setAttribute("bean", logo); return PathResolver.getPath(request, BackPage.LOGO_LIST_PAGE); } @RequestMapping({"/save" }) public String save(MultipartHttpServletRequest request, HttpServletResponse response, Logo logo) { Logo originLogo = null; String banner = null; String name = UserManager.getUsername(request.getSession()); String subPath = name + "/logo/"; if ((logo != null) && (logo.getId() != null)) { originLogo = this.logoService.getLogoById(logo.getId()); if (originLogo == null) { throw new NotFoundException("Origin Logo is NULL", "22"); } String originBanner = originLogo.getBanner(); if ((!CommonServiceUtil.haveViewAllDataFunction(request)) && (!name.equals(originLogo.getUserName()))) { throw new PermissionException(name + " can't edit Logo does not own to you!", "22"); } originLogo.setUrl(logo.getUrl()); originLogo.setMemo(logo.getMemo()); if (logo.getFile().getSize() > 0L) { banner = FileProcessor.uploadFileAndCallback(logo.getFile(), subPath, "lo" + name); originLogo.setBanner(banner); String url = RealPathUtil.getBigPicRealPath() + "/" + originBanner; FileProcessor.deleteFile(url); } this.logoService.update(originLogo); } else { banner = FileProcessor.uploadFileAndCallback(logo.getFile(), subPath, "lo" + name); logo.setBanner(banner); logo.setUserId(UserManager.getUserId(request.getSession())); logo.setUserName(UserManager.getUsername(request.getSession())); this.logoService.save(logo); } saveMessage(request, ResourceBundleHelper.getSucessfulString()); return PathResolver.getPath(request, FowardPage.LOGO_LIST_QUERY); } @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Logo logo = this.logoService.getLogoById(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), logo.getUserName()); if (result != null) { return result; } this.log.info("{}, delete Logo Url {}", logo.getUserName(), logo.getUrl()); this.logoService.delete(id); String url = RealPathUtil.getBigPicRealPath() + "/" + logo.getBanner(); FileProcessor.deleteFile(url); saveMessage(request, ResourceBundleHelper.getDeleteString()); return PathResolver.getPath(request, FowardPage.LOGO_LIST_QUERY); } @RequestMapping({"/load/{id}" }) public String load(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Logo logo = this.logoService.getLogoById(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), logo.getUserName()); if (result != null) { return result; } request.setAttribute("bean", logo); return PathResolver.getPath(request, BackPage.LOGO_EDIT_PAGE); } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse response) { return PathResolver.getPath(request, BackPage.LOGO_EDIT_PAGE); } @RequestMapping({"/update" }) public String update(HttpServletRequest request, HttpServletResponse response, @PathVariable Logo logo) { Logo origin = this.logoService.getLogoById(logo.getId()); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), origin.getUserName()); if (result != null) { return result; } logo.setUserId(origin.getUserId()); logo.setUserName(origin.getUserName()); this.logoService.update(logo); return PathResolver.getPath(request, FowardPage.LOGO_LIST_QUERY); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/LogoAdminController.java
Java
oos
6,732
package com.legendshop.business.controller; import com.legendshop.business.service.CashService; import com.legendshop.core.UserManager; import com.legendshop.core.base.AdminController; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.model.entity.Cash; import java.util.ResourceBundle; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping({"/admin/cash" }) public class CashController extends BaseController implements AdminController<Cash, Long> { @Autowired private CashService cashService; @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, Cash cash) { CriteriaQuery cq = new CriteriaQuery(Cash.class, curPageNO); cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); cq = hasAllDataFunction(cq, request, StringUtils.trim(cash.getUserName())); cq.add(); PageSupport ps = this.cashService.getCash(cq); savePage(ps, request); request.setAttribute("cash", cash); return "/cash/cashList"; } @RequestMapping({"/save" }) public String save(HttpServletRequest request, HttpServletResponse response, Cash cash) { this.cashService.saveCash(cash); saveMessage( request, ResourceBundle.getBundle("i18n/ApplicationResources").getString( "operation.successful")); return "forward:/admin/cash/query.htm"; } @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Cash cash = this.cashService.getCash(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), cash.getUserName()); if (result != null) { return result; } this.cashService.deleteCash(cash); saveMessage( request, ResourceBundle.getBundle("i18n/ApplicationResources").getString( "entity.deleted")); return "forward:/admin/cash/query.htm"; } @RequestMapping({"/load/{id}" }) public String load(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Cash cash = this.cashService.getCash(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), cash.getUserName()); if (result != null) { return result; } request.setAttribute("#entityClassInstance", cash); return "/cash/cash"; } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse response) { return "/cash/cash"; } @RequestMapping({"/update" }) public String update(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Cash cash = this.cashService.getCash(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), cash.getUserName()); if (result != null) { return result; } request.setAttribute("cash", cash); return "forward:/admin/cash/query.htm"; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/CashController.java
Java
oos
4,041
package com.legendshop.business.controller; import com.legendshop.business.service.AskService; import com.legendshop.core.UserManager; import com.legendshop.core.base.AdminController; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.model.entity.Ask; import java.util.ResourceBundle; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping({"/admin/ask" }) public class AskController extends BaseController implements AdminController<Ask, Long> { @Autowired private AskService askService; @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, Ask ask) { CriteriaQuery cq = new CriteriaQuery(Ask.class, curPageNO); cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); cq = hasAllDataFunction(cq, request, StringUtils.trim(ask.getUserName())); cq.add(); PageSupport ps = this.askService.getAsk(cq); savePage(ps, request); request.setAttribute("ask", ask); return "/ask/askList"; } @RequestMapping({"/save" }) public String save(HttpServletRequest request, HttpServletResponse response, Ask ask) { this.askService.saveAsk(ask); saveMessage( request, ResourceBundle.getBundle("i18n/ApplicationResources").getString( "operation.successful")); return "forward:/admin/ask/query.htm"; } @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Ask ask = this.askService.getAsk(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), ask.getUserName()); if (result != null) { return result; } this.askService.deleteAsk(ask); saveMessage( request, ResourceBundle.getBundle("i18n/ApplicationResources").getString( "entity.deleted")); return "forward:/admin/ask/query.htm"; } @RequestMapping({"/load/{id}" }) public String load(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Ask ask = this.askService.getAsk(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), ask.getUserName()); if (result != null) { return result; } request.setAttribute("#entityClassInstance", ask); return "/ask/ask"; } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse response) { return "/ask/ask"; } @RequestMapping({"/update" }) public String update(HttpServletRequest request, HttpServletResponse response, @PathVariable Long id) { Ask ask = this.askService.getAsk(id); String result = checkPrivilege(request, UserManager.getUsername(request.getSession()), ask.getUserName()); if (result != null) { return result; } request.setAttribute("ask", ask); return "forward:/admin/ask/query.htm"; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/controller/AskController.java
Java
oos
3,991
package com.legendshop.business.newservice; import com.legendshop.business.service.ValidateCodeUsernamePasswordAuthenticationFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; public class LoginServiceImpl extends ValidateCodeUsernamePasswordAuthenticationFilter { Logger log = LoggerFactory.getLogger(LoginServiceImpl.class); public Authentication onAuthentication(HttpServletRequest request, HttpServletResponse response, String username, String password) { this.log.debug("userName {} register and login", username); return super.onAuthentication(request, response, username, password); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/newservice/LoginServiceImpl.java
Java
oos
824
package com.legendshop.business.form; import com.legendshop.model.entity.ShopDetail; import java.util.Date; public class UserForm { private static final long serialVersionUID = -4363234793127853507L; private String userId; private String name; private String password; private String passwordOld; private String enabled = "1"; private String note; private Integer gradeId; private String userName; private String nickName; private String userMail; private String userAdds; private String userTel; private String userPostcode; private String msn; private String qq; private String fax; private Date modifyTime; private Date userRegtime; private String userRegip; private Date userLasttime; private String userLastip; private String userMemo; private String sex; private String birthDate; private String userMobile; private String userBirthYear; private String userBirthMonth; private String userBirthDay; private ShopDetail shopDetail = new ShopDetail(); public String getEnabled() { return this.enabled; } public void setEnabled(String enabled) { this.enabled = enabled; } public String getFax() { return this.fax; } public void setFax(String fax) { this.fax = fax; } public Integer getGradeId() { return this.gradeId; } public void setGradeId(Integer gradeId) { this.gradeId = gradeId; } public Date getModifyTime() { return this.modifyTime; } public void setModifyTime(Date modifyTime) { this.modifyTime = modifyTime; } public String getMsn() { return this.msn; } public void setMsn(String msn) { this.msn = msn; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getNickName() { return this.nickName; } public void setNickName(String nickName) { this.nickName = nickName; } public String getNote() { return this.note; } public void setNote(String note) { this.note = note; } public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } public String getQq() { return this.qq; } public void setQq(String qq) { this.qq = qq; } public ShopDetail getShopDetail() { return this.shopDetail; } public void setShopDetail(ShopDetail shopDetail) { this.shopDetail = shopDetail; } public String getUserAdds() { return this.userAdds; } public void setUserAdds(String userAdds) { this.userAdds = userAdds; } public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; } public String getUserLastip() { return this.userLastip; } public void setUserLastip(String userLastip) { this.userLastip = userLastip; } public Date getUserLasttime() { return this.userLasttime; } public void setUserLasttime(Date userLasttime) { this.userLasttime = userLasttime; } public String getUserMail() { return this.userMail; } public void setUserMail(String userMail) { this.userMail = userMail; } public String getUserMemo() { return this.userMemo; } public void setUserMemo(String userMemo) { this.userMemo = userMemo; } public String getUserName() { return this.userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserPostcode() { return this.userPostcode; } public void setUserPostcode(String userPostcode) { this.userPostcode = userPostcode; } public String getUserRegip() { return this.userRegip; } public void setUserRegip(String userRegip) { this.userRegip = userRegip; } public Date getUserRegtime() { return this.userRegtime; } public void setUserRegtime(Date userRegtime) { this.userRegtime = userRegtime; } public String getUserTel() { return this.userTel; } public void setUserTel(String userTel) { this.userTel = userTel; } public String getPasswordOld() { return this.passwordOld; } public void setPasswordOld(String passwordOld) { this.passwordOld = passwordOld; } public String getSex() { return this.sex; } public void setSex(String sex) { this.sex = sex; } public String getBirthDate() { return this.birthDate; } public void setBirthDate(String birthDate) { this.birthDate = birthDate; } public String getUserBirthYear() { return this.userBirthYear; } public void setUserBirthYear(String userBirthYear) { this.userBirthYear = userBirthYear; } public String getUserBirthMonth() { return this.userBirthMonth; } public void setUserBirthMonth(String userBirthMonth) { this.userBirthMonth = userBirthMonth; } public String getUserBirthDay() { return this.userBirthDay; } public void setUserBirthDay(String userBirthDay) { this.userBirthDay = userBirthDay; } public String getUserMobile() { return this.userMobile; } public void setUserMobile(String userMobile) { this.userMobile = userMobile; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/form/UserForm.java
Java
oos
6,553
package com.legendshop.business.form; import java.util.Date; public class BasketForm { private static final long serialVersionUID = 5076753905519824021L; private Integer count; private String action; private Double carriage; private String attribute; private Long basketId; private Long prodId; private String pic; private String userName; private Integer basketCount; private Date basketDate; private String basketCheck; private String prodName; private Double cash; private String subNumber; private String daili; public BasketForm() { } public BasketForm(Long basketId) { this.basketId = basketId; } public Long getBasketId() { return this.basketId; } public void setBasketId(Long basketId) { this.basketId = basketId; } public Long getProdId() { return this.prodId; } public void setProdId(Long hwId) { this.prodId = hwId; } public String getUserName() { return this.userName; } public void setUserName(String userName) { this.userName = userName; } public Integer getBasketCount() { return this.basketCount; } public void setBasketCount(Integer basketCount) { this.basketCount = basketCount; } public Date getBasketDate() { return this.basketDate; } public void setBasketDate(Date basketDate) { this.basketDate = basketDate; } public String getBasketCheck() { return this.basketCheck; } public void setBasketCheck(String basketCheck) { this.basketCheck = basketCheck; } public String getProdName() { return this.prodName; } public void setProdName(String hwName) { this.prodName = hwName; } public Double getCash() { return this.cash; } public void setCash(Double hwCash) { this.cash = hwCash; } public String getSubNumber() { return this.subNumber; } public void setSubNumber(String subNumber) { this.subNumber = subNumber; } public String getDaili() { return this.daili; } public void setDaili(String daili) { this.daili = daili; } public String getAction() { return this.action; } public void setAction(String action) { this.action = action; } public Integer getCount() { return this.count; } public void setCount(Integer count) { this.count = count; } public Double getCarriage() { return this.carriage; } public void setCarriage(Double carriage) { this.carriage = carriage; } public String getAttribute() { return this.attribute; } public void setAttribute(String attribute) { this.attribute = attribute; } public String getPic() { return this.pic; } public void setPic(String hwPic) { this.pic = hwPic; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/form/BasketForm.java
Java
oos
3,466
package com.legendshop.business.form; public class SubForm { private static final long serialVersionUID = 2769000419985544497L; private String userName; private String shopName; private String subNumber; private Integer status; private String subCheck = "N"; private String curPageNO = "1"; public String getUserName() { return this.userName; } public void setUserName(String userName) { this.userName = userName; } public String getShopName() { return this.shopName; } public void setShopName(String shopName) { this.shopName = shopName; } public String getSubNumber() { return this.subNumber; } public void setSubNumber(String subNumber) { this.subNumber = subNumber; } public Integer getStatus() { return this.status; } public void setStatus(Integer status) { this.status = status; } public String getSubCheck() { return this.subCheck; } public void setSubCheck(String subCheck) { this.subCheck = subCheck; } public String getCurPageNO() { return this.curPageNO; } public void setCurPageNO(String curPageNO) { this.curPageNO = curPageNO; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/form/SubForm.java
Java
oos
1,471
package com.legendshop.business.form; import java.util.Date; public class MemberForm { private static final long serialVersionUID = -3445526260441415877L; private Double total; private Long payType; private String basketId; private String other; private Integer userId; private String userName; private String orderName; private String userPass; private String userMail; private String userAdds; private String payTypeName; private String userTel; private Date userRegtime; private String userRegip; private Date userLasttime; private String userLastip; private String userBuymoney; private String userPostcode; private String userNamec; private String userType; public String getUserAdds() { return this.userAdds; } public void setUserAdds(String userAdds) { this.userAdds = userAdds; } public String getUserBuymoney() { return this.userBuymoney; } public void setUserBuymoney(String userBuymoney) { this.userBuymoney = userBuymoney; } public Integer getUserId() { return this.userId; } public void setUserId(Integer userId) { this.userId = userId; } public String getUserLastip() { return this.userLastip; } public void setUserLastip(String userLastip) { this.userLastip = userLastip; } public Date getUserLasttime() { return this.userLasttime; } public void setUserLasttime(Date userLasttime) { this.userLasttime = userLasttime; } public String getUserMail() { return this.userMail; } public void setUserMail(String userMail) { this.userMail = userMail; } public String getUserName() { return this.userName; } public void setUserName(String userName) { this.userName = userName; } public String getUserNamec() { return this.userNamec; } public void setUserNamec(String userNamec) { this.userNamec = userNamec; } public String getUserPass() { return this.userPass; } public void setUserPass(String userPass) { this.userPass = userPass; } public String getUserPostcode() { return this.userPostcode; } public void setUserPostcode(String userPostcode) { this.userPostcode = userPostcode; } public String getUserRegip() { return this.userRegip; } public void setUserRegip(String userRegip) { this.userRegip = userRegip; } public Date getUserRegtime() { return this.userRegtime; } public void setUserRegtime(Date userRegtime) { this.userRegtime = userRegtime; } public String getUserTel() { return this.userTel; } public void setUserTel(String userTel) { this.userTel = userTel; } public String getUserType() { return this.userType; } public void setUserType(String userType) { this.userType = userType; } public Long getPayType() { return this.payType; } public void setPayType(Long payType) { this.payType = payType; } public String getOther() { return this.other; } public void setOther(String other) { this.other = other; } public String getBasketId() { return this.basketId; } public void setBasketId(String basketId) { this.basketId = basketId; } public String getOrderName() { return this.orderName; } public void setOrderName(String orderName) { this.orderName = orderName; } public Double getTotal() { return this.total; } public void setTotal(Double total) { this.total = total; } public String getPayTypeName() { return this.payTypeName; } public void setPayTypeName(String payTypeName) { this.payTypeName = payTypeName; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/form/MemberForm.java
Java
oos
4,571
package com.legendshop.business.form; public class SearchForm { private static final long serialVersionUID = 2489827230218323847L; private String curPageNOTop = "1"; private String keyword; private Long sortId; public String getCurPageNOTop() { return this.curPageNOTop; } public void setCurPageNOTop(String curPageNOTop) { this.curPageNOTop = curPageNOTop; } public String getKeyword() { return this.keyword; } public void setKeyword(String keyword) { this.keyword = keyword; } public Long getSortId() { return this.sortId; } public void setSortId(Long sortId) { this.sortId = sortId; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/form/SearchForm.java
Java
oos
804
package com.legendshop.business.event.impl; import com.legendshop.business.event.EventId; import com.legendshop.event.SystemEvent; public class UserRegEvent extends SystemEvent<String> { public UserRegEvent(String source) { super(source, EventId.USER_REG_EVENT); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/event/impl/UserRegEvent.java
Java
oos
295
package com.legendshop.business.event.impl; import com.legendshop.business.event.EventId; import com.legendshop.event.SystemEvent; public class SendMailEvent extends SystemEvent<String> { public SendMailEvent(String source) { super(source, EventId.SEND_MAIL_EVENT); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/event/impl/SendMailEvent.java
Java
oos
298
package com.legendshop.business.event; import com.legendshop.event.BaseEventId; public enum EventId implements BaseEventId { USER_REG_EVENT("USER_REG"), SEND_MAIL_EVENT("SEND_MAIL"), SEND_SMS_EVENT( "SEND_SMS"), ORDER_CHANGE_EVENT("ORDER_CHANGE"), SHOP_CHANGE_EVENT( "SHOP_CHANGE"), PROD_CHANGE_EVENT("PROD_CHANGE"), LICENSE_STATUS_CHECK_EVENT("LICENSE_STATUS_CHECK"), LICENSE_UPGRADE_CHECK_EVENT("LICENSE_UPGRADE_CHECK"), FUNCTION_CHECK_EVENT("FUNCTION_CHECK"), CAN_ADD_SHOPDETAIL_EVENT("CAN_ADD_SHOPDETAIL"); private final String value; public String getEventId() { return this.value; } private EventId(String value) { this.value = value; } public boolean instance(String name) { EventId[] eventIds = values(); for (EventId eventId : eventIds) { if (eventId.name().equals(name)) { return true; } } return false; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/event/EventId.java
Java
oos
1,033
package com.legendshop.business.event.listener; import com.legendshop.event.processor.ThreadProcessor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SendMailProcessor extends ThreadProcessor<String> { private final Logger log = LoggerFactory.getLogger(SendMailProcessor.class); public boolean isSupport(String task) { this.log.info("SendMailProcessor isSupport calling, task= " + task); return true; } public void process(String task) { this.log.info("SendMailProcessor process calling, task= " + task); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/event/listener/SendMailProcessor.java
Java
oos
606
package com.legendshop.business.event.listener; import com.legendshop.event.processor.BaseProcessor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class UserRegProcessor extends BaseProcessor<String> { private final Logger log = LoggerFactory.getLogger(UserRegProcessor.class); public boolean isSupport(String task) { this.log.info("UserRegProcessor isSupport calling, task= " + task); return true; } public void process(String task) { this.log.info("UserRegProcessor process calling, task= " + task); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/event/listener/UserRegProcessor.java
Java
oos
598
package com.legendshop.business; import com.legendshop.business.service.SystemParameterService; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.core.plugins.Plugin; import com.legendshop.core.plugins.PluginConfig; import com.legendshop.core.tag.TableCache; import com.legendshop.search.SearchFacade; import javax.servlet.ServletContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class BusinessPlugin implements Plugin { private static Logger log = LoggerFactory .getLogger(BusinessPlugin.class); private SystemParameterService systemParameterService; private TableCache codeTablesCache; private SearchFacade searchFacade; private PluginConfig pluginConfig; public void bind(ServletContext servletContext) { this.systemParameterService.initSystemParameter(); this.codeTablesCache.initCodeTablesCache(); String luceneIndexPath = PropertiesUtil.getLucenePath(); log.info("luceneIndexPath is {}", luceneIndexPath); this.searchFacade.init(luceneIndexPath); } public void unbind(ServletContext servletContext) { } public PluginConfig getPluginConfig() { return this.pluginConfig; } public void setSystemParameterService( SystemParameterService systemParameterServiceImpl) { this.systemParameterService = systemParameterServiceImpl; } public void setCodeTablesCache(TableCache codeTablesCache) { this.codeTablesCache = codeTablesCache; } public void setSearchFacade(SearchFacade searchFacade) { this.searchFacade = searchFacade; } public void setPluginConfig(PluginConfig pluginConfig) { this.pluginConfig = pluginConfig; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/BusinessPlugin.java
Java
oos
1,932
package com.legendshop.business.permission.controller; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.common.page.FowardPage; import com.legendshop.business.helper.FunctionChecker; import com.legendshop.business.helper.StateChecker; import com.legendshop.business.permission.form.FunctionForm; import com.legendshop.business.permission.form.PermissionForm; import com.legendshop.business.permission.form.RoleForm; import com.legendshop.business.permission.service.RightDelegate; import com.legendshop.command.framework.State; import com.legendshop.command.framework.StateImpl; import com.legendshop.core.AttributeKeys; import com.legendshop.core.UserManager; import com.legendshop.core.base.AdminController; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.constant.PathResolver; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.exception.BusinessException; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.model.entity.Function; import com.legendshop.model.entity.Permission; import com.legendshop.model.entity.PerssionId; import com.legendshop.model.entity.Role; import com.legendshop.util.AppUtils; import com.legendshop.util.StringUtil; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping({"/member/right" }) public class FunctionController extends BaseController implements AdminController<Function, String> { private final Logger log = LoggerFactory .getLogger(FunctionController.class); @Autowired private RightDelegate rightDelegate; @Autowired private FunctionChecker functionChecker; @Autowired private StateChecker stateChecker; @RequestMapping({"/deleteFunctionById" }) public String deleteFunctionById(HttpServletRequest request, HttpServletResponse response, String curPageNO, String roleId, FunctionForm functionForm) { String id = request.getParameter("id"); this.logger.info("Struts Action deleteFunctionById with id " + id); State state = new StateImpl(); boolean result = this.rightDelegate.deleteFunctionById(id, state); this.logger.debug("deleteFunctionById result = " + result); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.FUNCTION_LIST_QUERY); } @RequestMapping({"/findFunctionById" }) public String findFunctionById(HttpServletRequest request, HttpServletResponse response, String id) { this.logger.info("Struts Action findFunctionById with id " + id); State state = new StateImpl(); Function function = this.rightDelegate.findFunctionById(id, state); this.stateChecker.check(state, request); request.setAttribute("function", function); return PathResolver.getPath(request, BackPage.UPDATE_FUNCTION); } @RequestMapping({"/findFunctionByRole" }) public String findFunctionByRole(HttpServletRequest request, HttpServletResponse response, String roleId) { this.logger .info("Struts FunctionAction findFunctionByRole with roleId " + roleId); State state = new StateImpl(); Role role = this.rightDelegate.findRoleById(roleId, state); List list = this.rightDelegate.findFunctionByRoleId(roleId, state); this.stateChecker.check(state, request); request.setAttribute("list", list); request.setAttribute("role", role); return PathResolver.getPath(request, FowardPage.FIND_FUNCTION_BY_ROLE); } @RequestMapping({"/findOtherFunctionByHql" }) public String findOtherFunctionByHql(HttpServletRequest request, HttpServletResponse response, String curPageNO, String roleId) { String myAction = "findOtherFunctionByHql" + AttributeKeys.WEB_SUFFIX; if (roleId != null) { myAction = "findOtherFunctionByHql.do?roleId=" + roleId; } HqlQuery hq = new HqlQuery(myAction); hq.setCurPage(curPageNO); hq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); State state = new StateImpl(); Role role = this.rightDelegate.findRoleById(roleId, state); PageSupport ps = this.rightDelegate.findOtherFunctionByHql(hq, roleId, state); this.stateChecker.check(state, request); request.setAttribute("curPageNO", new Integer(ps.getCurPageNO())); request.setAttribute("offset", new Integer(ps.getOffset() + 1)); if (ps.hasMutilPage()) request.setAttribute("toolBar", ps.getToolBar()); request.setAttribute("functionList", ps.getResultList()); request.setAttribute("role", role); return PathResolver.getPath(request, BackPage.FIND_OTHER_FUNCTION_LIST); } @RequestMapping({"/listFunction" }) public String listFunction(HttpServletRequest request, HttpServletResponse response, String curPageNO, String roleId, FunctionForm functionForm) { String userName = UserManager.getUsername(request); if (userName == null) { throw new BusinessException("not login yet", "998"); } this.functionChecker.check(userName, request); String myaction = "listFunction" + AttributeKeys.WEB_SUFFIX; String search = request.getParameter("search"); if (search == null) search = ""; else { myaction = myaction + "?search=" + search; } CriteriaQuery cq = new CriteriaQuery(Function.class, curPageNO, myaction); cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); if (!AppUtils.isBlank(search)) { cq.like("name", "%" + search + "%"); cq.add(); } State state = new StateImpl(); PageSupport ps = this.rightDelegate.findAllFunction(cq, state); request.setAttribute("search", search); request.setAttribute("curPageNO", new Integer(ps.getCurPageNO())); request.setAttribute("offset", new Integer(ps.getOffset() + 1)); request.setAttribute("list", ps.getResultList()); if (ps.hasMutilPage()) { request.setAttribute("toolBar", ps.getToolBar()); } return PathResolver.getPath(request, BackPage.FUNCTION_LIST); } @RequestMapping({"/saveFunction" }) public String saveFunction(HttpServletRequest request, HttpServletResponse response, FunctionForm functionForm) { State state = new StateImpl(); String id = this.rightDelegate.saveFunction(functionForm.getFunction(), state); this.logger.info("success saveFunction,id = " + id); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.FUNCTION_LIST_QUERY); } @RequestMapping({"/saveFunctionsToRoleList" }) public String saveFunctionsToRoleList(HttpServletRequest request, HttpServletResponse response, String roleId, PermissionForm permissionForm) { List permissions = new ArrayList(); String[] strArray = permissionForm.getStrArray(); for (int i = 0; i < strArray.length; i++) { Permission permission = new Permission(); PerssionId perssionId = new PerssionId(); perssionId.setRoleId(roleId); perssionId.setFunctionId(strArray[i]); permission.setId(perssionId); permissions.add(permission); } State state = new StateImpl(); this.rightDelegate.saveFunctionsToRole(permissions, state); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.FIND_FUNCTION_BY_ROLE); } @RequestMapping({"/updateFunctionById" }) public String updateFunctionById(HttpServletRequest request, HttpServletResponse response, FunctionForm functionForm) { this.logger.debug("Struts FunctionAction updateFunctionById"); State state = new StateImpl(); this.rightDelegate.updateFunction(functionForm.getFunction(), state); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.FUNCTION_LIST_QUERY); } @RequestMapping({"/deletePermissionByRoleId" }) public String deletePermissionByRoleId(HttpServletRequest request, HttpServletResponse response, String curPageNO, String roleId, FunctionForm functionForm) { this.log.info("Action deletePermissionByRoleId with roleId {}", roleId); List permissions = new ArrayList(); String[] strArray = functionForm.getStrArray(); for (int i = 0; i < strArray.length; i++) { Permission permission = new Permission(); PerssionId perssionId = new PerssionId(); perssionId.setRoleId(roleId); perssionId.setFunctionId(strArray[i]); permission.setId(perssionId); permissions.add(permission); } State state = new StateImpl(); this.rightDelegate.deleteFunctionsFromRole(permissions, state); this.stateChecker.check(state, request); request.setAttribute("roleId", roleId); return PathResolver.getPath(request, FowardPage.FIND_FUNCTION_BY_ROLE); } @RequestMapping({"/findRoleById" }) public String findRoleById(HttpServletRequest request, HttpServletResponse response, String id) { this.logger.info("Action findRoleById with id " + id); State state = new StateImpl(); Role role = this.rightDelegate.findRoleById(id, state); this.stateChecker.check(state, request); request.setAttribute("role", role); return PathResolver.getPath(request, FowardPage.FIND_ALL_ROLE); } @RequestMapping({"/deleteRoleById" }) public String deleteRoleById(HttpServletRequest request, HttpServletResponse response, String id) { this.logger.info("Struts Action deleteRoleById with id " + id); State state = new StateImpl(); this.rightDelegate.deleteRoleById(id, state); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.FIND_ALL_ROLE); } @RequestMapping({"/findAllRole" }) public String findAllRole(HttpServletRequest request, HttpServletResponse response) { String userName = UserManager.getUsername(request); if (userName == null) { throw new BusinessException("not login yet", "998"); } this.functionChecker.check(userName, request); String curPageNO = request.getParameter("curPageNO"); String search = request.getParameter("search"); String action = "findAllRole" + AttributeKeys.WEB_SUFFIX; String myaction; if (search == null) { search = ""; myaction = action; } else { myaction = action + "?search=" + search; } CriteriaQuery cq = new CriteriaQuery(Role.class, curPageNO, myaction); cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); if (!AppUtils.isBlank(search)) { cq.like("name", "%" + search + "%"); cq.add(); } State state = new StateImpl(); PageSupport ps = this.rightDelegate.findAllRole(cq, state); request.setAttribute("search", search); request.setAttribute("curPageNO", new Integer(ps.getCurPageNO())); request.setAttribute("offset", new Integer(ps.getOffset() + 1)); request.setAttribute("list", ps.getResultList()); if (ps.hasMutilPage()) { request.setAttribute("toolBar", ps.getToolBar()); } return PathResolver.getPath(request, BackPage.ROLE_LIST); } @RequestMapping({"/findRoleByFunction" }) public String findRoleByFunction(HttpServletRequest request, HttpServletResponse response, String functionId) { this.logger.info("Struts Action findRoleByFunction with function id " + functionId); State state = new StateImpl(); Function function = this.rightDelegate.findFunctionById(functionId, state); List list = this.rightDelegate.findRoleByFunction(functionId, state); this.stateChecker.check(state, request); request.setAttribute("list", list); request.setAttribute("function", function); return PathResolver.getPath(request, BackPage.FIND_ROLE_BY_FUNCTION); } @RequestMapping({"/saveRole" }) public String saveRole(HttpServletRequest request, HttpServletResponse response, RoleForm roleForm) { State state = new StateImpl(); String id = this.rightDelegate.saveRole(roleForm.getRole(), state); this.logger.info("success saveRole,id = " + id); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.FIND_ALL_ROLE); } @RequestMapping({"/updateRoleById" }) public String updateRoleById(HttpServletRequest request, HttpServletResponse response, RoleForm roleForm) { this.logger.info("Struts Action updateRoleById"); State state = new StateImpl(); this.rightDelegate.updateRole(roleForm.getRole(), state); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.FIND_ALL_ROLE); } @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) { this.logger.info("Struts Action deleteFunctionById with id " + id); State state = new StateImpl(); boolean result = this.rightDelegate.deleteFunctionById(id, state); this.logger.debug("deleteFunctionById result = " + result); if (!result) { this.stateChecker.check(state, request); } return PathResolver.getPath(request, FowardPage.FUNCTION_LIST_QUERY); } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse arg1) { return PathResolver.getPath(request, BackPage.UPDATE_FUNCTION); } @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, Function function) { String userName = UserManager.getUsername(request); if (userName == null) { throw new BusinessException("not login yet", "998"); } this.functionChecker.check(userName, request); CriteriaQuery cq = new CriteriaQuery(Function.class, curPageNO); cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); String name = function.getName(); if (!AppUtils.isBlank(name)) { cq.like("name", "%" + name + "%"); cq.add(); } State state = new StateImpl(); PageSupport ps = this.rightDelegate.findAllFunction(cq, state); request.setAttribute("bean", function); savePage(ps, request); return PathResolver.getPath(request, BackPage.FUNCTION_LIST); } @RequestMapping({"/save" }) public String save(HttpServletRequest request, HttpServletResponse response, Function function) { State state = new StateImpl(); String id = function.getId(); if (StringUtil.isEmpty(id)) id = this.rightDelegate.saveFunction(function, state); else { this.rightDelegate.updateFunction(function, state); } this.logger.info("success saveFunction,id = " + id); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.FUNCTION_LIST_QUERY); } @RequestMapping({"/update/{id}" }) public String update(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) { this.logger.info("Struts Action findFunctionById with id " + id); State state = new StateImpl(); Function function = this.rightDelegate.findFunctionById(id, state); this.stateChecker.check(state, request); request.setAttribute("bean", function); return PathResolver.getPath(request, BackPage.UPDATE_FUNCTION); } @RequestMapping({"/roles/{id}" }) public String roles(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) { this.logger.info("Struts Action findRoleByFunction with function id " + id); State state = new StateImpl(); Function function = this.rightDelegate.findFunctionById(id, state); List list = this.rightDelegate.findRoleByFunction(id, state); this.stateChecker.check(state, request); request.setAttribute("list", list); request.setAttribute("bean", function); return PathResolver.getPath(request, BackPage.FIND_ROLE_BY_FUNCTION); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/controller/FunctionController.java
Java
oos
18,606
package com.legendshop.business.permission.controller; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.common.page.FowardPage; import com.legendshop.business.common.page.FrontPage; import com.legendshop.business.helper.FunctionChecker; import com.legendshop.business.helper.StateChecker; import com.legendshop.business.permission.form.UserRoleForm; import com.legendshop.business.permission.form.UsersForm; import com.legendshop.business.permission.service.RightDelegate; import com.legendshop.command.framework.State; import com.legendshop.command.framework.StateImpl; import com.legendshop.core.AttributeKeys; import com.legendshop.core.UserManager; import com.legendshop.core.base.AdminController; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.constant.PathResolver; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.exception.BusinessException; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.model.entity.User; import com.legendshop.model.entity.UserRole; import com.legendshop.model.entity.UserRoleId; import com.legendshop.util.AppUtils; import com.legendshop.util.StringUtil; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.encoding.Md5PasswordEncoder; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping({"/member/user" }) public class UserController extends BaseController implements AdminController<User, String> { private final Logger log = LoggerFactory.getLogger(UserController.class); @Autowired private RightDelegate rightDelegate; @Autowired private FunctionChecker functionChecker; @Autowired private StateChecker stateChecker; @RequestMapping({"/deleteUserRoleByUserId" }) public String deleteUserRoleByUserId(HttpServletRequest request, HttpServletResponse response, UserRoleForm userRoleForm) { String userId = request.getParameter("userId"); this.logger .info("Action deleteUserRoleByUserId with userId " + userId); List userRoles = new ArrayList(); String[] strArray = userRoleForm.getStrArray(); for (String element : strArray) { UserRole userRole = new UserRole(); UserRoleId userRoleId = new UserRoleId(); userRoleId.setUserId(userId); userRoleId.setRoleId(element); userRole.setId(userRoleId); userRoles.add(userRole); } State state = new StateImpl(); this.rightDelegate.deleteRoleFromUser(userRoles, state); this.stateChecker.check(state, request); request.setAttribute("userId", userId); return PathResolver.getPath(request, FowardPage.FIND_ROLE_BY_USER); } @RequestMapping({"/saveUser" }) public String saveUser(HttpServletRequest request, HttpServletResponse response, UsersForm usersForm) { State state = new StateImpl(); User user = usersForm.getUser(); if (this.rightDelegate.isUserExist(user.getName(), state)) { return PathResolver.getPath(request, FrontPage.FAIL); } String id = this.rightDelegate.saveUser(Md5Password(user), state); this.logger.info("success saveUser,id = " + id); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.USERS_LIST); } private User Md5Password(User user) { Md5PasswordEncoder coder = new Md5PasswordEncoder(); coder.setEncodeHashAsBase64(false); if (user.getPassword() != null) { user.setPassword(coder.encodePassword(user.getPassword(), user.getName())); return user; } return user; } @RequestMapping({"/updateUserStatus" }) public String updateUserStatus(HttpServletRequest request, HttpServletResponse response, UsersForm usersForm) { this.logger.debug("Struts UserAction updateUserStatus"); User user = usersForm.getUser(); String enabled = user.getEnabled(); String userId = user.getId(); State state = new StateImpl(); User olduser = this.rightDelegate.findUserById(userId, state); olduser.setEnabled(enabled); olduser.setNote(user.getNote()); this.rightDelegate.updateUser(olduser, state); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.USERS_LIST); } @RequestMapping({"/preupdateStatus" }) public String preupdateStatus(HttpServletRequest request, HttpServletResponse response) { String id = request.getParameter("id"); this.logger.info("Action preupdateStatus with id " + id); State state = new StateImpl(); User user = this.rightDelegate.findUserById(id, state); this.stateChecker.check(state, request); request.setAttribute("user", user); return PathResolver.getPath(request, BackPage.UPDATE_USER_STATUS); } @RequestMapping({"/updateUserPassowrd" }) public String updateUserPassowrd(HttpServletRequest request, HttpServletResponse response, UsersForm usersForm) { this.logger.info("Struts UserAction updateUserById"); User user = usersForm.getUser(); String passwordag = user.getPasswordag(); if ((user.getPassword() == null) || (user.getPassword() == "")) { return PathResolver.getPath(request, FrontPage.FAIL); } if (!passwordag.endsWith(user.getPassword())) { return PathResolver.getPath(request, FrontPage.FAIL); } State state = new StateImpl(); Md5PasswordEncoder coder = new Md5PasswordEncoder(); coder.setEncodeHashAsBase64(false); this.rightDelegate.updateUserPassowrd(user.getId(), coder.encodePassword(user.getPassword(), user.getName()), state); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.USERS_LIST); } @RequestMapping({"/findUserById" }) public String findUserById(HttpServletRequest request, HttpServletResponse response) { String id = request.getParameter("id"); this.logger.info("Action findUserById with id " + id); State state = new StateImpl(); User user = this.rightDelegate.findUserById(id, state); this.stateChecker.check(state, request); request.setAttribute("user", user); return PathResolver.getPath(request, BackPage.UPDATE_USER_PASSWORD); } @RequestMapping({"/saveRoleToUser" }) public String saveRoleToUser(HttpServletRequest request, HttpServletResponse response, UsersForm usersForm) { String userId = request.getParameter("userId"); List userRoles = new ArrayList(); String[] strArray = usersForm.getStrArray(); for (String element : strArray) { UserRole userRole = new UserRole(); UserRoleId userRoleId = new UserRoleId(); userRoleId.setRoleId(element); userRoleId.setUserId(userId); userRole.setId(userRoleId); userRoles.add(userRole); } State state = new StateImpl(); this.rightDelegate.saveRolesToUser(userRoles, state); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.FIND_USER_ROLES); } @RequestMapping({"/findOtherRoleByUser" }) public String findOtherRoleByUser(HttpServletRequest request, HttpServletResponse response) { String curPageNO = request.getParameter("curPageNO"); String userId = request.getParameter("userId"); String myAction = "findOtherRoleByUser" + AttributeKeys.WEB_SUFFIX; if (userId != null) { myAction = myAction + "?userId=" + userId; } HqlQuery hq = new HqlQuery(myAction); hq.setCurPage(curPageNO); hq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); State state = new StateImpl(); User user = this.rightDelegate.findUserById(userId, state); PageSupport ps = this.rightDelegate.findOtherRoleByUser(hq, userId, state); this.stateChecker.check(state, request); request.setAttribute("curPageNO", new Integer(ps.getCurPageNO())); request.setAttribute("offset", new Integer(ps.getOffset() + 1)); if (ps.hasMutilPage()) { request.setAttribute("toolBar", ps.getToolBar()); } request.setAttribute("roles", ps.getResultList()); request.setAttribute("user", user); return PathResolver.getPath(request, BackPage.FIND_OTHER_ROLE_BY_USER); } @RequestMapping({"/findFunctionByUser" }) public String findFunctionByUser(HttpServletRequest request, HttpServletResponse response) { String userId = request.getParameter("userId"); this.logger.info("UserAction findFunctionByUser : " + userId); State state = new StateImpl(); User user = this.rightDelegate.findUserById(userId, state); List functions = this.rightDelegate.findFunctionByUser(userId, state); this.stateChecker.check(state, request); request.setAttribute("functions", functions); request.setAttribute("user", user); return PathResolver.getPath(request, BackPage.FIND_FUNCTION_BY_USER); } @RequestMapping({"/usersList" }) public String usersList(HttpServletRequest request, HttpServletResponse response, String curPageNO) { String userName = UserManager.getUsername(request); if (userName == null) { throw new BusinessException("not login yet", "998"); } this.functionChecker.check(userName, request); String search = request.getParameter("search") == null ? "" : request.getParameter("search"); String enabled = request.getParameter("enabled") == null ? "" : request.getParameter("enabled"); CriteriaQuery cq = new CriteriaQuery(User.class, curPageNO); cq.setPageSize(1); if (AppUtils.isNotBlank(search)) { cq.like("name", search + "%"); } if (AppUtils.isNotBlank(enabled)) { cq.eq("enabled", enabled); } cq.add(); State state = new StateImpl(); PageSupport ps = this.rightDelegate.findAllUser(cq, state); request.setAttribute("search", search); request.setAttribute("enabled", enabled); savePage(ps, request); return PathResolver.getPath(request, BackPage.USER_LIST_PAGE); } @RequestMapping({"/findRoleByUser" }) public String findRoleByUser(HttpServletRequest request, HttpServletResponse response) { String userId = request.getParameter("userId"); this.logger.info("UserAction findOtherRoleByUser : " + userId); State state = new StateImpl(); User user = this.rightDelegate.findUserById(userId, state); List roles = this.rightDelegate.findRoleByUser(userId, state); this.stateChecker.check(state, request); request.setAttribute("roles", roles); request.setAttribute("user", user); return PathResolver.getPath(request, BackPage.FIND_ROLE_BY_USER_PAGE); } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse response) { return PathResolver.getPath(request, BackPage.MODIFY_USER); } @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) { return null; } @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, User user) { String userName = UserManager.getUsername(request); if (userName == null) { throw new BusinessException("not login yet", "704"); } this.functionChecker.check(userName, request); String name = user.getName(); String enabled = user.getEnabled(); CriteriaQuery cq = new CriteriaQuery(User.class, curPageNO); cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); if (AppUtils.isNotBlank(name)) { cq.like("name", name + "%"); } if (AppUtils.isNotBlank(enabled)) { cq.eq("enabled", enabled); } cq.add(); State state = new StateImpl(); PageSupport ps = this.rightDelegate.findAllUser(cq, state); request.setAttribute("bean", user); savePage(ps, request); return PathResolver.getPath(request, BackPage.USER_LIST_PAGE); } @RequestMapping({"/save" }) public String save(HttpServletRequest request, HttpServletResponse response, User user) { State state = new StateImpl(); if (this.rightDelegate.isUserExist(user.getName(), state)) { return PathResolver.getPath(request, FrontPage.FAIL); } String id = user.getId(); if (StringUtil.isEmpty(id)) id = this.rightDelegate.saveUser(Md5Password(user), state); else { this.rightDelegate.updateUser(Md5Password(user), state); } this.logger.info("success saveUser,id = " + id); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.USERS_LIST); } @RequestMapping({"/updatePassword" }) public String updatePassword(HttpServletRequest request, HttpServletResponse response, User user) { this.logger.info("Struts UserAction updateUserById"); String passwordag = user.getPasswordag(); if ((user.getPassword() == null) || (user.getPassword() == "")) { return PathResolver.getPath(request, FrontPage.ERROR_PAGE); } if (!passwordag.endsWith(user.getPassword())) { return PathResolver.getPath(request, FrontPage.FAIL); } State state = new StateImpl(); Md5PasswordEncoder coder = new Md5PasswordEncoder(); coder.setEncodeHashAsBase64(false); this.rightDelegate.updateUserPassowrd(user.getId(), coder.encodePassword(user.getPassword(), user.getName()), state); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.USERS_LIST); } @RequestMapping({"/update/{id}" }) public String update(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) { this.logger.info("Action findUserById with id " + id); State state = new StateImpl(); User user = this.rightDelegate.findUserById(id, state); this.stateChecker.check(state, request); request.setAttribute("bean", user); return PathResolver.getPath(request, BackPage.UPDATE_USER_PASSWORD); } @RequestMapping({"/roles/{id}" }) public String roles(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) { this.logger.info("UserAction findOtherRoleByUser : " + id); State state = new StateImpl(); User user = this.rightDelegate.findUserById(id, state); List roles = this.rightDelegate.findRoleByUser(id, state); this.stateChecker.check(state, request); request.setAttribute("list", roles); request.setAttribute("bean", user); return PathResolver.getPath(request, BackPage.FIND_ROLE_BY_USER_PAGE); } @RequestMapping({"/otherRoles/{id}" }) public String otherRoles(HttpServletRequest request, HttpServletResponse response, String curPageNO, @PathVariable String id) { HqlQuery hq = new HqlQuery(); hq.setCurPage(curPageNO); hq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); State state = new StateImpl(); User user = this.rightDelegate.findUserById(id, state); PageSupport ps = this.rightDelegate.findOtherRoleByUser(hq, id, state); this.stateChecker.check(state, request); savePage(ps, request); request.setAttribute("bean", user); return PathResolver.getPath(request, BackPage.FIND_OTHER_ROLE_BY_USER); } @RequestMapping({"/deleteRoles/{id}" }) public String deleteRoles(HttpServletRequest request, HttpServletResponse response, String[] strArray, @PathVariable String id) { this.logger.info("Action deleteUserRoleByUserId with userId " + id); List userRoles = new ArrayList(); for (String element : strArray) { UserRole userRole = new UserRole(); UserRoleId userRoleId = new UserRoleId(); userRoleId.setUserId(id); userRoleId.setRoleId(element); userRole.setId(userRoleId); userRoles.add(userRole); } State state = new StateImpl(); this.rightDelegate.deleteRoleFromUser(userRoles, state); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.FIND_ROLE_BY_USER); } @RequestMapping({"/functions/{id}" }) public String functions(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) { this.logger.info("UserAction findFunctionByUser : " + id); State state = new StateImpl(); User user = this.rightDelegate.findUserById(id, state); List functions = this.rightDelegate.findFunctionByUser(id, state); this.stateChecker.check(state, request); request.setAttribute("list", functions); request.setAttribute("bean", user); return PathResolver.getPath(request, BackPage.FIND_FUNCTION_BY_USER); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/controller/UserController.java
Java
oos
19,381
package com.legendshop.business.permission.controller; import com.legendshop.business.common.page.BackPage; import com.legendshop.business.common.page.FowardPage; import com.legendshop.business.helper.FunctionChecker; import com.legendshop.business.helper.StateChecker; import com.legendshop.business.permission.form.FunctionForm; import com.legendshop.business.permission.form.PermissionForm; import com.legendshop.business.permission.service.RightDelegate; import com.legendshop.command.framework.State; import com.legendshop.command.framework.StateImpl; import com.legendshop.core.UserManager; import com.legendshop.core.base.AdminController; import com.legendshop.core.base.BaseController; import com.legendshop.core.constant.ParameterEnum; import com.legendshop.core.constant.PathResolver; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.exception.BusinessException; import com.legendshop.core.helper.PropertiesUtil; import com.legendshop.model.entity.Permission; import com.legendshop.model.entity.PerssionId; import com.legendshop.model.entity.Role; import com.legendshop.util.AppUtils; import com.legendshop.util.StringUtil; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @Controller @RequestMapping({"/member/role" }) public class RoleController extends BaseController implements AdminController<Role, String> { private final Logger log = LoggerFactory.getLogger(RoleController.class); @Autowired private RightDelegate rightDelegate; @Autowired private FunctionChecker functionChecker; @Autowired private StateChecker stateChecker; @RequestMapping({"/delete/{id}" }) public String delete(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) { this.logger.info("Struts Action deleteRoleById with id " + id); State state = new StateImpl(); this.rightDelegate.deleteRoleById(id, state); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.ALL_ROLE); } @RequestMapping({"/load" }) public String load(HttpServletRequest request, HttpServletResponse response) { return PathResolver.getPath(request, BackPage.SAVE_ROLE); } @RequestMapping({"/query" }) public String query(HttpServletRequest request, HttpServletResponse response, String curPageNO, Role role) { String userName = UserManager.getUsername(request); if (userName == null) { throw new BusinessException("not login yet", "998"); } this.functionChecker.check(userName, request); CriteriaQuery cq = new CriteriaQuery(Role.class, curPageNO); cq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); String name = role.getName(); String enabled = role.getEnabled(); if (!AppUtils.isBlank(name)) { cq.like("name", "%" + name + "%"); } if (AppUtils.isNotBlank(enabled)) { cq.eq("enabled", enabled); } cq.add(); State state = new StateImpl(); PageSupport ps = this.rightDelegate.findAllRole(cq, state); request.setAttribute("bean", role); savePage(ps, request); return PathResolver.getPath(request, BackPage.ROLE_LIST); } @RequestMapping({"/save" }) public String save(HttpServletRequest request, HttpServletResponse response, Role role) { State state = new StateImpl(); String id = role.getId(); if (StringUtil.isEmpty(id)) id = this.rightDelegate.saveRole(role, state); else { this.rightDelegate.updateRole(role, state); } this.logger.info("success saveRole,id = " + id); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.ALL_ROLE); } @RequestMapping({"/update/{id}" }) public String update(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) { this.logger.info("Action update with id " + id); State state = new StateImpl(); Role role = this.rightDelegate.findRoleById(id, state); this.stateChecker.check(state, request); request.setAttribute("bean", role); return PathResolver.getPath(request, BackPage.SAVE_ROLE); } @RequestMapping({"/functions/{id}" }) public String functions(HttpServletRequest request, HttpServletResponse response, @PathVariable String id) { this.logger .info("Struts FunctionAction findFunctionByRole with roleId " + id); State state = new StateImpl(); Role role = this.rightDelegate.findRoleById(id, state); List list = this.rightDelegate.findFunctionByRoleId(id, state); this.stateChecker.check(state, request); request.setAttribute("list", list); request.setAttribute("bean", role); return PathResolver.getPath(request, BackPage.ROLE_FUNCTION); } @RequestMapping({"/otherFunctions/{id}" }) public String otherFunctions(HttpServletRequest request, HttpServletResponse response, String curPageNO, @PathVariable String id) { HqlQuery hq = new HqlQuery(); hq.setCurPage(curPageNO); hq.setPageSize(((Integer) PropertiesUtil.getObject( ParameterEnum.PAGE_SIZE, Integer.class)).intValue()); State state = new StateImpl(); Role role = this.rightDelegate.findRoleById(id, state); PageSupport ps = this.rightDelegate.findOtherFunctionByHql(hq, id, state); this.stateChecker.check(state, request); savePage(ps, request); request.setAttribute("bean", role); return PathResolver.getPath(request, BackPage.FIND_OTHER_FUNCTION_LIST); } @RequestMapping({"/saveFunctionsToRole" }) public String saveFunctionsToRole(HttpServletRequest request, HttpServletResponse response, String roleId, PermissionForm permissionForm) { List permissions = new ArrayList(); String[] strArray = permissionForm.getStrArray(); for (int i = 0; i < strArray.length; i++) { Permission permission = new Permission(); PerssionId perssionId = new PerssionId(); perssionId.setRoleId(roleId); perssionId.setFunctionId(strArray[i]); permission.setId(perssionId); permissions.add(permission); } State state = new StateImpl(); this.rightDelegate.saveFunctionsToRole(permissions, state); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.FIND_FUNCTION_BY_ROLE); } @RequestMapping({"/deletePermissionByRoleId" }) public String deletePermissionByRoleId(HttpServletRequest request, HttpServletResponse response, String roleId, FunctionForm functionForm) { this.log.info("Action deletePermissionByRoleId with roleId {}", roleId); List permissions = new ArrayList(); String[] strArray = functionForm.getStrArray(); for (int i = 0; i < strArray.length; i++) { Permission permission = new Permission(); PerssionId perssionId = new PerssionId(); perssionId.setRoleId(roleId); perssionId.setFunctionId(strArray[i]); permission.setId(perssionId); permissions.add(permission); } State state = new StateImpl(); this.rightDelegate.deleteFunctionsFromRole(permissions, state); this.stateChecker.check(state, request); return PathResolver.getPath(request, FowardPage.FIND_FUNCTION_BY_ROLE); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/controller/RoleController.java
Java
oos
8,698
package com.legendshop.business.permission.form; public abstract class BaseValidatorForm { private String myaction = ""; private int curPageNO = 1; private String[] strArray = new String[0]; public int getCurPageNO() { return this.curPageNO; } public void setCurPageNO(int curPageNO) { this.curPageNO = curPageNO; } public String[] getStrArray() { return this.strArray; } public void setStrArray(String[] strArray) { this.strArray = strArray; } public String getMyaction() { return this.myaction; } public void setMyaction(String myaction) { this.myaction = myaction; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/form/BaseValidatorForm.java
Java
oos
763
package com.legendshop.business.permission.form; import com.legendshop.model.entity.User; public class UsersForm extends BaseValidatorForm { private static final long serialVersionUID = -840523994012455010L; public User user = new User(); public User getUser() { return this.user; } public void setUser(User user) { this.user = user; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/form/UsersForm.java
Java
oos
432
package com.legendshop.business.permission.form; public class UserRoleForm extends BaseValidatorForm { private static final long serialVersionUID = -4714759651188550306L; private String roleId; private String userId; public String getRoleId() { return this.roleId; } public void setRoleId(String roleId) { this.roleId = roleId; } public String getUserId() { return this.userId; } public void setUserId(String userId) { this.userId = userId; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/form/UserRoleForm.java
Java
oos
587
package com.legendshop.business.permission.form; import com.legendshop.model.entity.Role; public class RoleForm extends BaseValidatorForm { private static final long serialVersionUID = -7431172360957927548L; public Role role = new Role(); public Role getRole() { return this.role; } public void setRole(Role role) { this.role = role; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/form/RoleForm.java
Java
oos
432
package com.legendshop.business.permission.form; public class PermissionForm extends BaseValidatorForm { private static final long serialVersionUID = -6137922551383167345L; private String roleId; private String functionId; public String getFunctionId() { return this.functionId; } public void setFunctionId(String functionId) { this.functionId = functionId; } public String getRoleId() { return this.roleId; } public void setRoleId(String roleId) { this.roleId = roleId; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/form/PermissionForm.java
Java
oos
617
package com.legendshop.business.permission.form; import com.legendshop.model.entity.Function; public class FunctionForm extends BaseValidatorForm { private static final long serialVersionUID = 7048928553222685963L; public Function function = new Function(); public Function getFunction() { return this.function; } public void setFunction(Function function) { this.function = function; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/form/FunctionForm.java
Java
oos
475
package com.legendshop.business.permission.service.impl; import java.io.File; import java.util.ArrayList; import java.util.List; import com.legendshop.business.permission.service.RightDelegate; import com.legendshop.command.framework.JCFException; import com.legendshop.command.framework.Request; import com.legendshop.command.framework.Response; import com.legendshop.command.framework.State; import com.legendshop.command.framework.facade.AbstractBizDelegate; import com.legendshop.command.framework.facade.DelegateUtil; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.exception.ClientException; import com.legendshop.model.entity.Function; import com.legendshop.model.entity.LoginHistory; import com.legendshop.model.entity.Permission; import com.legendshop.model.entity.Role; import com.legendshop.model.entity.User; import com.legendshop.model.entity.UserRole; import com.legendshop.util.AppUtils; public class RightDelegateImpl extends AbstractBizDelegate implements RightDelegate { public boolean findWorkflow(State state) { Request req = new Request(); req.setServiceName("RunByResultProcessor"); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); return true; } catch (Exception e) { DelegateUtil.handleException(e, "workflow", state); } return false; } public Role findgrantedAuthorityFromDataBase(String authority, State state) { try { return (Role) getDelegate().execute("authority", authority, "FindgrantedAuthorityFromDataBaseProcessor", "resultObject", state); } catch (Exception e) { DelegateUtil.handleException(e, "findgrantedAuthorityFromDataBase", state); } return null; } public Function findFunctionFromDataBase(String protectfunction, State state) { try { return (Function) getDelegate().execute("protectfunction", protectfunction, "FindFunctionFromDataBaseProcessor", "resultObject", state); } catch (Exception e) { DelegateUtil.handleException(e, "findFunctionFromDataBase", state); } return null; } public List findRoleByFunction(String functionId, State state) { try { return (List) getDelegate().execute("functionId", functionId, "FindRoleByFunctionProcessor", "roles", state); } catch (Exception e) { throw new ClientException(e, "findRoleByFunction error"); } } public List findRoleByUser(String userId, State state) { try { return (List) getDelegate().execute("userId", userId, "FindRoleByUserProcessor", "roles", state); } catch (Exception e) { DelegateUtil.handleException(e, "findRoleByUser", state); } return null; } public User findUserByNameFromDataBase(String name, State state) { try { return (User) getDelegate().execute("name", name, "FindUserByNameFromDataBaseProcessor", "resultObject", state); } catch (Exception e) { DelegateUtil .handleException(e, "findUserByNameFromDataBase", state); } return null; } public String saveFunction(Function function, State state) { try { return (String) getDelegate().execute("function", function, "SaveFunctionProcessor", "id", state); } catch (Exception e) { DelegateUtil.handleException(e, "saveFunction", state); } return null; } public boolean saveFunctionToRole(Permission permission, State state) { try { getDelegate().execute("permission", permission, "SaveFunctionToRoleProcessor", "id", state); return true; } catch (Exception e) { DelegateUtil.handleException(e, "saveFunctionToRole", state); } return false; } public void saveFunctionsToRole(List permissions, State state) { if (DelegateUtil.isNullParam(permissions, "permissions", state)) { return; } Request req = new Request(); req.setServiceName("SaveFunctionsToRoleProcessor"); req.setValue("permissions", permissions); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); } catch (Exception e) { DelegateUtil.handleException(e, "saveFunctionsToRole", state); } } public void updateFunction(Function function, State state) { if (DelegateUtil.isNullParam(function, "function", state)) { return; } Request req = new Request(); req.setServiceName("UpdateFunctionProcessor"); req.setValue("function", function); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); } catch (Exception e) { DelegateUtil.handleException(e, "updateFunction", state); } } public boolean isUserExist(String name, State state) { if (DelegateUtil.isNullParam(name, "name", state)) { return false; } Request req = new Request(); req.setServiceName("IsUserExistProcessor"); req.setValue("name", name); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); return ((Boolean) resp.getValue("resultBoolean")).booleanValue(); } catch (Exception e) { DelegateUtil.handleException(e, "isUserExist", state); } return false; } public String saveUser(User user, State state) { try { return (String) getDelegate().execute("user", user, "SaveUserProcessor", "result", state); } catch (Exception e) { DelegateUtil.handleException(e, "saveUser", state); } return null; } public PageSupport findAllUser(CriteriaQuery cq, State state) { if (DelegateUtil.isNullParam(cq, "CriteriaQuery", state)) { return null; } Request req = new Request(); req.setServiceName("FindAllUserProcessor"); req.setValue("CriteriaQuery", cq); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); return (PageSupport) (PageSupport) resp.getValue("PageSupport"); } catch (Exception e) { DelegateUtil.handleException(e, "findAllUser", state); } return null; } public boolean deleteFunctionById(String functionId, State state) { if (DelegateUtil.isNullParam(functionId, "functionId", state)) { return false; } Request req = new Request(); req.setServiceName("DeleteFunctionByIdProcessor"); req.setValue("functionId", functionId); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); return ((Boolean) resp.getValue("resultBoolean")).booleanValue(); } catch (Exception e) { DelegateUtil.handleException(e, "deleteFunctionById", state); } return false; } public void deleteFunction(Function function, State state) { if (DelegateUtil.isNullParam(function, "function", state)) { return; } Request req = new Request(); req.setServiceName("DeleteFunctionProcessor"); req.setValue("function", function); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); } catch (Exception e) { DelegateUtil.handleException(e, "deleteFunction", state); } } public PageSupport findAllFunction(CriteriaQuery cq, State state) { if (DelegateUtil.isNullParam(cq, "CriteriaQuery", state)) { return null; } Request req = new Request(); req.setServiceName("FindAllFunctionProcessor"); req.setValue("CriteriaQuery", cq); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); return (PageSupport) (PageSupport) resp.getValue("PageSupport"); } catch (Exception e) { DelegateUtil.handleException(e, "findAllFunction", state); } return null; } public Function findFunctionById(String id, State state) { if (DelegateUtil.isNullParam(id, "id", state)) { return null; } Request req = new Request(); req.setServiceName("FindFunctionByIdProcessor"); req.setValue("id", id); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); Function function = (Function) resp.getValue("function"); DelegateUtil.setState(state, resp); return function; } catch (Exception e) { DelegateUtil.handleException(e, "findFunctionById", state); } return null; } public List findFunctionByUser(String userId, State state) { try { return (List) getDelegate().execute("userId", userId, "FindFunctionByUserProcessor", "functions", state); } catch (Exception e) { DelegateUtil.handleException(e, "findFunctionByUser", state); } return null; } public PageSupport findOtherRoleByUser(HqlQuery hqlQuery, String userId, State state) { if ((DelegateUtil.isNullParam(hqlQuery, "hqlQuery", state)) || (DelegateUtil.isNullParam(userId, "userId", state))) { return null; } Request req = new Request(); req.setServiceName("FindOtherRoleByUserProcessor"); req.setValue("hqlQuery", hqlQuery); req.setValue("userId", userId); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); return (PageSupport) resp.getValue("roles"); } catch (Exception e) { DelegateUtil.handleException(e, "findOtherRoleByUser", state); } return null; } public String saveRole(Role role, State state) { if (DelegateUtil.isNullParam(role, "role", state)) { return null; } Request req = new Request(); req.setServiceName("SaveRoleProcessor"); req.setValue("role", role); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); return (String) resp.getValue("result"); } catch (Exception e) { DelegateUtil.handleException(e, "saveRole", state); } return null; } public void deleteRoleById(String roleId, State state) { if (DelegateUtil.isNullParam(roleId, "roleId", state)) { return; } Request req = new Request(); req.setServiceName("DeleteRoleByIdProcessor"); req.setValue("roleId", roleId); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); } catch (Exception e) { DelegateUtil.handleException(e, "deleteRoleById", state); } } public void deleteRole(Role role, State state) { if (DelegateUtil.isNullParam(role, "role", state)) { return; } Request req = new Request(); req.setServiceName("DeleteRoleProcessor"); req.setValue("role", role); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); } catch (Exception e) { DelegateUtil.handleException(e, "deleteRole", state); } } public void updateRole(Role role, State state) { if (DelegateUtil.isNullParam(role, "role", state)) { return; } Request req = new Request(); req.setServiceName("UpdateRoleProcessor"); req.setValue("role", role); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); } catch (Exception e) { DelegateUtil.handleException(e, "updateRole", state); } } public void updateUser(User user, State state) { try { getDelegate().execute("user", user, "UpdateUserProcessor", state); } catch (Exception e) { DelegateUtil.handleException(e, "updateUser", state); } } public PageSupport findAllRole(CriteriaQuery cq, State state) { if (DelegateUtil.isNullParam(cq, "CriteriaQuery", state)) { return null; } Request req = new Request(); req.setServiceName("FindAllRoleProcessor"); req.setValue("CriteriaQuery", cq); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); return (PageSupport) (PageSupport) resp.getValue("PageSupport"); } catch (Exception e) { DelegateUtil.handleException(e, "findAllRole", state); } return null; } public Role findRoleById(String id, State state) { if (DelegateUtil.isNullParam(id, "id", state)) { return null; } Request req = new Request(); req.setServiceName("FindRoleByIdProcessor"); req.setValue("id", id); try { Response resp = getDelegate().execute(req); Role role = (Role) resp.getValue("role"); DelegateUtil.setState(state, resp); return role; } catch (Exception e) { DelegateUtil.handleException(e, "findRoleById", state); } return null; } public List findFunctionByRoleId(String roleId, State state) { if (DelegateUtil.isNullParam(roleId, "roleId", state)) { return null; } Request req = new Request(); req.setServiceName("FindFunctionByRoleIdProcessor"); req.setValue("roleId", roleId); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); return (List) resp.getValue("functions"); } catch (Exception e) { DelegateUtil.handleException(e, "findFunctionByRoleId", state); } return null; } public List findOtherFunctionByRoleId(String roleId, State state) { if (DelegateUtil.isNullParam(roleId, "roleId", state)) { return null; } Request req = new Request(); req.setServiceName("FindOtherFunctionByRoleIdProcessor"); req.setValue("roleId", roleId); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); return (List) resp.getValue("functions"); } catch (Exception e) { DelegateUtil.handleException(e, "findOtherFunctionByRoleId", state); } return null; } public PageSupport findOtherFunctionByHql(HqlQuery hqlQuery, String roleId, State state) { if (DelegateUtil.isNullParam(hqlQuery, "hqlQuery", state)) { return null; } Request req = new Request(); req.setServiceName("FindOtherFunctionByHqlProcessor"); req.setValue("hqlQuery", hqlQuery); req.setValue("roleId", roleId); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); return (PageSupport) resp.getValue("functions"); } catch (Exception e) { DelegateUtil.handleException(e, "findOtherFunctionByHql", state); } return null; } public void deleteFunctionsFromRole(List<Permission> permissions, State state) { try { getDelegate().execute("permissions", permissions, "DeleteFunctionsFromRoleProcessor", state); } catch (Exception e) { DelegateUtil.handleException(e, "deleteFunctionsFromRole", state); } } public void deleteRoleFromUser(List userRoles, State state) { try { getDelegate().execute("userRoles", userRoles, "DeleteRoleFromUserProcessor", state); } catch (Exception e) { DelegateUtil.handleException(e, "deleteRoleFromUser", state); } } public User findUserById(String userId, State state) { try { return (User) getDelegate().execute("userId", userId, "FindUserByIdProcessor", "user", state); } catch (Exception e) { DelegateUtil.handleException(e, "findUserById", state); } return null; } public void saveRoleToUser(UserRole userRole, State state) { try { if ((!AppUtils.isBlank(userRole)) && (!AppUtils.isBlank(userRole.getId().getUserId())) && (!AppUtils.isBlank(userRole.getId().getRoleId()))) { List userRoles = new ArrayList(); userRoles.add(userRole); saveRolesToUser(userRoles, state); } else { throw new JCFException(state.getErrCode(), "saveRoleToUser userRole is not validated!"); } } catch (Exception e) { DelegateUtil.handleException(e, "saveRoleToUser", state); } } public void updateUserPassowrd(String userId, String password, State state) { if ((DelegateUtil.isNullParam(userId, "userId", state)) || (DelegateUtil.isNullParam(password, "password", state))) { return; } Request req = new Request(); req.setServiceName("UpdateUserPassowrdProcessor"); req.setValue("userId", userId); req.setValue("password", password); try { Response resp = getDelegate().execute(req); DelegateUtil.setState(state, resp); } catch (Exception e) { DelegateUtil.handleException(e, "updateUserPassowrd", state); } } public void deletePermissionByFunctionId(String functionId, State state) { try { getDelegate().execute("functionId", functionId, "DeletePermissionByFunctionIdProcessor", state); } catch (Exception e) { DelegateUtil.handleException(e, "deletePermissionByFunctionId", state); } } public void deleteUserRoleByUserId(String userId, State state) { try { getDelegate().execute("userId", userId, "DeleteUserRoleByUserIdProcessor", state); } catch (Exception e) { DelegateUtil.handleException(e, "deleteUserRoleByUserId", state); } } public void deleteRoleFromUser(UserRole userRole, State state) { if (AppUtils.isBlank(userRole)) throw new ClientException("PARAMETER_ERROR", "deleteRoleFromUser"); List userRoles = new ArrayList(); userRoles.add(userRole); deleteRoleFromUser(userRoles, state); } public void deleteUserRoleByRoleId(String roleId, State state) { try { getDelegate().execute("roleId", roleId, "DeleteUserRoleByRoleIdProcessor", state); } catch (Exception e) { DelegateUtil.handleException(e, "deleteUserRoleByRoleId", state); } } public void deletePermissionByRoleId(String roleId, State state) { try { getDelegate().execute("roleId", roleId, "DeletePermissionByRoleIdProcessor", state); } catch (Exception e) { DelegateUtil.handleException(e, "deletePermissionByRoleId", state); } } public void saveRolesToUser(List userRoles, State state) { try { getDelegate().execute("userRoles", userRoles, "SaveRolesToUserProcessor", state); } catch (Exception e) { DelegateUtil.handleException(e, "saveRolesToUser", state); } } public String saveFile(File file, State state) { try { return (String) getDelegate().execute("file", file, "SaveFileProcessor", "result", state); } catch (Exception e) { DelegateUtil.handleException(e, "saveFile", state); } return null; } public void deleteFileById(String id, State state) { try { getDelegate().execute("id", id, "DeleteFileByIdProcessor", state); } catch (Exception e) { DelegateUtil.handleException(e, "deleteFileById", state); } } public void deleteFile(File file, State state) { try { getDelegate().execute("file", file, "DeleteFileProcessor", state); } catch (Exception e) { DelegateUtil.handleException(e, "deleteUserRoleByUserId", state); } } public void updateFile(File file, State state) { try { getDelegate().execute("file", file, "UpdateFileProcessor", state); } catch (Exception e) { DelegateUtil.handleException(e, "updateFile", state); } } public PageSupport findAllFile(CriteriaQuery cq, State state) { try { return (PageSupport) getDelegate().execute("CriteriaQuery", cq, "FindAllFileProcessor", "PageSupport", state); } catch (Exception e) { DelegateUtil.handleException(e, "findAllFile", state); } return null; } public File findFileById(String id, State state) { try { return (File) getDelegate().execute("id", id, "FindFileByIdProcessor", "file", state); } catch (Exception e) { DelegateUtil.handleException(e, "findFileById", state); } return null; } public String saveLoginHistory(LoginHistory loginHistory, State state) { try { return (String) getDelegate().execute("loginHistory", loginHistory, "SaveLoginHistoryProcessor", "result", state); } catch (Exception e) { DelegateUtil.handleException(e, "saveLoginHistory", state); } return null; } public String testCircle(State state) { try { return (String) getDelegate().execute("testCircleProcessor", "next", state); } catch (Exception e) { DelegateUtil.handleException(e, "testCircle", state); } return null; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/service/impl/RightDelegateImpl.java
Java
oos
23,579
package com.legendshop.business.permission.service; import com.legendshop.command.framework.State; import com.legendshop.command.framework.facade.BizDelegate; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.Function; import com.legendshop.model.entity.LoginHistory; import com.legendshop.model.entity.Permission; import com.legendshop.model.entity.Role; import com.legendshop.model.entity.User; import com.legendshop.model.entity.UserRole; import java.io.File; import java.util.List; public abstract interface RightDelegate extends BizDelegate { public abstract boolean findWorkflow(State paramState); public abstract String testCircle(State paramState); public abstract Role findgrantedAuthorityFromDataBase(String paramString, State paramState); public abstract Function findFunctionFromDataBase(String paramString, State paramState); public abstract List findFunctionByRoleId(String paramString, State paramState); public abstract User findUserByNameFromDataBase(String paramString, State paramState); public abstract List findRoleByFunction(String paramString, State paramState); public abstract String saveUser(User paramUser, State paramState); public abstract boolean isUserExist(String paramString, State paramState); public abstract User findUserById(String paramString, State paramState); public abstract List findOtherFunctionByRoleId(String paramString, State paramState); public abstract PageSupport findOtherFunctionByHql(HqlQuery paramHqlQuery, String paramString, State paramState); public abstract PageSupport findAllUser(CriteriaQuery paramCriteriaQuery, State paramState); public abstract void updateUserPassowrd(String paramString1, String paramString2, State paramState); public abstract String saveFunction(Function paramFunction, State paramState); public abstract boolean deleteFunctionById(String paramString, State paramState); public abstract void deleteFunction(Function paramFunction, State paramState); public abstract Function findFunctionById(String paramString, State paramState); public abstract PageSupport findAllFunction( CriteriaQuery paramCriteriaQuery, State paramState); public abstract void updateFunction(Function paramFunction, State paramState); public abstract boolean saveFunctionToRole(Permission paramPermission, State paramState); public abstract void saveFunctionsToRole(List paramList, State paramState); public abstract void deleteFunctionsFromRole(List<Permission> paramList, State paramState); public abstract void deleteRole(Role paramRole, State paramState); public abstract Role findRoleById(String paramString, State paramState); public abstract String saveRole(Role paramRole, State paramState); public abstract void deleteRoleById(String paramString, State paramState); public abstract PageSupport findAllRole(CriteriaQuery paramCriteriaQuery, State paramState); public abstract void updateRole(Role paramRole, State paramState); public abstract void saveRoleToUser(UserRole paramUserRole, State paramState); public abstract void saveRolesToUser(List paramList, State paramState); public abstract void deleteRoleFromUser(List paramList, State paramState); public abstract void deletePermissionByRoleId(String paramString, State paramState); public abstract void deletePermissionByFunctionId(String paramString, State paramState); public abstract void deleteUserRoleByUserId(String paramString, State paramState); public abstract void deleteUserRoleByRoleId(String paramString, State paramState); public abstract void updateUser(User paramUser, State paramState); public abstract List findRoleByUser(String paramString, State paramState); public abstract List findFunctionByUser(String paramString, State paramState); public abstract void deleteRoleFromUser(UserRole paramUserRole, State paramState); public abstract PageSupport findOtherRoleByUser(HqlQuery paramHqlQuery, String paramString, State paramState); public abstract String saveFile(File paramFile, State paramState); public abstract void deleteFileById(String paramString, State paramState); public abstract void deleteFile(File paramFile, State paramState); public abstract void updateFile(File paramFile, State paramState); public abstract PageSupport findAllFile(CriteriaQuery paramCriteriaQuery, State paramState); public abstract File findFileById(String paramString, State paramState); public abstract String saveLoginHistory(LoginHistory paramLoginHistory, State paramState); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/service/RightDelegate.java
Java
oos
5,289
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.Role; import java.util.Map; public class SaveRole extends AbstractCommand { private RoleDao dao; public void setDao(RoleDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("result", this.dao.save((Role) params.get("role"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/SaveRole.java
Java
oos
730
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.Function; import com.legendshop.util.AppUtils; import java.util.Map; public class UpdateFunction extends AbstractCommand { private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { Function function = (Function) params.get("function"); if (checkFunction(function)) { String msg = "UpdateFunction PARAM_ERR ,function is not validated!"; throw new JCFException("PARAMETER_ERROR", msg); } this.dao.update(function); } private boolean checkFunction(Function fuction) { return (AppUtils.isBlank(fuction)) || (fuction.getId() == null); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/UpdateFunction.java
Java
oos
1,161
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.UserDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import java.util.Map; public class DeleteUserRoleByRoleId extends AbstractCommand { private UserDao dao; public void setDao(UserDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { this.dao.DeleteUserRole(this.dao.findUserRoleByRoleId((String) params .get("roleId"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/DeleteUserRoleByRoleId.java
Java
oos
737
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import java.util.Map; public class FindFunctionByRole extends AbstractCommand { private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("functions", this.dao.FindFunctionByRoleId((String) params.get("roleId"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindFunctionByRole.java
Java
oos
746
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.Role; import java.util.Map; public class DeleteRole extends AbstractCommand { private RoleDao dao; public void setDao(RoleDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { Role role = (Role) params.get("role"); if (checkRole(role)) { String msg = "DeleteRole PARAM_ERR ,role is not validated!"; throw new JCFException("PARAMETER_ERROR", msg); } this.dao.delete(role); } private boolean checkRole(Role role) { return role.getId() == null; } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/DeleteRole.java
Java
oos
1,010
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.exception.JCFException; import java.util.Map; public class FindAllRole extends AbstractCommand { private RoleDao dao; public void setDao(RoleDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("PageSupport", this.dao.find((CriteriaQuery) params.get("CriteriaQuery"), true)); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindAllRole.java
Java
oos
788
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.UserDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.exception.JCFException; import java.util.Map; public class FindAllUser extends AbstractCommand { private UserDao dao; public void setDao(UserDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("PageSupport", this.dao.find((CriteriaQuery) params.get("CriteriaQuery"), true)); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindAllUser.java
Java
oos
788
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.Function; import com.legendshop.model.entity.Role; import com.legendshop.util.AppUtils; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class FindFunctionByUser extends AbstractCommand { private FunctionDao dao; private RoleDao roleDao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { List roles = this.roleDao.FindRoleByUserId((String) params .get("userId")); if (!AppUtils.isBlank(roles)) response.put("functions", findFunctionByRole(roles)); else response.put("functions", null); } public List findFunctionByRole(List roles) { Map functionMap = new HashMap(); List functionList = new ArrayList(); for (int i = 0; i < roles.size(); i++) { Role role = (Role) roles.get(i); if (!AppUtils.isBlank(role.getId())) { List fs = this.dao.FindFunctionByRoleId(role.getId()); if (!AppUtils.isBlank(fs)) { for (int j = 0; j < fs.size(); j++) { Function f = (Function) fs.get(j); if (!functionMap.containsKey(f.getId())) { functionMap.put(f.getId(), null); functionList.add(f); } } } } } return functionList; } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } public void setRoleDao(RoleDao roleDao) { this.roleDao = roleDao; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindFunctionByUser.java
Java
oos
2,172
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.Role; import java.util.Map; public class UpdateRole extends AbstractCommand { private RoleDao dao; public void setDao(RoleDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { this.dao.update((Role) params.get("role")); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/UpdateRole.java
Java
oos
710
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.command.framework.JCFException; import com.legendshop.model.entity.Function; import java.util.Map; public class DeleteFunction extends AbstractCommand { private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { Function function = (Function) params.get("function"); if (checkFunction(function)) { String msg = "DeleteFunction PARAMETER_ERROR ,function is not validated!"; throw new JCFException("PARAMETER_ERROR", msg); } this.dao.delete(function); } private boolean checkFunction(Function fuction) { return fuction.getId() == null; } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/DeleteFunction.java
Java
oos
1,089
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.exception.JCFException; import java.util.Map; public class FindOtherFunctionByHql extends AbstractCommand { private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put( "functions", this.dao.FindOtherFunctionByRoleId( (HqlQuery) params.get("hqlQuery"), (String) params.get("roleId"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindOtherFunctionByHql.java
Java
oos
889
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import java.util.Map; public class FindRoleByFunction extends AbstractCommand { private RoleDao dao; public void setDao(RoleDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("roles", this.dao.FindRoleByFunction((String) params.get("functionId"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindRoleByFunction.java
Java
oos
732
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.Permission; import com.legendshop.model.entity.PerssionId; import java.util.Map; public class SaveFunctionToRole extends AbstractCommand { private static final long serialVersionUID = 5575511149689866328L; private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { Permission permission = (Permission) params.get("permission"); String result = checkPermission(permission); if (result != null) { throw new JCFException("PARAMETER_ERROR", result); } response.put("id", this.dao.save(permission)); } private String checkPermission(Permission permission) { if (permission.getId().getFunctionId() == null) return "SaveFunctionToRole PARAM_ERR ,FunctionId is NULL"; if (permission.getId().getRoleId() == null) { return "SaveFunctionToRole PARAM_ERR ,FunctionId is NULL"; } return null; } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/SaveFunctionToRole.java
Java
oos
1,470
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.UserDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.util.AppUtils; import java.util.Map; public class IsUserExist extends AbstractCommand { private UserDao dao; public void setDao(UserDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { if (AppUtils.isBlank(this.dao.findByName((String) params.get("name")))) response.put("resultBoolean", Boolean.FALSE); else response.put("resultBoolean", Boolean.TRUE); } public void fini() throws Exception { } public void init(String parameter) throws Exception { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/IsUserExist.java
Java
oos
813
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.UserDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.User; import com.legendshop.util.AppUtils; import java.util.Map; public class UpdateUser extends AbstractCommand { private UserDao dao; public void setDao(UserDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { User user = (User) params.get("user"); if (checkUser(user)) { String msg = "UpdateRole PARAM_ERR ,role is not validated!"; throw new JCFException("PARAMETER_ERROR", msg); } this.dao.update(user); } private boolean checkUser(User user) { return (AppUtils.isBlank(user)) || (AppUtils.isBlank(user.getEnabled())) || (AppUtils.isBlank(user.getId())) || (AppUtils.isBlank(user.getName())) || (AppUtils.isBlank(user.getPassword())); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/UpdateUser.java
Java
oos
1,261
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.Role; import java.util.Map; public class DeleteRoleById extends AbstractCommand { private RoleDao dao; public void setDao(RoleDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { this.dao.deleteById(Role.class, (String) params.get("roleId")); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/DeleteRoleById.java
Java
oos
734
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import java.util.List; import java.util.Map; public class DeleteRoleFromUser extends AbstractCommand { private RoleDao dao; public void setDao(RoleDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { this.dao.deleteAll((List) params.get("userRoles")); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/DeleteRoleFromUser.java
Java
oos
708
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.exception.JCFException; import java.util.Map; public class FindOtherRoleByUser extends AbstractCommand { private RoleDao dao; public void setDao(RoleDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("roles", this.dao.FindOtherRoleByUser( (HqlQuery) params.get("hqlQuery"), (String) params.get("userId"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindOtherRoleByUser.java
Java
oos
816
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.UserDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.User; import java.util.Map; public class FindUserById extends AbstractCommand { private UserDao dao; public void setDao(UserDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("user", (User) this.dao.get(User.class, (String) params.get("userId"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindUserById.java
Java
oos
767
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import java.util.Map; public class FindRoleByUserId extends AbstractCommand { private RoleDao dao; public void setDao(RoleDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("roles", this.dao.FindRoleByUserId((String) params.get("userId"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindRoleByUserId.java
Java
oos
724
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.UserDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import java.util.Map; public class DeleteUserRoleByUserId extends AbstractCommand { private UserDao dao; public void setDao(UserDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { this.dao.DeleteUserRole(this.dao.findUserRoleByUserId((String) params .get("userId"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/DeleteUserRoleByUserId.java
Java
oos
737
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.UserDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.User; import java.util.Map; public class SaveUser extends AbstractCommand { private UserDao dao; public void setDao(UserDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("result", this.dao.save((User) params.get("user"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/SaveUser.java
Java
oos
730
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.Function; import java.util.Map; public class FindFunctionById extends AbstractCommand { private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("function", (Function) this.dao.get(Function.class, (String) params.get("id"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindFunctionById.java
Java
oos
795
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import java.util.List; import java.util.Map; public class DeletePermissionByFunctionId extends AbstractCommand { private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { String functionId = (String) params.get("functionId"); List functionds = this.dao.find( "from Permission p where p.id.functionId=?", new Object[] {functionId }); this.dao.DeletePermissionByFunctionId(functionds); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/DeletePermissionByFunctionId.java
Java
oos
935
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.Role; import java.util.Map; public class FindRoleById extends AbstractCommand { private RoleDao dao; public void setDao(RoleDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("role", (Role) this.dao.get(Role.class, (String) params.get("id"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindRoleById.java
Java
oos
763
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import java.util.Map; public class FindOtherFunctionByRoleId extends AbstractCommand { private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("functions", this.dao.FindOtherFunctionByRoleId((String) params.get("roleId"))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindOtherFunctionByRoleId.java
Java
oos
758
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.util.AppUtils; import java.util.List; import java.util.Map; public class SaveFunctionsToRole extends AbstractCommand { private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { List permissions = (List) params.get("permissions"); if (checkPermissions(permissions)) { String msg = "SaveFunctionsToRole PARAM_ERR ,permissions is not validated!"; throw new JCFException("PARAMETER_ERROR", msg); } this.dao.savePermissions(permissions); } private boolean checkPermissions(List permissions) { return AppUtils.isBlank(permissions); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/SaveFunctionsToRole.java
Java
oos
1,134
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.UserDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.User; import java.util.Map; public class UpdateUserPassowrd extends AbstractCommand { private UserDao dao; public void setDao(UserDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { User user = (User) this.dao.get(User.class, (String) params.get("userId")); user.setPassword((String) params.get("password")); this.dao.update(user); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/UpdateUserPassowrd.java
Java
oos
855
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import java.util.List; import java.util.Map; public class DeleteFunctionsFromRole extends AbstractCommand { private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { this.dao.DeletePermissionByFunctionId((List) params.get("permissions")); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/DeleteFunctionsFromRole.java
Java
oos
746
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.Function; import java.util.Map; public class DeleteFunctionById extends AbstractCommand { private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put( "resultBoolean", Boolean.valueOf(this.dao.delete(Function.class, (String) params.get("functionId")))); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/DeleteFunctionById.java
Java
oos
850
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import java.util.Map; public class DeletePermissionByRoleId extends AbstractCommand { private RoleDao dao; public void setDao(RoleDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { this.dao.DeletePermissionByRoleId(this.dao.find( "from Permission p where p.id.roleId=?", new Object[] {(String) params.get("roleId") })); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/DeletePermissionByRoleId.java
Java
oos
803
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.exception.JCFException; import java.util.Map; public class FindAllFunction extends AbstractCommand { private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { response.put("PageSupport", this.dao.find((CriteriaQuery) params.get("CriteriaQuery"), true)); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/FindAllFunction.java
Java
oos
804
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.RoleDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.UserRole; import com.legendshop.util.AppUtils; import java.util.List; import java.util.Map; public class SaveRolesToUser extends AbstractCommand { private RoleDao dao; public void setDao(RoleDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { List userRoles = (List) params.get("userRoles"); if (checkPermissions(userRoles)) { String msg = "SaveFunctionsToRole PARAM_ERR ,userRoles is not validated!"; throw new JCFException("PARAMETER_ERROR", msg); } for (int i = 0; i < userRoles.size(); i++) { UserRole userRole = (UserRole) userRoles.get(i); this.dao.save(userRole); if (i % 50 == 0) { this.dao.flush(); this.dao.clear(); } } } private boolean checkPermissions(List userRoles) { return AppUtils.isBlank(userRoles); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/SaveRolesToUser.java
Java
oos
1,396
package com.legendshop.business.permission.command; import com.legendshop.business.permission.dao.FunctionDao; import com.legendshop.command.framework.AbstractCommand; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.Function; import java.util.Map; public class SaveFunction extends AbstractCommand { private FunctionDao dao; public void setDao(FunctionDao dao) { this.dao = dao; } public void execute(Map params, Map response) throws Exception { Function function = (Function) params.get("function"); if (checkFunction(function)) { String msg = "SaveFunction PARAM_ERR ,function is not validated!Name or ProtectFunction is Null"; throw new JCFException("PARAMETER_ERROR", msg); } response.put("id", this.dao.save(function)); } private boolean checkFunction(Function fuction) { return (fuction.getName() == null) || (fuction.getProtectFunction() == null); } public void fini() throws JCFException { } public void init(String arg0) throws JCFException { } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/command/SaveFunction.java
Java
oos
1,184
package com.legendshop.business.permission.dao; import com.legendshop.core.dao.impl.BaseDaoImpl; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.exception.JCFException; import com.legendshop.model.entity.Permission; import com.legendshop.model.entity.PerssionId; import com.legendshop.util.StringUtil; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.hibernate.HibernateException; import org.hibernate.Session; import org.springframework.orm.hibernate3.HibernateCallback; import org.springframework.orm.hibernate3.HibernateTemplate; public class FunctionDao extends BaseDaoImpl { private static final Log logger = LogFactory.getLog(FunctionDao.class); private String findFunctionByRoleId; private String findOtherFunctionByRoleId; private String findOtherFunctionByRoleIdHQL; private String findOtherFunctionByRoleIdHQLCount; public void setFindFunctionByRoleId(String findFunctionByRoleId) { this.findFunctionByRoleId = findFunctionByRoleId; } public void setFindOtherFunctionByRoleId(String findOtherFunctionByRoleId) { this.findOtherFunctionByRoleId = findOtherFunctionByRoleId; } public void setFindOtherFunctionByRoleIdHQL( String findOtherFunctionByRoleIdHQL) { this.findOtherFunctionByRoleIdHQL = findOtherFunctionByRoleIdHQL; } public List FindFunctionByRoleId(String roleId) { logger.info(StringUtil.convert(this.findFunctionByRoleId, new String[] {roleId })); return find(this.findFunctionByRoleId, new Object[] {roleId }); } public List FindOtherFunctionByRoleId(String roleId) { logger.info(StringUtil.convert(this.findOtherFunctionByRoleId, new String[] {roleId })); return find(this.findOtherFunctionByRoleId, new Object[] {roleId }); } public PageSupport FindOtherFunctionByRoleId(HqlQuery hqlQuery, String roleId) throws JCFException { logger.info(StringUtil.convert(this.findOtherFunctionByRoleIdHQL, new String[] {roleId })); hqlQuery.setQueryString(this.findOtherFunctionByRoleIdHQL); hqlQuery.setAllCountString(this.findOtherFunctionByRoleIdHQLCount); hqlQuery.setParam(new Object[] {roleId }); return find(hqlQuery); } public void savePermissions(final List permissions) throws Exception { getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException, SQLException { Connection con = session.connection(); PreparedStatement pstmt = null; for (int i = 0; i < permissions.size(); i++) { Permission p = (Permission) permissions.get(i); pstmt = con .prepareStatement("insert into ls_perm (role_id,function_id) values (?,?)"); FunctionDao.logger.info(StringUtil .convert( "insert into ls_perm (role_id,function_id) values (?,?)", new String[] {p.getId().getRoleId(), p.getId().getFunctionId() })); pstmt.setString(1, p.getId().getRoleId()); pstmt.setString(2, p.getId().getFunctionId()); pstmt.executeUpdate(); } return Boolean.TRUE; } }); } public void DeletePermissionByFunctionId(List permissions) { logger.info("DeletePermissionByFunctionId with size " + permissions.size()); deleteAll(permissions); } public void setFindOtherFunctionByRoleIdHQLCount( String findOtherFunctionByRoleIdHQLCount) { this.findOtherFunctionByRoleIdHQLCount = findOtherFunctionByRoleIdHQLCount; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/dao/FunctionDao.java
Java
oos
4,238
package com.legendshop.business.permission.dao; import com.legendshop.core.dao.impl.BaseDaoImpl; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.exception.JCFException; import com.legendshop.util.StringUtil; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class RoleDao extends BaseDaoImpl { private static final Log logger = LogFactory.getLog(RoleDao.class); private String findRoleByFunction; private String findRoleByUserId; private String findOtherRoleByUser; private String findOtherRoleByUserCount; public void setFindOtherRoleByUser(String findOtherRoleByUser) { this.findOtherRoleByUser = findOtherRoleByUser; } public void setFindRoleByFunction(String findRoleByFunction) { this.findRoleByFunction = findRoleByFunction; } public void setFindRoleByUserId(String findRoleByUserId) { this.findRoleByUserId = findRoleByUserId; } public List FindRoleByFunction(String functionId) throws JCFException { logger.info(StringUtil.convert(this.findRoleByFunction, new String[] {functionId })); return find(this.findRoleByFunction, new Object[] {functionId }); } public void DeletePermissionByRoleId(List permissions) { deleteAll(permissions); } public List FindRoleByUserId(String userId) throws JCFException { logger.info(StringUtil.convert(this.findRoleByUserId, new String[] {userId })); return find(this.findRoleByUserId, new Object[] {userId }); } public PageSupport FindOtherRoleByUser(HqlQuery hqlQuery, String userId) throws JCFException { logger.info(StringUtil.convert(this.findOtherRoleByUser, new String[] {userId })); hqlQuery.setQueryString(this.findOtherRoleByUser); hqlQuery.setAllCountString(this.findOtherRoleByUserCount); hqlQuery.addParams(userId); return find(hqlQuery); } public void setFindOtherRoleByUserCount(String findOtherRoleByUserCount) { this.findOtherRoleByUserCount = findOtherRoleByUserCount; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/dao/RoleDao.java
Java
oos
2,368
package com.legendshop.business.permission.dao; import com.legendshop.core.dao.impl.BaseDaoImpl; import com.legendshop.util.StringUtil; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class UserDao extends BaseDaoImpl { private static final Log logger = LogFactory.getLog(UserDao.class); private String findByName; private String findUserRoleByRoleId; private String findUserRoleByUserId; public void setFindByName(String findByName) { this.findByName = findByName; } public void setFindUserRoleByRoleId(String findUserRoleByRoleId) { this.findUserRoleByRoleId = findUserRoleByRoleId; } public void setFindUserRoleByUserId(String findUserRoleByUserId) { this.findUserRoleByUserId = findUserRoleByUserId; } public void DeleteUserRole(List userRoles) { logger.info("DeleteUserRole with size " + userRoles.size()); deleteAll(userRoles); } public List findByName(String name) { logger.info(StringUtil.convert(this.findByName, new String[] {name })); return find(this.findByName, new Object[] {name }); } public List findUserRoleByRoleId(String roleId) { logger.info(StringUtil.convert(this.findUserRoleByRoleId, new String[] {roleId })); return find(this.findUserRoleByRoleId, new Object[] {roleId }); } public List findUserRoleByUserId(String userId) { logger.info(StringUtil.convert(this.findUserRoleByUserId, new String[] {userId })); return find(this.findUserRoleByUserId, new Object[] {userId }); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/dao/UserDao.java
Java
oos
1,768
package com.legendshop.business.permission.common; public class ManagerConstants { public static String BizDelegateManager = "BizDelegateManager"; public static String BizDelegateWithOutMethodControl = "BizDelegateWithOutMethodControl"; public static String BizDelegateTarget = "BizDelegateTarget"; public static String rightFacade = "rightFacade"; public static final String SERVICE_CONFIG = "etc/ServiceConfig.xml"; public static final String CacheSubscriber = "CacheSubscriber"; public static final String UpdateUser = "UpdateUser"; public static final String UpdateFunction = "UpdateFunction"; public static final String UpdateAllCache = "UpdateAllCache"; public static final String userCache = "userCache"; public static final String authorityUserCache = "authorityUserCache"; public static final String authorityFunctionCache = "authorityFunctionCache"; public static final String functionCache = "functionCache"; public static final String functionRoleCache = "functionRoleCache"; public static final String roleCache = "roleCache"; public static final String METHOD_CACHE = "METHOD_CACHE"; }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/common/ManagerConstants.java
Java
oos
1,479
package com.legendshop.business.permission.common; public class ErrorCode extends com.legendshop.command.framework.ErrorCode { }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/common/ErrorCode.java
Java
oos
134
package com.legendshop.business.permission.common; public class ServiceConsts { public static final String FindgrantedAuthorityFromDataBaseProcessor = "FindgrantedAuthorityFromDataBaseProcessor"; public static final String FindRoleByFunctionProcessor = "FindRoleByFunctionProcessor"; public static final String FindRoleByUserProcessor = "FindRoleByUserProcessor"; public static final String FindFunctionFromDataBaseProcessor = "FindFunctionFromDataBaseProcessor"; public static final String FindUserByNameFromDataBaseProcessor = "FindUserByNameFromDataBaseProcessor"; public static final String DeletePermissionByFunctionIdProcessor = "DeletePermissionByFunctionIdProcessor"; public static final String DeleteFunctionsFromRoleProcessor = "DeleteFunctionsFromRoleProcessor"; public static final String FindUserByIdProcessor = "FindUserByIdProcessor"; public static final String DeleteUserRoleByUserIdProcessor = "DeleteUserRoleByUserIdProcessor"; public static final String DeleteRoleFromUserProcessor = "DeleteRoleFromUserProcessor"; public static final String DeleteUserRoleByRoleIdProcessor = "DeleteUserRoleByRoleIdProcessor"; public static final String DeletePermissionByRoleIdProcessor = "DeletePermissionByRoleIdProcessor"; public static final String FindFunctionByUserProcessor = "FindFunctionByUserProcessor"; public static final String FindOtherRoleByUserProcessor = "FindOtherRoleByUserProcessor"; public static final String SaveRolesToUserProcessor = "SaveRolesToUserProcessor"; public static final String UpdateUserProcessor = "UpdateUserProcessor"; public static final String SaveFunctionProcessor = "SaveFunctionProcessor"; public static final String SaveFunctionToRoleProcessor = "SaveFunctionToRoleProcessor"; public static final String SaveFunctionsToRoleProcessor = "SaveFunctionsToRoleProcessor"; public static final String DeleteFunctionByIdProcessor = "DeleteFunctionByIdProcessor"; public static final String DeleteFunctionProcessor = "DeleteFunctionProcessor"; public static final String UpdateFunctionProcessor = "UpdateFunctionProcessor"; public static final String FindAllFunctionProcessor = "FindAllFunctionProcessor"; public static final String FindFunctionByIdProcessor = "FindFunctionByIdProcessor"; public static final String SaveRoleProcessor = "SaveRoleProcessor"; public static final String DeleteRoleByIdProcessor = "DeleteRoleByIdProcessor"; public static final String DeleteRoleProcessor = "DeleteRoleProcessor"; public static final String UpdateRoleProcessor = "UpdateRoleProcessor"; public static final String FindAllRoleProcessor = "FindAllRoleProcessor"; public static final String FindRoleByIdProcessor = "FindRoleByIdProcessor"; public static final String FindFunctionByRoleIdProcessor = "FindFunctionByRoleIdProcessor"; public static final String FindOtherFunctionByRoleIdProcessor = "FindOtherFunctionByRoleIdProcessor"; public static final String FindOtherFunctionByHqlProcessor = "FindOtherFunctionByHqlProcessor"; public static final String SaveUserProcessor = "SaveUserProcessor"; public static final String IsUserExistProcessor = "IsUserExistProcessor"; public static final String FindAllUserProcessor = "FindAllUserProcessor"; public static final String UpdateUserPassowrdProcessor = "UpdateUserPassowrdProcessor"; public static final String SaveFileProcessor = "SaveFileProcessor"; public static final String DeleteFileByIdProcessor = "DeleteFileByIdProcessor"; public static final String DeleteFileProcessor = "DeleteFileProcessor"; public static final String UpdateFileProcessor = "UpdateFileProcessor"; public static final String FindAllFileProcessor = "FindAllFileProcessor"; public static final String FindFileByIdProcessor = "FindFileByIdProcessor"; public static final String SaveLoginHistoryProcessor = "SaveLoginHistoryProcessor"; }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/common/ServiceConsts.java
Java
oos
4,715
package com.legendshop.business.permission.common; import com.legendshop.command.framework.ErrorHandler; import com.legendshop.command.framework.GoOnException; import com.legendshop.command.framework.JCFException; import com.legendshop.command.framework.Response; import com.legendshop.command.framework.State; import org.apache.log4j.Logger; public class ProcessorErrorHandler implements ErrorHandler { private String beanName; private static Logger logger = Logger .getLogger(ProcessorErrorHandler.class); public void handleError(Response resp, Throwable th) throws Exception { if ((th instanceof GoOnException)) { logger.error("throw GoOnException 异常", th); } else { if ((th instanceof JCFException)) { logger.error("throw JCFException 异常", th); resp.setReturnCode(-2); resp.getState().setErrCode("A JCFException happened"); throw ((JCFException) th); } logger.error(th + " error occured, forcing a stop"); resp.setReturnCode(-2); resp.getState().setErrCode("A Exception happened"); if ((th instanceof Exception)) throw ((Exception) th); } } public void setBeanName(String beanName) { this.beanName = beanName; } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/common/ProcessorErrorHandler.java
Java
oos
1,452
package com.legendshop.business.permission.common; import com.legendshop.business.permission.service.RightDelegate; import com.legendshop.core.ContextServiceLocator; import com.legendshop.util.ServiceLocatorIF; public class BeanFactory { private static BeanFactory instance; public static BeanFactory getInstance() { if (instance == null) instance = new BeanFactory(); return instance; } public static Object getBean(String beanName) { return ContextServiceLocator.getInstance().getBean(beanName); } public RightDelegate getRightDelegate() { return (RightDelegate) ContextServiceLocator.getInstance().getBean( "RightDelegateImpl"); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/permission/common/BeanFactory.java
Java
oos
761
package com.legendshop.business.service; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.Advertisement; import java.util.List; import java.util.Map; public abstract interface AdvertisementService { public abstract List<Advertisement> getAdvertisementByUserName( String paramString); public abstract Advertisement getAdvertisement(Long paramLong); public abstract boolean isMaxNum(String paramString1, String paramString2); public abstract void delete(Long paramLong); public abstract Long save(Advertisement paramAdvertisement); public abstract void update(Advertisement paramAdvertisement); public abstract PageSupport getDataByCriteriaQuery( CriteriaQuery paramCriteriaQuery); public abstract List<Advertisement> getOneAdvertisement( String paramString1, String paramString2); public abstract Map<String, List<Advertisement>> getAdvertisement( String paramString); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/AdvertisementService.java
Java
oos
1,103
package com.legendshop.business.service; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.ExternalLink; import java.util.List; public abstract interface ExternalLinkService { public abstract List<ExternalLink> getExternalLink(String paramString); public abstract ExternalLink getExternalLinkById(Long paramLong); public abstract ExternalLink getExternalLinkList(Long paramLong, String paramString); public abstract void delete(Long paramLong); public abstract Long save(ExternalLink paramExternalLink); public abstract void update(ExternalLink paramExternalLink); public abstract PageSupport getDataByCriteriaQuery( CriteriaQuery paramCriteriaQuery); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/ExternalLinkService.java
Java
oos
845
package com.legendshop.business.service; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.security.core.Authentication; public abstract interface LoginService { public abstract Authentication onAuthentication( HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, String paramString1, String paramString2); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/LoginService.java
Java
oos
458
package com.legendshop.business.service; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.Product; import com.legendshop.model.entity.ProductComment; import java.util.List; public abstract interface ProductCommentService { public abstract List<ProductComment> getProductCommentList( String paramString); public abstract ProductComment getProductCommentById(Long paramLong); public abstract Product getProduct(Long paramLong); public abstract void delete(Long paramLong); public abstract Long save(ProductComment paramProductComment); public abstract void update(ProductComment paramProductComment); public abstract PageSupport getProductCommentList( CriteriaQuery paramCriteriaQuery); public abstract PageSupport getProductCommentList(HqlQuery paramHqlQuery); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/ProductCommentService.java
Java
oos
1,016
package com.legendshop.business.service; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.UserComment; public abstract interface UserCommentService { public abstract PageSupport getUserCommentList( CriteriaQuery paramCriteriaQuery); public abstract UserComment getUserComment(Long paramLong); public abstract void delete(UserComment paramUserComment); public abstract void updateUserCommentToReaded(UserComment paramUserComment); public abstract void saveOrUpdateUserComment(UserComment paramUserComment); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/UserCommentService.java
Java
oos
668
package com.legendshop.business.service; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.Product; public abstract interface ProductService { public abstract PageSupport getProductList(HqlQuery paramHqlQuery); public abstract PageSupport getProductList(CriteriaQuery paramCriteriaQuery); public abstract Product getProductById(Long paramLong); public abstract void updateProduct(Product paramProduct); public abstract Long saveProduct(Product paramProduct); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/ProductService.java
Java
oos
661
package com.legendshop.business.service; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.Event; import java.util.List; public abstract interface EventService { public abstract List<Event> getEvent(String paramString); public abstract Event getEvent(Long paramLong); public abstract void deleteEvent(Event paramEvent); public abstract Long saveEvent(Event paramEvent); public abstract void updateEvent(Event paramEvent); public abstract PageSupport getEvent(CriteriaQuery paramCriteriaQuery); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/EventService.java
Java
oos
658
package com.legendshop.business.service; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.Partner; import java.util.List; public abstract interface PartnerService { public abstract List<Partner> getPartner(String paramString); public abstract Partner getPartner(Long paramLong); public abstract void deletePartner(Partner paramPartner); public abstract Long savePartner(Partner paramPartner); public abstract void updatePartner(Partner paramPartner); public abstract PageSupport getPartner(CriteriaQuery paramCriteriaQuery); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/PartnerService.java
Java
oos
690
package com.legendshop.business.service; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.service.ShopService; import com.legendshop.model.entity.ShopDetail; import com.legendshop.model.entity.UserDetail; public abstract interface ShopDetailService extends ShopService { public abstract ShopDetail getShopDetailById(Long paramLong); public abstract UserDetail getShopDetailByName(String paramString); public abstract void delete(Long paramLong); public abstract void delete(ShopDetail paramShopDetail); public abstract void save(ShopDetail paramShopDetail); public abstract void update(ShopDetail paramShopDetail); public abstract PageSupport getShopDetail(CriteriaQuery paramCriteriaQuery); public abstract ShopDetail getShopDetailByUserId(String paramString); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/ShopDetailService.java
Java
oos
942
package com.legendshop.business.service; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.UserAddress; import java.util.List; public abstract interface UserAddressService { public abstract List<UserAddress> getUserAddress(String paramString); public abstract UserAddress getUserAddress(Long paramLong); public abstract void deleteUserAddress(UserAddress paramUserAddress); public abstract Long saveUserAddress(UserAddress paramUserAddress); public abstract void updateUserAddress(UserAddress paramUserAddress); public abstract PageSupport getUserAddress(CriteriaQuery paramCriteriaQuery); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/UserAddressService.java
Java
oos
754
package com.legendshop.business.service; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.NewsCategory; import java.util.List; public abstract interface NewsCategoryService { public abstract List<NewsCategory> getNewsCategoryList(String paramString); public abstract NewsCategory getNewsCategoryById(Long paramLong); public abstract void delete(Long paramLong); public abstract Long save(NewsCategory paramNewsCategory); public abstract void update(NewsCategory paramNewsCategory); public abstract PageSupport getNewsCategoryList( CriteriaQuery paramCriteriaQuery); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/NewsCategoryService.java
Java
oos
740
package com.legendshop.business.service; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.Brand; import java.util.List; public abstract interface BrandService { public abstract List<Brand> getBrand(String paramString); public abstract Brand getBrand(Long paramLong); public abstract void delete(Long paramLong); public abstract Long save(Brand paramBrand); public abstract void update(Brand paramBrand); public abstract PageSupport getDataByCriteriaQuery( CriteriaQuery paramCriteriaQuery); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/BrandService.java
Java
oos
665
package com.legendshop.business.service; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.News; import java.util.List; public abstract interface NewsService { public abstract List<News> getNewsList(String paramString); public abstract News getNewsById(Long paramLong); public abstract News getNewsByIdAndName(Long paramLong, String paramString); public abstract void delete(Long paramLong); public abstract Long save(News paramNews); public abstract void update(News paramNews); public abstract PageSupport getNewsList(CriteriaQuery paramCriteriaQuery); public abstract PageSupport getNewsList(HqlQuery paramHqlQuery); }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/NewsService.java
Java
oos
856
package com.legendshop.business.service.impl; import com.legendshop.business.dao.PartnerDao; import com.legendshop.business.service.PartnerService; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.Partner; import com.legendshop.util.AppUtils; import java.util.List; public class PartnerServiceImpl implements PartnerService { private PartnerDao partnerDao; public void setPartnerDao(PartnerDao partnerDao) { this.partnerDao = partnerDao; } public List<Partner> getPartner(String userName) { return this.partnerDao.getPartner(userName); } public Partner getPartner(Long id) { return this.partnerDao.getPartner(id); } public void deletePartner(Partner partner) { this.partnerDao.deletePartner(partner); } public Long savePartner(Partner partner) { if (!AppUtils.isBlank(partner.getPartnerId())) { updatePartner(partner); return partner.getPartnerId(); } return (Long) this.partnerDao.save(partner); } public void updatePartner(Partner partner) { this.partnerDao.updatePartner(partner); } public PageSupport getPartner(CriteriaQuery cq) { return this.partnerDao.find(cq); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/impl/PartnerServiceImpl.java
Java
oos
1,403
package com.legendshop.business.service.impl; import com.legendshop.business.dao.LuceneDao; import com.legendshop.business.service.LuceneService; import java.util.Date; import java.util.List; import org.springframework.beans.factory.annotation.Required; public class LuceneServiceImpl implements LuceneService { private LuceneDao luceneDao; @Required public void setLuceneDao(LuceneDao luceneDao) { this.luceneDao = luceneDao; } public long getFirstPostIdByDate(int entityType, Date fromDate) { return this.luceneDao.getFirstPostIdByDate(entityType, fromDate); } public List getPostsToIndex(int entityType, long firstPostId, long toPostId) { return this.luceneDao .getPostsToIndex(entityType, firstPostId, toPostId); } public long getLastPostIdByDate(int entityType, Date toDate) { return this.luceneDao.getLastPostIdByDate(entityType, toDate); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/impl/LuceneServiceImpl.java
Java
oos
984
package com.legendshop.business.service.impl; import com.legendshop.business.dao.UserDetailDao; import com.legendshop.business.service.UserDetailService; import com.legendshop.core.dao.support.HqlQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.dao.support.SqlQuery; import com.legendshop.model.entity.UserDetail; import org.springframework.beans.factory.annotation.Required; public class UserDetailServiceImpl implements UserDetailService { private UserDetailDao userDetailDao; public Long getScore(String userName) { return this.userDetailDao.getUserScore(userName); } public PageSupport getUserDetailList(HqlQuery hqlQuery) { return this.userDetailDao.getUserDetailList(hqlQuery); } public UserDetail getUserDetail(String userName) { return this.userDetailDao.getUserDetail(userName); } @Required public void setUserDetailDao(UserDetailDao userDetailDao) { this.userDetailDao = userDetailDao; } public PageSupport getUserDetailList(SqlQuery sqlQuery) { return this.userDetailDao.getUserDetailList(sqlQuery); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/impl/UserDetailServiceImpl.java
Java
oos
1,201
package com.legendshop.business.service.impl; import com.legendshop.business.dao.AdvertisementDao; import com.legendshop.business.service.AdvertisementService; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.Advertisement; import com.legendshop.util.AppUtils; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Required; public class AdvertisementServiceImpl implements AdvertisementService { private AdvertisementDao advertisementDao; public List<Advertisement> getAdvertisementByUserName(String userName) { return (List<Advertisement>) this.advertisementDao.findByHQL( "from Advertisement where userName = ?", new Object[] {userName }); } public Advertisement getAdvertisement(Long id) { return (Advertisement) this.advertisementDao.get(Advertisement.class, id); } public boolean isMaxNum(String userName, String type) { return this.advertisementDao.isMaxNum(userName, type); } public void delete(Long id) { this.advertisementDao.deleteById(Advertisement.class, id); } public Long save(Advertisement advertisement) { if (!AppUtils.isBlank(advertisement.getId())) { update(advertisement); return advertisement.getId(); } return (Long) this.advertisementDao.save(advertisement); } public void update(Advertisement advertisement) { this.advertisementDao.update(advertisement); } public PageSupport getDataByCriteriaQuery(CriteriaQuery cq) { return this.advertisementDao.find(cq); } public List<Advertisement> getOneAdvertisement(String shopName, String key) { return this.advertisementDao.getOneAdvertisement(shopName, key); } @Required public void setAdvertisementDao(AdvertisementDao advertisementDao) { this.advertisementDao = advertisementDao; } public Map<String, List<Advertisement>> getAdvertisement(String shopName) { return this.advertisementDao.getAdvertisement(shopName); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/impl/AdvertisementServiceImpl.java
Java
oos
2,271
package com.legendshop.business.service.impl; import com.legendshop.business.dao.CashFlowDao; import com.legendshop.business.service.CashFlowService; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.model.entity.CashFlow; import com.legendshop.util.AppUtils; import java.util.List; public class CashFlowServiceImpl implements CashFlowService { private CashFlowDao cashFlowDao; public void setCashFlowDao(CashFlowDao cashFlowDao) { this.cashFlowDao = cashFlowDao; } public List<CashFlow> getCashFlow(String userName) { return this.cashFlowDao.getCashFlow(userName); } public CashFlow getCashFlow(Long id) { return this.cashFlowDao.getCashFlow(id); } public void deleteCashFlow(CashFlow cashFlow) { this.cashFlowDao.deleteCashFlow(cashFlow); } public Long saveCashFlow(CashFlow cashFlow) { if (!AppUtils.isBlank(cashFlow.getFlowId())) { updateCashFlow(cashFlow); return cashFlow.getFlowId(); } return (Long) this.cashFlowDao.save(cashFlow); } public void updateCashFlow(CashFlow cashFlow) { this.cashFlowDao.updateCashFlow(cashFlow); } public PageSupport getCashFlow(CriteriaQuery cq) { return this.cashFlowDao.find(cq); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/impl/CashFlowServiceImpl.java
Java
oos
1,440
package com.legendshop.business.service.impl; import com.legendshop.core.dao.BaseDao; import com.legendshop.core.tag.TableCache; import com.legendshop.model.entity.ConstTable; import com.legendshop.model.entity.ConstTableId; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MapCodeTablesCache implements TableCache { private static Logger log = LoggerFactory .getLogger(MapCodeTablesCache.class); private Map<String, Map<String, String>> codeTables = new HashMap(); private BaseDao baseDao; public Map<String, Map<String, String>> getCodeTables() { return this.codeTables; } public void setCodeTables(Map<String, Map<String, String>> codeTables) { this.codeTables = codeTables; } public Map<String, String> getCodeTable(String beanName) { if ((beanName == null) || (beanName.trim().length() == 0)) { return null; } Map table = (Map) this.codeTables.get(beanName); return table; } public void initCodeTablesCache() { List<ConstTable> list = loadAllConstTable(); for (ConstTable constTable : list) { String type = constTable.getId().getType(); Map items = (Map) this.codeTables.get(type); if (items == null) { items = new LinkedHashMap(); } items.put(constTable.getId().getKey(), constTable.getValue()); this.codeTables.put(type, items); } log.info("codeTables size = {}", Integer.valueOf(this.codeTables.size())); } public void setBaseDao(BaseDao baseDao) { this.baseDao = baseDao; } public List<ConstTable> loadAllConstTable() { return (List<ConstTable>) this.baseDao .findByHQL("from ConstTable c order by c.id.type, c.seq"); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/impl/MapCodeTablesCache.java
Java
oos
2,153
package com.legendshop.business.service.impl; import com.legendshop.business.dao.ExternalLinkDao; import com.legendshop.business.service.ExternalLinkService; import com.legendshop.core.dao.support.CriteriaQuery; import com.legendshop.core.dao.support.PageSupport; import com.legendshop.core.exception.BusinessException; import com.legendshop.model.entity.ExternalLink; import com.legendshop.util.AppUtils; import java.util.List; import org.springframework.beans.factory.annotation.Required; public class ExternalLinkServiceImpl implements ExternalLinkService { private ExternalLinkDao externalLinkDao; @Required public void setExternalLinkDao(ExternalLinkDao baseDao) { this.externalLinkDao = baseDao; } public List<ExternalLink> getExternalLink(String userName) { return (List<ExternalLink>) this.externalLinkDao.findByHQL( "from ExternalLink where userName = ?", new Object[] {userName }); } public ExternalLink getExternalLinkById(Long id) { return (ExternalLink) this.externalLinkDao.get(ExternalLink.class, id); } public ExternalLink getExternalLinkList(Long id, String userName) { ExternalLink externalLink = (ExternalLink) this.externalLinkDao .findUniqueBy("from ExternalLink where id = ? and userName = ?", ExternalLink.class, new Object[] {id, userName }); if (externalLink == null) { throw new BusinessException("no ExternalLink record", "15"); } return externalLink; } public void delete(Long id) { this.externalLinkDao.deleteById(ExternalLink.class, id); } public Long save(ExternalLink externalLink) { if (!AppUtils.isBlank(externalLink.getId())) { ExternalLink entity = (ExternalLink) this.externalLinkDao.get( ExternalLink.class, externalLink.getId()); if (entity != null) { entity.setUrl(externalLink.getUrl()); entity.setWordlink(externalLink.getWordlink()); entity.setContent(externalLink.getContent()); entity.setBs(externalLink.getBs()); update(entity); return externalLink.getId(); } return null; } return (Long) this.externalLinkDao.save(externalLink); } public void update(ExternalLink externalLink) { this.externalLinkDao.update(externalLink); } public PageSupport getDataByCriteriaQuery(CriteriaQuery cq) { return this.externalLinkDao.find(cq); } }
100mall
trunk/100mall/src/main/java/business/com/legendshop/business/service/impl/ExternalLinkServiceImpl.java
Java
oos
2,673