Browse Source

添加管理员BUG

wanghui 8 years ago
parent
commit
6a8050683a

+ 0 - 2
src/main/java/com/goafanti/common/controller/WebpageController.java

@@ -16,7 +16,6 @@ import com.goafanti.achievement.bo.AchievementPartnerListBo;
 import com.goafanti.achievement.service.AchievementService;
 import com.goafanti.banners.enums.BannersType;
 import com.goafanti.banners.service.BannersService;
-import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.enums.AchievementMaturity;
 import com.goafanti.common.enums.MarketingPage;
 import com.goafanti.common.enums.UserType;
@@ -26,7 +25,6 @@ import com.goafanti.dataGlossory.service.DistrictGlossoryService;
 import com.goafanti.demand.service.DemandService;
 import com.goafanti.marketing.bo.MarketingManagementBo;
 import com.goafanti.marketing.service.MarketingManagementService;
-import com.goafanti.portal.bo.InternationalListBo;
 import com.goafanti.user.bo.UserPartnerDetailBo;
 import com.goafanti.user.service.OrganizationIdentityService;
 import com.goafanti.user.service.UserIdentityService;

+ 0 - 1
src/main/java/com/goafanti/common/dao/UserMapper.java

@@ -17,7 +17,6 @@ import com.goafanti.customer.bo.CustomerOrganizationDetailBo;
 import com.goafanti.customer.bo.CustomerPersonalDetailBo;
 import com.goafanti.customer.bo.CustomerSimpleBo;
 import com.goafanti.customer.bo.FollowBusinessBo;
-import com.goafanti.customer.bo.StatisticBo;
 
 public interface UserMapper {
 	/**

+ 88 - 81
src/main/java/com/goafanti/common/error/SystemExceptionResolver.java

@@ -1,81 +1,88 @@
-package com.goafanti.common.error;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.io.support.ResourcePropertySource;
-import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;
-
-import com.goafanti.common.bo.Error;
-import com.goafanti.common.bo.Result;
-import com.goafanti.common.utils.LoggerUtils;
-import com.goafanti.common.utils.StringUtils;
-import com.goafanti.core.shiro.filter.ShiroFilterUtils;
-
-public class SystemExceptionResolver extends SimpleMappingExceptionResolver {
-	@Resource(name = "errorResource")
-	private ResourcePropertySource	errorResource;
-
-	@Autowired
-	private ShiroFilterUtils		shiroFilterUtils;
-
-	@Override
-	protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
-			Exception ex) {
-		// Expose ModelAndView for chosen error view.
-		String viewName = determineViewName(ex, request);
-
-		ex = handleErrorMessage(ex);
-
-		if (viewName != null) {
-			if (!shiroFilterUtils.isAjax(request)) {// JSP
-				// Apply HTTP status code for error views, if specified.
-				// Only apply it if we're processing a top-level request.
-				Integer statusCode = determineStatusCode(request, viewName);
-				if (statusCode != null) {
-					applyStatusCodeIfPossible(request, response, statusCode);
-				}
-				return getModelAndView(viewName, ex, request);
-			} else {// JSON
-				Result res = new Result();
-				res.getError().add(new Error(viewName, ex.getMessage()));
-				shiroFilterUtils.out(response, res);
-				return null;
-			}
-		} else {
-			return null;
-		}
-	}
-
-	private Exception handleErrorMessage(Exception ex) {
-		Error error = null;
-		if (ex instanceof BusinessException) {
-			BusinessException bex = (BusinessException) ex;
-			error = new Error(bex.getCode(), bex.getField(), (String) errorResource.getProperty(bex.getCode()));
-		} else if (ex instanceof IllegalArgumentException) {
-			Object message = errorResource.getProperty(ex.getMessage());
-			if (message == null) {
-				message = errorResource.getProperty(ex.getClass().getName());
-			}
-			error = new Error((String) message);
-		} else {
-			error = new Error((String) errorResource.getProperty(ex.getClass().getName()));
-			LoggerUtils.fmtError(getClass(), ex, "系统异常。");
-		}
-		if (StringUtils.isEmpty(error.getMessage())) {
-			error.setMessage("系统异常,请联系管理员。");
-		}
-		return new BusinessException(error, ex.getCause());
-	}
-
-	/**
-	 * @param errorResource
-	 *            the errorResource to set
-	 */
-	public void setErrorResource(ResourcePropertySource errorResource) {
-		this.errorResource = errorResource;
-	}
-}
+package com.goafanti.common.error;
+
+import java.text.MessageFormat;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.support.ResourcePropertySource;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.handler.SimpleMappingExceptionResolver;
+
+import com.goafanti.common.bo.Error;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.utils.LoggerUtils;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.core.shiro.filter.ShiroFilterUtils;
+
+public class SystemExceptionResolver extends SimpleMappingExceptionResolver {
+	@Resource(name = "errorResource")
+	private ResourcePropertySource	errorResource;
+
+	@Autowired
+	private ShiroFilterUtils		shiroFilterUtils;
+
+	@Override
+	protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler,
+			Exception ex) {
+		// Expose ModelAndView for chosen error view.
+		String viewName = determineViewName(ex, request);
+
+		ex = handleErrorMessage(ex);
+
+		if (viewName != null) {
+			if (!shiroFilterUtils.isAjax(request)) {// JSP
+				// Apply HTTP status code for error views, if specified.
+				// Only apply it if we're processing a top-level request.
+				Integer statusCode = determineStatusCode(request, viewName);
+				if (statusCode != null) {
+					applyStatusCodeIfPossible(request, response, statusCode);
+				}
+				return getModelAndView(viewName, ex, request);
+			} else {// JSON
+				Result res = new Result();
+				res.getError().add(new Error(viewName,ex.getMessage())); 
+				shiroFilterUtils.out(response, res);
+				return null;
+			}
+		} else {
+			return null;
+		}
+	}
+
+	private Exception handleErrorMessage(Exception ex) {
+		Error error = null;
+		if (ex instanceof BusinessException) {
+			BusinessException bex = (BusinessException) ex;
+			String message = (String)errorResource.getProperty(bex.getCode());
+			if(StringUtils.isEmpty(message)){
+				error = new Error(bex.getCode(),bex.getMessage());
+			}else{
+				error = new Error(bex.getCode(), MessageFormat.format(message, bex.getField()));
+			}
+		} else if (ex instanceof IllegalArgumentException) {
+			Object message = errorResource.getProperty(ex.getMessage());
+			if (message == null) {
+				message = errorResource.getProperty(ex.getClass().getName());
+			}
+			error = new Error((String) message);
+		} else {
+			error = new Error((String) errorResource.getProperty(ex.getClass().getName()));
+			LoggerUtils.fmtError(getClass(), ex, "系统异常。");
+		}
+		if (StringUtils.isEmpty(error.getMessage())) {
+			error.setMessage("系统异常,请联系管理员。");
+		}
+		return new BusinessException(error, ex.getCause());
+	}
+
+	/**
+	 * @param errorResource
+	 *            the errorResource to set
+	 */
+	public void setErrorResource(ResourcePropertySource errorResource) {
+		this.errorResource = errorResource;
+	}
+}

+ 2 - 2
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -32,7 +32,7 @@
   <insert id="insert" parameterType="com.goafanti.common.model.Admin" >
     insert into admin (id, mobile, name, 
       password, email, create_time, 
-      number, province, position, superior_id, city)
+      number, province, position, superior_id, city,department_id)
     values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
       #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
       #{number,jdbcType=INTEGER}, #{province,jdbcType=INTEGER}, #{position,jdbcType=VARCHAR},
@@ -169,7 +169,7 @@
       position = #{position,jdbcType=VARCHAR},
       superior_id = #{superiorId,jdbcType=VARCHAR},
       city = #{city,jdbcType=INTEGER},
-      department_id = #{departmentId,jdbcType=VARCHAR},
+      department_id = #{departmentId,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
   

+ 10 - 0
src/main/java/com/goafanti/common/model/MemberOrder.java

@@ -464,4 +464,14 @@ public class MemberOrder {
     public void setPayState(Integer payState) {
         this.payState = payState;
     }
+    
+    private String gradeName;
+
+	public String getGradeName() {
+		return gradeName;
+	}
+
+	public void setGradeName(String gradeName) {
+		this.gradeName = gradeName;
+	}
 }

+ 0 - 2
src/main/java/com/goafanti/user/service/UserService.java

@@ -1,6 +1,5 @@
 package com.goafanti.user.service;
 
-import java.text.ParseException;
 import java.util.List;
 import java.util.Map;
 
@@ -11,7 +10,6 @@ import com.goafanti.user.bo.OrgUnitNames;
 import com.goafanti.user.bo.StarAndExpertListBo;
 import com.goafanti.user.bo.StarListBo;
 import com.goafanti.user.bo.UserDownLoadBo;
-import com.goafanti.user.bo.UserListBo;
 import com.goafanti.user.bo.UserNames;
 import com.goafanti.user.bo.UserPageHomeBo;
 import com.goafanti.user.bo.UserPartnerDetailBo;

+ 0 - 5
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -1,7 +1,6 @@
 package com.goafanti.user.service.impl;
 
 import java.text.ParseException;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -13,7 +12,6 @@ import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.AdminLocationMapper;
 import com.goafanti.common.dao.CopyrightInfoMapper;
 import com.goafanti.common.dao.OrgIntellectualPropertyMapper;
 import com.goafanti.common.dao.OrganizationIdentityMapper;
@@ -35,7 +33,6 @@ import com.goafanti.user.bo.OrgUnitNames;
 import com.goafanti.user.bo.StarAndExpertListBo;
 import com.goafanti.user.bo.StarListBo;
 import com.goafanti.user.bo.UserDownLoadBo;
-import com.goafanti.user.bo.UserListBo;
 import com.goafanti.user.bo.UserNames;
 import com.goafanti.user.bo.UserPageHomeBo;
 import com.goafanti.user.bo.UserPartnerDetailBo;
@@ -50,8 +47,6 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 	@Autowired
 	private UserIdentityMapper				userIdentityMapper;
 	@Autowired
-	private AdminLocationMapper				adminLocationMapper;
-	@Autowired
 	private PatentInfoMapper				patentInfoMapper;
 	@Autowired
 	private CopyrightInfoMapper				copyrightInfoMapper;