Просмотр исходного кода

1.短信接口依赖更改
2.会员管理接口更改

Antiloveg лет назад: 9
Родитель
Сommit
9b6b92c44b

+ 0 - 28
pom.xml

@@ -298,34 +298,6 @@
             <artifactId>aliyun-java-sdk-sms</artifactId>
             <version>3.0.0-rc1</version>
         </dependency>
-        <!--  HttpUtils begin-->
-        	<dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpclient</artifactId>
-            <version>4.2.1</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpcore</artifactId>
-            <version>4.2.1</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-            <version>2.6</version>
-        </dependency>
-        <dependency>
-            <groupId>org.eclipse.jetty</groupId>
-            <artifactId>jetty-util</artifactId>
-            <version>9.3.7.v20160115</version>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.5</version>
-            <scope>test</scope>
-        </dependency>
-        <!-- HttpUtils end -->
 	</dependencies>
 	<build>
 		<resources>

+ 8 - 0
src/main/java/com/goafanti/common/controller/BaseController.java

@@ -34,6 +34,12 @@ public class BaseController {
 	
 	@Value(value = "${upload.private.path}")
 	private String uploadPrivatePath = null;
+	
+	@Value(value = "${accessKey}")
+	private String accessKey=null;
+	
+	@Value(value = "${accessSecret}")
+	private String accessSecret = null;
 
 	protected Error buildError(String key) {
 		return buildError(key, null);
@@ -82,5 +88,7 @@ public class BaseController {
 		model.addAttribute("uploadPath",uploadPath);
 		model.addAttribute("uploadPrivatePath",uploadPrivatePath);
 		model.addAttribute("userData",TokenManager.getToken());
+		model.addAttribute("accessKey",accessKey);
+		model.addAttribute("accessSecret",accessSecret);
 	}
 }

+ 147 - 87
src/main/java/com/goafanti/common/controller/PublicController.java

@@ -1,14 +1,19 @@
 package com.goafanti.common.controller;
 
-import java.util.HashMap;
-import java.util.Map;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.http.HttpResponse;
-import org.apache.http.util.EntityUtils;
-import org.junit.Test;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Scope;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -25,19 +30,29 @@ import com.aliyuncs.sms.model.v20160927.SingleSendSmsRequest;
 import com.aliyuncs.sms.model.v20160927.SingleSendSmsResponse;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
-import com.goafanti.common.utils.HttpUtils;
 import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.TimeUtils;
 import com.goafanti.common.utils.VerifyCodeUtils;
 import com.goafanti.core.shiro.token.TokenManager;
 
-
-
 @Controller
 @Scope(value = "prototype")
 @RequestMapping("/open")
 public class PublicController extends BaseController {
-	
+	@Value(value = "${accessKey}")
+	private String	accessKey			= null;
+
+	@Value(value = "${accessSecret}")
+	private String	accessSecret		= null;
+
+	@Value(value = "${upload.path}")
+	private String	uploadPath			= null;
+
+	@Value(value = "${upload.private.path}")
+	private String	uploadPrivatePath	= null;
+
+	@Value(value = "${static.host}")
+	private String	staticHost			= null;
 
 	/**
 	 * 获取验证码
@@ -64,104 +79,149 @@ public class PublicController extends BaseController {
 			LoggerUtils.fmtError(getClass(), e, "获取验证码异常:%s", e.getMessage());
 		}
 	}
-	
+
 	/**
 	 * 手机验证码
+	 * 
 	 * @param mobile
 	 */
 	@RequestMapping(value = "/getMCode", method = RequestMethod.GET)
 	@ResponseBody
-	public Result getMcode(String mobile){
+	public Result getMcode(String mobile) {
 		Result res = new Result();
-		if(TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE_TIME)==null
-		   ||TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE_TIME)==""){
-		   sendMessage(mobile,res);
-		}else if(TimeUtils.checkOverTime("getMCode")){
+		if (TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE_TIME) == null
+				|| TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE_TIME) == "") {
+			sendMessage(mobile, res);
+		} else if (TimeUtils.checkOverTime("getMCode")) {
 			TokenManager.getSession().removeAttribute(VerifyCodeUtils.M_CODE);
 			TokenManager.getSession().removeAttribute(VerifyCodeUtils.M_CODE_TIME);
-			sendMessage(mobile,res);
-		}else{
-			res.getError().add(buildError(ErrorConstants.MCODE_ERROR,"手机验证码发送频繁"));
+			sendMessage(mobile, res);
+		} else {
+			res.getError().add(buildError(ErrorConstants.MCODE_ERROR, "手机验证码发送频繁"));
 		}
 		return res;
 	}
+
 	/**
-	 * 阿里云短信服务
+	 * 
 	 * @param mobile
 	 * @param res
 	 * @return
-	 *//*
-	private   Result sendMessage(String mobile,Result res){
+	 */
+	private Result sendMessage(String mobile, Result res) {
 		// 生成随机字串
 		String mobileVerifyCode = VerifyCodeUtils.generateMobileVerifyCode(6);
 		// 存入Shiro会话session
-	    TokenManager.setVal2Session(VerifyCodeUtils.M_CODE, mobileVerifyCode);
-	    TokenManager.setVal2Session(VerifyCodeUtils.M_CODE_TIME, System.currentTimeMillis());
-		
-		String host = "http://sms.market.alicloudapi.com";
-        String path = "/singleSendSms";
-        String method = "GET";
-        Map<String, String> headers = new HashMap<String, String>();
-        headers.put("Authorization", "APPCODE 8e5441493d01490889d034d8456b23db");
-        Map<String, String> querys = new HashMap<String, String>();
-        querys.put("ParamString", "{\"code\":\""+mobileVerifyCode+"\"}");
-        querys.put("RecNum", mobile);
-        querys.put("SignName", "阿凡提信息科技");
-        querys.put("TemplateCode", "SMS_37125144");
-      
-        try {
-        	HttpResponse response =HttpUtils.doGet(host, path, method, headers, querys);
-            //HttpResponse response = HttpUtils.doGet(host, path, method, headers, querys);
-            //System.out.println(response.toString());
-            //获取response的body
-            System.out.println(EntityUtils.toString(response.getEntity()));
-        } catch (Exception e) {
-        	res.getError().add(buildError(ErrorConstants.MCODE_ERROR,"获取手机验证码异常"));
-        	LoggerUtils.fmtError(getClass(), e, "获取手机验证码异常:%s", e.getMessage());
-        }
-        return res;
-	}*/
-	 
-	 /**
-	  * 
-	  * @param mobile
-	  * @param res
-	  * @return
-	  */
-	 private Result sendMessage(String mobile,Result res) {  
-		// 生成随机字串
-			String mobileVerifyCode = VerifyCodeUtils.generateMobileVerifyCode(6);
-			// 存入Shiro会话session
-		    TokenManager.setVal2Session(VerifyCodeUtils.M_CODE, mobileVerifyCode);
-		    System.out.println(TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE));
-		    TokenManager.setVal2Session(VerifyCodeUtils.M_CODE_TIME, System.currentTimeMillis());
-	        IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", "LTAIqTgQLLwz252Z", "ICGuiUnqzaar7urw4zecVcJrJ1MHg9");
-	         try {
-				DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Sms",  "sms.aliyuncs.com");
-			} catch (ClientException e1) {
-				res.getError().add(buildError(ErrorConstants.MCODE_ERROR,"获取手机验证码异常"));
+		TokenManager.setVal2Session(VerifyCodeUtils.M_CODE, mobileVerifyCode);
+		System.out.println(TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE));
+		TokenManager.setVal2Session(VerifyCodeUtils.M_CODE_TIME, System.currentTimeMillis());
+		IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKey, accessSecret);
+		try {
+			DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Sms", "sms.aliyuncs.com");
+		} catch (ClientException e1) {
+			res.getError().add(buildError(ErrorConstants.MCODE_ERROR, "获取手机验证码异常"));
+		}
+		IAcsClient client = new DefaultAcsClient(profile);
+		SingleSendSmsRequest request = new SingleSendSmsRequest();
+		try {
+			request.setSignName("阿凡提信息科技");// {\"code\":\""+mobileVerifyCode+"\"}
+			request.setTemplateCode("SMS_37845022");
+			request.setParamString("{\"code\":\"" + mobileVerifyCode + "\",\"product\":\"阿凡提信息科技\"}");
+			request.setRecNum(mobile);
+			SingleSendSmsResponse httpResponse = client.getAcsResponse(request);
+		} catch (ServerException e) {
+			// e.printStackTrace();
+			res.getError().add(buildError(ErrorConstants.MCODE_ERROR, "获取手机验证码异常"));
+			LoggerUtils.fmtError(getClass(), e, "服务器端手机验证码异常:%s", e.getMessage());
+		} catch (ClientException e) {
+			// e.printStackTrace();
+			res.getError().add(buildError(ErrorConstants.MCODE_ERROR, "获取手机验证码异常"));
+			LoggerUtils.fmtError(getClass(), e, "客户端手机验证码异常:%s", e.getMessage());
+		}
+		return res;
+	}
+
+	@RequestMapping(value = "/downLoadPicture", method = RequestMethod.POST)
+	public void downLoadPicture(HttpServletResponse response, String path, HttpServletRequest request,
+			boolean isPrivate) {
+		String filename = (path.split("/")[(path.split("/").length - 1)]).split(".")[0];
+		response.setHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", filename));
+
+		// 设置文件MIME类型
+		response.setContentType("multipart/form-data");
+		/*
+		 * 解决各浏览器的中文乱码问题
+		 */
+		String userAgent = request.getHeader("User-Agent");
+		InputStream in = null;
+		OutputStream out = null;
+		int connectTimeout = 30 * 1000; // 连接超时:30s
+		int readTimeout = 1 * 1000 * 1000; // IO超时:1min
+		byte[] buffer = new byte[8 * 1024]; // IO缓冲区:8KB
+		String fileSaveRootPath = "";
+
+		try {
+
+			if (isPrivate) {
+				fileSaveRootPath = uploadPrivatePath + path;
+				File file = new File(fileSaveRootPath);
+				in = new FileInputStream(file);
+			} else {
+				fileSaveRootPath =" http://"+ staticHost + "upload" + path;
+				URL url = new URL(fileSaveRootPath);
+				URLConnection conn = url.openConnection();
+				conn.setConnectTimeout(connectTimeout);
+				conn.setReadTimeout(readTimeout);
+				conn.connect();
+				in = conn.getInputStream();
+			}
+			out = response.getOutputStream();
+			// 设置文件MIME类型
+			response.setContentType("multipart/form-data");
+			/*
+			 * 解决各浏览器的中文乱码问题
+			 */
+			userAgent = request.getHeader("User-Agent");
+			byte[] bytes1 = userAgent.contains("MSIE") ? filename.getBytes() : filename.getBytes("UTF-8"); // fileName.getBytes("UTF-8")处理safari的乱码问题
+			filename = new String(bytes1, "ISO-8859-1"); // 各浏览器基本都支持ISO编码
+			response.setHeader("Content-Disposition", String.format("attachment; filename=\"%s\"", filename));
+			for (;;) {
+				int bytes = in.read(buffer);
+				if (bytes == -1) {
+					break;
+				}
+				out.write(buffer, 0, bytes);
+			}
+		} catch (MalformedURLException e) {
+			LoggerUtils.fmtError(getClass(), e, "URL协议、格式或者路径错误:%s", e.getMessage());
+		} catch (FileNotFoundException e) {
+			LoggerUtils.fmtError(getClass(), e, "文件未找到:%s", e.getMessage());
+		} catch (IOException e) {
+			LoggerUtils.fmtError(getClass(), e, "IO错误:%s", e.getMessage());
+		} finally {
+			try {
+				in.close();
+			} catch (IOException e) {
+				LoggerUtils.fmtError(getClass(), e, "IO错误:%s", e.getMessage());
 			}
-	        IAcsClient client = new DefaultAcsClient(profile);
-	        SingleSendSmsRequest request = new SingleSendSmsRequest();
-	        try {
-	            request.setSignName("阿凡提信息科技");//{\"code\":\""+mobileVerifyCode+"\"}
-	             request.setTemplateCode("SMS_37845022");
-	            request.setParamString("{\"code\":\""+mobileVerifyCode+"\",\"product\":\"阿凡提信息科技\"}");
-	            request.setRecNum(mobile);
-	            SingleSendSmsResponse httpResponse = client.getAcsResponse(request);
-	        } catch (ServerException e) {
-	            //e.printStackTrace();
-	        	res.getError().add(buildError(ErrorConstants.MCODE_ERROR,"获取手机验证码异常"));
-	        	LoggerUtils.fmtError(getClass(), e, "服务器端手机验证码异常:%s", e.getMessage());
-	        }
-	        catch (ClientException e) {
-	            //e.printStackTrace();
-	        	res.getError().add(buildError(ErrorConstants.MCODE_ERROR,"获取手机验证码异常"));
-	            LoggerUtils.fmtError(getClass(), e, "客户端手机验证码异常:%s", e.getMessage());
-	        }
-	        return res;
-	    }
-	 
+			try {
+				out.close();
+			} catch (IOException e) {
+				LoggerUtils.fmtError(getClass(), e, "IO错误:%s", e.getMessage());
+			}
+		}
+	}
 	
+	@RequestMapping(value = "/deleteUploadPicture", method = RequestMethod.POST)
+	public boolean deleteUploadPicture(String path){
+		boolean flag = false;  
+	   File file = new File(path);  
+	    // 判断目录或文件是否存在  
+	    if (!file.exists()||!file.isFile()) {  // 不存在返回 false  
+	        return flag;  
+	    } else {  
+	        return file.delete();  
+	    }  
+	}
 
 }

+ 4 - 16
src/main/java/com/goafanti/common/mapper/OrganizationIdentityMapper.xml

@@ -9,7 +9,6 @@
     <result column="qq" property="qq" jdbcType="VARCHAR" />
     <result column="postal_address" property="postalAddress" jdbcType="VARCHAR" />
     <result column="postcode" property="postcode" jdbcType="VARCHAR" />
-    <result column="legal_person" property="legalPerson" jdbcType="VARCHAR" />
   </resultMap>
   
   <resultMap type="com.goafanti.user.bo.OrgIdentityBo" id="OrgIdentityBoMap">
@@ -20,12 +19,11 @@
     <result column="qq" property="qq" jdbcType="VARCHAR" />
     <result column="postal_address" property="postalAddress" jdbcType="VARCHAR" />
     <result column="postcode" property="postcode" jdbcType="VARCHAR" />
-    <result column="legal_person" property="legalPerson" jdbcType="VARCHAR" />
     <result column="email" property="email" jdbcType="VARCHAR" />
   </resultMap>
   
   <sql id="Base_Column_List" >
-    id, uid, contacts, fixed_tel, qq, postal_address, postcode ,legal_Person
+    id, uid, contacts, fixed_tel, qq, postal_address, postcode 
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
     select 
@@ -40,10 +38,10 @@
   <insert id="insert" parameterType="com.goafanti.common.model.OrganizationIdentity" >
     insert into organization_identity (id, uid, contacts, 
       fixed_tel, qq, postal_address, 
-      postcode, legal_person)
+      postcode)
     values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{contacts,jdbcType=VARCHAR}, 
       #{fixedTel,jdbcType=VARCHAR}, #{qq,jdbcType=VARCHAR}, #{postalAddress,jdbcType=VARCHAR}, 
-      #{postcode,jdbcType=VARCHAR}, #{legalPerson,jdbcType=VARCHAR})
+      #{postcode,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.OrganizationIdentity" >
     insert into organization_identity
@@ -69,9 +67,6 @@
       <if test="postcode != null" >
         postcode,
       </if>
-      <if test="legalPerson != null" >
-        legal_person,
-      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides="," >
       <if test="id != null" >
@@ -95,9 +90,6 @@
       <if test="postcode != null" >
         #{postcode,jdbcType=VARCHAR},
       </if>
-      <if test="legalPerson != null" >
-        #{legalPerson,jdbcType=VARCHAR},
-      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.OrganizationIdentity" >
@@ -121,9 +113,6 @@
       <if test="postcode != null" >
         postcode = #{postcode,jdbcType=VARCHAR},
       </if>
-      <if test="legalPerson != null" >
-        legal_person = #{legalPerson,jdbcType=VARCHAR},
-      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -135,7 +124,6 @@
       qq = #{qq,jdbcType=VARCHAR},
       postal_address = #{postalAddress,jdbcType=VARCHAR},
       postcode = #{postcode,jdbcType=VARCHAR}
-      legal_person = #{legalPerson,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
   
@@ -148,7 +136,7 @@
   
    
   <select id="selectOrgIdentityBoByUserId" parameterType="java.lang.String" resultMap="OrgIdentityBoMap">
-  	select t.id,t.uid,t.contacts,t.fixed_tel,t.qq,t.postal_address,t.postcode,t.legal_person,
+  	select t.id,t.uid,t.contacts,t.fixed_tel,t.qq,t.postal_address,t.postcode,
     u.email from user u LEFT JOIN organization_identity t
     on t.uid = u.id where t.uid=#{uid,jdbcType=VARCHAR}
   </select>

+ 14 - 3
src/main/java/com/goafanti/common/mapper/OrganizationInfoMapper.xml

@@ -6,6 +6,7 @@
     <result column="uid" property="uid" jdbcType="VARCHAR" />
     <result column="identity_type" property="identityType" jdbcType="VARCHAR" />
     <result column="company_name" property="companyName" jdbcType="VARCHAR" />
+    <result column="legal_person" property="legalPerson" jdbcType="VARCHAR"/>
     <result column="location_province" property="locationProvince" jdbcType="VARCHAR" />
     <result column="location_city" property="locationCity" jdbcType="VARCHAR" />
     <result column="location_area" property="locationArea" jdbcType="VARCHAR" />
@@ -16,7 +17,7 @@
     <result column="publicity_picture_url" property="publicityPictureUrl" jdbcType="VARCHAR" />
   </resultMap>
   <sql id="Base_Column_List" >
-    id, uid, identity_type, company_name, location_province, location_city,location_area,
+    id, uid, identity_type, company_name, legal_person,location_province, location_city,location_area,
     unit_size, company_introduction, 
     home_unit,  logo_url, publicity_picture_url
   </sql>
@@ -32,12 +33,12 @@
   </delete>
   <insert id="insert" parameterType="com.goafanti.common.model.OrganizationInfo" >
     insert into organization_info (id, uid, identity_type, 
-      company_name, location_province, location_city,location_area,
+      company_name, legal_person,location_province, location_city,location_area,
       unit_size, 
       company_introduction, home_unit,  
       logo_url, publicity_picture_url)
     values (#{id,jdbcType=VARCHAR}, #{uid,jdbcType=VARCHAR}, #{identityType,jdbcType=VARCHAR}, 
-      #{companyName,jdbcType=VARCHAR}, 
+      #{companyName,jdbcType=VARCHAR}, #{legalPerson,jdbcType=VARCHAR},
       #{locationProvince,jdbcType=VARCHAR}, #{locationCity,jdbcType=VARCHAR}, #{locationArea,jdbcType=VARCHAR}, 
       #{unitSize,jdbcType=VARCHAR}, 
       #{companyIntroduction,jdbcType=VARCHAR}, #{homeUnit,jdbcType=VARCHAR},  
@@ -58,6 +59,9 @@
       <if test="companyName != null" >
         company_name,
       </if>
+      <if test="legalPerson != null" >
+        legal_person,
+      </if>
       <if test="locationProvince != null" >
         location_province,
       </if>
@@ -96,6 +100,9 @@
       <if test="companyName != null" >
         #{companyName,jdbcType=VARCHAR},
       </if>
+      <if test="legalPerson != null" >
+        #{legalPerson,jdbcType=VARCHAR},
+      </if>
       <if test="locationProvince != null" >
         #{locationProvince,jdbcType=VARCHAR},
       </if>
@@ -134,6 +141,9 @@
       <if test="companyName != null" >
         company_name = #{companyName,jdbcType=VARCHAR},
       </if>
+      <if test="legalPerson != null" >
+         legal_person = #{legalPerson,jdbcType=VARCHAR},
+      </if>
        <if test="locationProvince != null" >
        location_Province =  #{locationProvince,jdbcType=VARCHAR},
       </if>
@@ -166,6 +176,7 @@
     set uid = #{uid,jdbcType=VARCHAR},
       identity_type = #{identityType,jdbcType=VARCHAR},
       company_name = #{companyName,jdbcType=VARCHAR},
+      legal_person = #{legalPerson,jdbcType=VARCHAR},
       location_province = #{locationProvince,jdbcType=VARCHAR},
       location_city = #{locationCity,jdbcType=VARCHAR},
       location_area = #{locationArea,jdbcType=VARCHAR},

+ 1 - 1
src/main/java/com/goafanti/common/mapper/UserAbilityMapper.xml

@@ -69,7 +69,7 @@
     where id = #{id,jdbcType=VARCHAR}
   </update>
   
-  <select id="selectUserAbilityByUserId" parameterType="java.lang.String" resultType="com.goafanti.common.model.UserAbility">
+  <select id="selectUserAbilityByUserId" parameterType="java.lang.String" resultMap="BaseResultMap">
   	 select 
     <include refid="Base_Column_List" />
     from user_ability

+ 1 - 1
src/main/java/com/goafanti/common/mapper/UserInfoMapper.xml

@@ -230,7 +230,7 @@
   	t.person_portrait_url,t.life_photo_url,t.personal_profile,t.fixed_tel_area,t.fixed_tel,t.fixed_tel_extension,
   	t.qq,t.postal_address,t.postcode,
     u.email,u.nickname from user u 
-    left JOIN user_Info t
+    left JOIN user_info t
     on t.uid = u.id where t.uid = #{uid,jdbcType=VARCHAR}
    
   </select>

+ 1 - 11
src/main/java/com/goafanti/common/model/OrganizationIdentity.java

@@ -30,10 +30,7 @@ public class OrganizationIdentity {
     */
     private String postcode;
     
-    /**
-     * 法人
-     */
-    private String legalPerson;
+   
 
     public String getId() {
         return id;
@@ -91,12 +88,5 @@ public class OrganizationIdentity {
         this.postcode = postcode;
     }
 
-	public String getLegalPerson() {
-		return legalPerson;
-	}
-
-	public void setLegalPerson(String legalPerson) {
-		this.legalPerson = legalPerson;
-	}
     
 }

+ 16 - 1
src/main/java/com/goafanti/common/model/OrganizationInfo.java

@@ -14,8 +14,15 @@ public class OrganizationInfo {
     * 公司名称
     */
     private String companyName;
-
+    
     /**
+     * 法人
+     */
+    private String legalPerson;
+
+   
+
+	/**
     * 所在地--省
     */
     private String locationProvince;
@@ -87,6 +94,14 @@ public class OrganizationInfo {
     public void setCompanyName(String companyName) {
         this.companyName = companyName;
     }
+    
+    public String getLegalPerson() {
+		return legalPerson;
+	}
+
+	public void setLegalPerson(String legalPerson) {
+		this.legalPerson = legalPerson;
+	}
 
 
     public String getLocationProvince() {

+ 0 - 312
src/main/java/com/goafanti/common/utils/HttpUtils.java

@@ -1,312 +0,0 @@
-package com.goafanti.common.utils;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.http.HttpResponse;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpPut;
-import org.apache.http.conn.ClientConnectionManager;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.conn.ssl.SSLSocketFactory;
-import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.message.BasicNameValuePair;
-
-public class HttpUtils {
-	
-	/**
-	 * get
-	 * 
-	 * @param host
-	 * @param path
-	 * @param method
-	 * @param headers
-	 * @param querys
-	 * @return
-	 * @throws Exception
-	 */
-	public static HttpResponse doGet(String host, String path, String method, 
-			Map<String, String> headers, 
-			Map<String, String> querys)
-            throws Exception {    	
-    	HttpClient httpClient = wrapClient(host);
-
-    	HttpGet request = new HttpGet(buildUrl(host, path, querys));
-        for (Map.Entry<String, String> e : headers.entrySet()) {
-        	request.addHeader(e.getKey(), e.getValue());
-        }
-        
-        return httpClient.execute(request);
-    }
-	
-	/**
-	 * post form
-	 * 
-	 * @param host
-	 * @param path
-	 * @param method
-	 * @param headers
-	 * @param querys
-	 * @param bodys
-	 * @return
-	 * @throws Exception
-	 */
-	public static HttpResponse doPost(String host, String path, String method, 
-			Map<String, String> headers, 
-			Map<String, String> querys, 
-			Map<String, String> bodys)
-            throws Exception {    	
-    	HttpClient httpClient = wrapClient(host);
-
-    	HttpPost request = new HttpPost(buildUrl(host, path, querys));
-        for (Map.Entry<String, String> e : headers.entrySet()) {
-        	request.addHeader(e.getKey(), e.getValue());
-        }
-
-        if (bodys != null) {
-            List<NameValuePair> nameValuePairList = new ArrayList<NameValuePair>();
-
-            for (String key : bodys.keySet()) {
-                nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
-            }
-            UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
-            formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
-            request.setEntity(formEntity);
-        }
-
-        return httpClient.execute(request);
-    }	
-	
-	/**
-	 * Post String
-	 * 
-	 * @param host
-	 * @param path
-	 * @param method
-	 * @param headers
-	 * @param querys
-	 * @param body
-	 * @return
-	 * @throws Exception
-	 */
-	public static HttpResponse doPost(String host, String path, String method, 
-			Map<String, String> headers, 
-			Map<String, String> querys, 
-			String body)
-            throws Exception {    	
-    	HttpClient httpClient = wrapClient(host);
-
-    	HttpPost request = new HttpPost(buildUrl(host, path, querys));
-        for (Map.Entry<String, String> e : headers.entrySet()) {
-        	request.addHeader(e.getKey(), e.getValue());
-        }
-
-        if (StringUtils.isNotBlank(body)) {
-        	request.setEntity(new StringEntity(body, "utf-8"));
-        }
-
-        return httpClient.execute(request);
-    }
-	
-	/**
-	 * Post stream
-	 * 
-	 * @param host
-	 * @param path
-	 * @param method
-	 * @param headers
-	 * @param querys
-	 * @param body
-	 * @return
-	 * @throws Exception
-	 */
-	public static HttpResponse doPost(String host, String path, String method, 
-			Map<String, String> headers, 
-			Map<String, String> querys, 
-			byte[] body)
-            throws Exception {    	
-    	HttpClient httpClient = wrapClient(host);
-
-    	HttpPost request = new HttpPost(buildUrl(host, path, querys));
-        for (Map.Entry<String, String> e : headers.entrySet()) {
-        	request.addHeader(e.getKey(), e.getValue());
-        }
-
-        if (body != null) {
-        	request.setEntity(new ByteArrayEntity(body));
-        }
-
-        return httpClient.execute(request);
-    }
-	
-	/**
-	 * Put String
-	 * @param host
-	 * @param path
-	 * @param method
-	 * @param headers
-	 * @param querys
-	 * @param body
-	 * @return
-	 * @throws Exception
-	 */
-	public static HttpResponse doPut(String host, String path, String method, 
-			Map<String, String> headers, 
-			Map<String, String> querys, 
-			String body)
-            throws Exception {    	
-    	HttpClient httpClient = wrapClient(host);
-
-    	HttpPut request = new HttpPut(buildUrl(host, path, querys));
-        for (Map.Entry<String, String> e : headers.entrySet()) {
-        	request.addHeader(e.getKey(), e.getValue());
-        }
-
-        if (StringUtils.isNotBlank(body)) {
-        	request.setEntity(new StringEntity(body, "utf-8"));
-        }
-
-        return httpClient.execute(request);
-    }
-	
-	/**
-	 * Put stream
-	 * @param host
-	 * @param path
-	 * @param method
-	 * @param headers
-	 * @param querys
-	 * @param body
-	 * @return
-	 * @throws Exception
-	 */
-	public static HttpResponse doPut(String host, String path, String method, 
-			Map<String, String> headers, 
-			Map<String, String> querys, 
-			byte[] body)
-            throws Exception {    	
-    	HttpClient httpClient = wrapClient(host);
-
-    	HttpPut request = new HttpPut(buildUrl(host, path, querys));
-        for (Map.Entry<String, String> e : headers.entrySet()) {
-        	request.addHeader(e.getKey(), e.getValue());
-        }
-
-        if (body != null) {
-        	request.setEntity(new ByteArrayEntity(body));
-        }
-
-        return httpClient.execute(request);
-    }
-	
-	/**
-	 * Delete
-	 *  
-	 * @param host
-	 * @param path
-	 * @param method
-	 * @param headers
-	 * @param querys
-	 * @return
-	 * @throws Exception
-	 */
-	public static HttpResponse doDelete(String host, String path, String method, 
-			Map<String, String> headers, 
-			Map<String, String> querys)
-            throws Exception {    	
-    	HttpClient httpClient = wrapClient(host);
-
-    	HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
-        for (Map.Entry<String, String> e : headers.entrySet()) {
-        	request.addHeader(e.getKey(), e.getValue());
-        }
-        
-        return httpClient.execute(request);
-    }
-	
-	private static String buildUrl(String host, String path, Map<String, String> querys) throws UnsupportedEncodingException {
-    	StringBuilder sbUrl = new StringBuilder();
-    	sbUrl.append(host);
-    	if (!StringUtils.isBlank(path)) {
-    		sbUrl.append(path);
-        }
-    	if (null != querys) {
-    		StringBuilder sbQuery = new StringBuilder();
-        	for (Map.Entry<String, String> query : querys.entrySet()) {
-        		if (0 < sbQuery.length()) {
-        			sbQuery.append("&");
-        		}
-        		if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
-        			sbQuery.append(query.getValue());
-                }
-        		if (!StringUtils.isBlank(query.getKey())) {
-        			sbQuery.append(query.getKey());
-        			if (!StringUtils.isBlank(query.getValue())) {
-        				sbQuery.append("=");
-        				sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
-        			}        			
-                }
-        	}
-        	if (0 < sbQuery.length()) {
-        		sbUrl.append("?").append(sbQuery);
-        	}
-        }
-    	
-    	return sbUrl.toString();
-    }
-	
-	private static HttpClient wrapClient(String host) {
-		HttpClient httpClient = new DefaultHttpClient();
-		if (host.startsWith("https://")) {
-			sslClient(httpClient);
-		}
-		
-		return httpClient;
-	}
-	
-	private static void sslClient(HttpClient httpClient) {
-        try {
-            SSLContext ctx = SSLContext.getInstance("TLS");
-            X509TrustManager tm = new X509TrustManager() {
-                public X509Certificate[] getAcceptedIssuers() {
-                    return null;
-                }
-                public void checkClientTrusted(X509Certificate[] xcs, String str) {
-                	
-                }
-                public void checkServerTrusted(X509Certificate[] xcs, String str) {
-                	
-                }
-            };
-            ctx.init(null, new TrustManager[] { tm }, null);
-            SSLSocketFactory ssf = new SSLSocketFactory(ctx);
-            ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
-            ClientConnectionManager ccm = httpClient.getConnectionManager();
-            SchemeRegistry registry = ccm.getSchemeRegistry();
-            registry.register(new Scheme("https", 443, ssf));
-        } catch (KeyManagementException ex) {
-            throw new RuntimeException(ex);
-        } catch (NoSuchAlgorithmException ex) {
-        	throw new RuntimeException(ex);
-        }
-	}
-}

+ 5 - 0
src/main/java/com/goafanti/user/bo/OrgProBo.java

@@ -7,6 +7,11 @@ public class OrgProBo {
       private OrganizationInfo info;
       private OrganizationProperties pro;
       
+    public OrgProBo(OrganizationInfo info,OrganizationProperties pro){
+    	this.info = info;
+    	this.pro =pro;
+    }
+      
 	public OrganizationInfo getInfo() {
 		return info;
 	}

+ 219 - 191
src/main/java/com/goafanti/user/controller/UserApiController.java

@@ -1,6 +1,5 @@
 package com.goafanti.user.controller;
 
-
 import java.io.IOException;
 import java.util.List;
 import java.util.UUID;
@@ -8,7 +7,8 @@ import java.util.UUID;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shiro.SecurityUtils;
 import org.springframework.stereotype.Controller;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -49,45 +49,43 @@ import com.goafanti.user.service.UserIdentityService;
 import com.goafanti.user.service.UserInfoService;
 import com.goafanti.user.service.UserService;
 
-
-
 @Controller
 @RequestMapping(value = "/api/user")
 public class UserApiController extends BaseApiController {
 	@Resource
-	private UserService userService;
+	private UserService						userService;
 	@Resource(name = "passwordUtil")
-	private PasswordUtil passwordUtil;
-	
+	private PasswordUtil					passwordUtil;
+
 	@Resource
-	private UserIdentityService userIdentityService;
+	private UserIdentityService				userIdentityService;
 	@Resource
-	private UserInfoService userInfoService;
+	private UserInfoService					userInfoService;
 	@Resource
-	private UserEduService userEduService;
+	private UserEduService					userEduService;
 	@Resource
-	private UserCareerService userCareerService;
+	private UserCareerService				userCareerService;
 	@Resource
-	private UserAbilityService userAbilityService;
+	private UserAbilityService				userAbilityService;
 	@Resource
-	private OrganizationIdentityService organizationIdentityService;
+	private OrganizationIdentityService		organizationIdentityService;
 	@Resource
-	private OrganizationInfoService organizationInfoService;
+	private OrganizationInfoService			organizationInfoService;
 	@Resource
-	private OrganizationTechService organizationTechService;
+	private OrganizationTechService			organizationTechService;
 	@Resource
-	private OrganizationPropertiesService organizationPropertiesService;
-	
+	private OrganizationPropertiesService	organizationPropertiesService;
+
 	@RequestMapping(value = "/pwd", method = RequestMethod.POST)
 	public Result updatePwd(String password, String newPassword) {
 		Result res = new Result();
 		if (password == null || newPassword == null) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "必须指定", "密码"));
 		}
-		if (password.equals(newPassword)){
-			res.getError().add(buildError(ErrorConstants.PWD_SAME_ERROR,"新密码必须与原密码不同!"));
+		if (password.equals(newPassword)) {
+			res.getError().add(buildError(ErrorConstants.PWD_SAME_ERROR, "新密码必须与原密码不同!"));
 		}
-		
+
 		if (res.getError().isEmpty() && TokenManager.isLogin()) {
 			User u = new User();
 			User user = userService.selectByPrimaryKey(TokenManager.getUserId());
@@ -103,62 +101,64 @@ public class UserApiController extends BaseApiController {
 		}
 		return res;
 	}
-	
+
 	/**
 	 * 更换手机
+	 * 
 	 * @param mobile
 	 * @param mobileCode
 	 * @return
 	 */
-	@RequestMapping(value="/mobile" ,method=RequestMethod.POST)
-	public Result updateMobile(String mobile,String mobileCode){
+	@RequestMapping(value = "/mobile", method = RequestMethod.POST)
+	public Result updateMobile(String mobile, String mobileCode) {
 		Result res = new Result();
-		if(StringUtils.isBlank(mobile)){
-			res.getError().add(buildError(ErrorConstants.MOBILE_EMPTY_ERROR,"手机号不能为空!"));
+		if (StringUtils.isBlank(mobile)) {
+			res.getError().add(buildError(ErrorConstants.MOBILE_EMPTY_ERROR, "手机号不能为空!"));
 			return res;
 		}
-		//验证码15分钟有效
-		if(TimeUtils.checkOverTime("register")){
-			res.getError().add(buildError(ErrorConstants.MCODE_OVERTIME_ERROR,"手机验证码超时失效"));
+		// 验证码15分钟有效
+		if (TimeUtils.checkOverTime("register")) {
+			res.getError().add(buildError(ErrorConstants.MCODE_OVERTIME_ERROR, "手机验证码超时失效"));
 			return res;
 		}
-		if(!TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE).equals(mobileCode)){
-			res.getError().add(buildError(ErrorConstants.MCODE_ERROR,"手机验证码错误"));					
+		if (!TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE).equals(mobileCode)) {
+			res.getError().add(buildError(ErrorConstants.MCODE_ERROR, "手机验证码错误"));
 			return res;
 		}
 		User user = userService.selectByPrimaryKey(TokenManager.getUserId());
-		if(mobile.equals(user.getMobile())){
-			res.getError().add(buildError(ErrorConstants.MOBILE_SAME_ERROR,"新手机号必须和原手机号不同!"));
+		if (mobile.equals(user.getMobile())) {
+			res.getError().add(buildError(ErrorConstants.MOBILE_SAME_ERROR, "新手机号必须和原手机号不同!"));
 			return res;
 		}
-		if(res.getError().isEmpty() && TokenManager.isLogin()){
+		if (res.getError().isEmpty() && TokenManager.isLogin()) {
 			user.setMobile(mobile);
 			res.setData(userService.updateByPrimaryKey(user));
 		}
 		return res;
 	}
-	
+
 	/**
 	 * 个人会员基本信息
+	 * 
 	 * @param userIdentity
 	 * @param bindingResult
 	 * @return
 	 */
 	@RequestMapping(value = "/userIndentity", method = RequestMethod.POST)
-	public Result basicInfo(UserIdentity userIdentity,BindingResult bindingResult){
+	public Result basicInfo(UserIdentity userIdentity, BindingResult bindingResult) {
 		Result res = new Result();
 		if (bindingResult.hasErrors()) {
 			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
 					bindingResult.getFieldError().getField()));
 			return res;
 		}
-		if(res.getError().isEmpty()){
-			UserIdentity identity= userIdentityService.selectUserIdentityByUserId(TokenManager.getUserId());
-			if(identity == null){
+		if (res.getError().isEmpty()) {
+			UserIdentity identity = userIdentityService.selectUserIdentityByUserId(TokenManager.getUserId());
+			if (identity == null) {
 				userIdentity.setId(UUID.randomUUID().toString());
 				userIdentity.setUid(TokenManager.getUserId());
 				userIdentityService.insert(userIdentity);
-			}else{
+			} else {
 				userIdentity.setId(identity.getId());
 				userIdentityService.updateByPrimaryKeySelective(userIdentity);
 			}
@@ -166,42 +166,55 @@ public class UserApiController extends BaseApiController {
 		res.setData(userIdentity);
 		return res;
 	}
-	
-	
-	@RequestMapping(value = "/avatar/upload", method = RequestMethod.POST)
-	public Result avatar(HttpServletRequest req) {
-		Result res = new Result();
-		res.setData(handleFile(res, "/avatar/", false, req));
-		return res;
-	}
-    
+
 	/**
-	 * 认证
+	 * 公共
+	 * 
 	 * @param req
 	 * @return
-	 */
-	@RequestMapping(value = "/identity/upload", method = RequestMethod.POST)
-	public Result identityFile(HttpServletRequest req) {
-		Result res = new Result();
-		res.setData(handleFile(res, "/identity/", true, req));
-		return res;
+	 */
+	@RequestMapping(value = "/avatar/upload", method = RequestMethod.POST)
+	public Result avatar(HttpServletRequest req) {
+		Result res = new Result();
+		res.setData(handleFile(res, "/avatar/", false, req, ""));
+		return res;
 	}
-	
+
 	/**
-	 * 专利
+	 * 认证
+	 * 
 	 * @param req
 	 * @return
 	 */
-	@RequestMapping(value = "/patent/upload", method = RequestMethod.POST)
-	public Result patentFile(HttpServletRequest req) {
+	@RequestMapping(value = "/identity/upload", method = RequestMethod.POST)
+	public Result identityFile(HttpServletRequest req, String sign) {
 		Result res = new Result();
-		res.setData(handleFile(res, "/patent/", true, req));
+		res.setData(sign);
+		res.setData(handleFile(res, "/identity/", true, req, sign));
 		return res;
 	}
-	
-	private String handleFile(Result res, String path, boolean isPrivate, HttpServletRequest req) {
+
+	/**
+	 * 专利
+	 * 
+	 * @param req
+	 * @return
+	 */
+	/*
+	 * @RequestMapping(value = "/patent/upload", method = RequestMethod.POST)
+	 * public Result patentFile(HttpServletRequest req) { Result res = new
+	 * Result(); res.setData(handleFile(res, "/patent/", true, req)); return
+	 * res; }
+	 */
+
+	private String handleFile(Result res, String path, boolean isPrivate, HttpServletRequest req, String sign) {
 		List<MultipartFile> files = getFiles(req);
-		String fileName = path + System.nanoTime() + ".jpg";
+		String fileName = "";
+		if (isPrivate) {
+			fileName = path + TokenManager.getUserId() + sign + ".jpg";// /identity/12345idcard1.jpg
+		} else {
+			fileName = path + System.nanoTime() + ".jpg";
+		}
 		if (!files.isEmpty()) {
 			try {
 				MultipartFile mf = files.get(0);
@@ -217,315 +230,330 @@ public class UserApiController extends BaseApiController {
 			return "";
 		}
 		return fileName;
-	}
-	
+	}
+
 	/**
 	 * 个人资料
+	 * 
 	 * @param userInfoBo
 	 * @param bindingResult
 	 * @return
 	 */
 	@RequestMapping(value = "/userInfo", method = RequestMethod.POST)
-	public Result personalData(UserInfoBo userInfoBo,BindingResult bindingResult){
+	public Result personalData(UserInfoBo userInfoBo, BindingResult bindingResult) {
 		Result res = new Result();
 		if (bindingResult.hasErrors()) {
 			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
 					bindingResult.getFieldError().getField()));
 			return res;
 		}
-		if(res.getError().isEmpty()){
-		    UserInfo info= userInfoService.selectUserInfoByUserId(TokenManager.getUserId());
-		    User u =userService.selectByPrimaryKey(TokenManager.getUserId());
-		    u.setNickname(userInfoBo.getNickname());
-		    u.setEmail(userInfoBo.getEmail());
-		    userService.updateByPrimaryKeySelective(u);
-		    UserInfo userInfo = new UserInfo();
-		    userInfo.setResidenceProvince(userInfoBo.getResidenceProvince());
-		    userInfo.setResidenceCity(userInfoBo.getResidenceCity());
-		    userInfo.setResidenceArea(userInfoBo.getResidenceArea());
-		    userInfo.setPersonPortraitUrl(userInfoBo.getPersonPortraitUrl());
-		    userInfo.setPersonalProfile(userInfoBo.getPersonalProfile());
-		    userInfo.setLifePhotoUrl(userInfoBo.getLifePhotoUrl());
-		    userInfo.setFixedTelArea(userInfoBo.getFixedTelArea());
-		    userInfo.setFixedTel(userInfoBo.getFixedTel());
-		    userInfo.setFixedTelExtension(userInfoBo.getFixedTelExtension());
-		    userInfo.setQq(userInfoBo.getQq());
-		    userInfo.setPostalAddress(userInfoBo.getPostalAddress());
-		    userInfo.setPostcode(userInfoBo.getPostcode());
-			if(info == null){
+		if (res.getError().isEmpty()) {
+			UserInfo info = userInfoService.selectUserInfoByUserId(TokenManager.getUserId());
+			User u = userService.selectByPrimaryKey(TokenManager.getUserId());
+			u.setNickname(userInfoBo.getNickname());
+			u.setEmail(userInfoBo.getEmail());
+			userService.updateByPrimaryKeySelective(u);
+			TokenManager.getToken().setNickname(userInfoBo.getNickname());
+			UserInfo userInfo = new UserInfo();
+			userInfo.setResidenceProvince(userInfoBo.getResidenceProvince());
+			userInfo.setResidenceCity(userInfoBo.getResidenceCity());
+			userInfo.setResidenceArea(userInfoBo.getResidenceArea());
+			userInfo.setPersonPortraitUrl(userInfoBo.getPersonPortraitUrl());
+			userInfo.setPersonalProfile(userInfoBo.getPersonalProfile());
+			userInfo.setLifePhotoUrl(userInfoBo.getLifePhotoUrl());
+			userInfo.setFixedTelArea(userInfoBo.getFixedTelArea());
+			userInfo.setFixedTel(userInfoBo.getFixedTel());
+			userInfo.setFixedTelExtension(userInfoBo.getFixedTelExtension());
+			userInfo.setQq(userInfoBo.getQq());
+			userInfo.setPostalAddress(userInfoBo.getPostalAddress());
+			userInfo.setPostcode(userInfoBo.getPostcode());
+			if (info == null) {
 				userInfo.setId(UUID.randomUUID().toString());
 				userInfo.setUid(TokenManager.getUserId());
 				userInfoService.insert(userInfo);
-			}else{
+			} else {
 				userInfo.setId(info.getId());
 				userInfoService.updateByPrimaryKeySelective(userInfo);
 			}
-	  }
+		}
 		res.setData(userInfoBo);
 		return res;
 	}
-	
+
 	/**
 	 * 个人会员教育信息
+	 * 
 	 * @param userEdu
 	 * @return
 	 */
 	@RequestMapping(value = "/userEdu", method = RequestMethod.POST)
-	public Result educationInfo(UserEdu userEdu){
+	public Result educationInfo(UserEdu userEdu) {
 		Result res = new Result();
 		UserEdu edu = userEduService.selectUserEduByUserId(TokenManager.getUserId());
-		
-		if(edu == null){
+
+		if (edu == null) {
 			userEdu.setId(UUID.randomUUID().toString());
 			userEdu.setUid(TokenManager.getUserId());
 			userEduService.insert(userEdu);
-		}else{
+		} else {
 			userEdu.setId(edu.getId());
 			userEduService.updateByPrimaryKeySelective(userEdu);
 		}
 		res.setData(userEdu);
 		return res;
 	}
-	
+
 	/**
 	 * 个人会员职业信息
+	 * 
 	 * @param userCareer
 	 * @return
 	 */
-	
+
 	@RequestMapping(value = "/userCareer", method = RequestMethod.POST)
-	public Result careerInfo(UserCareer userCareer){
+	public Result careerInfo(UserCareer userCareer) {
 		Result res = new Result();
 		UserCareer career = userCareerService.selectUserCareerByUserId(TokenManager.getUserId());
-		
-		if(career == null){
+
+		if (career == null) {
 			userCareer.setId(UUID.randomUUID().toString());
 			userCareer.setUid(TokenManager.getUserId());
 			userCareerService.insert(userCareer);
-		}else{
+		} else {
 			userCareer.setId(career.getId());
 			userCareerService.updateByPrimaryKeySelective(userCareer);
 		}
 		res.setData(userCareer);
 		return res;
 	}
-	
+
 	/**
 	 * 会员能力标签
+	 * 
 	 * @param userAbility
 	 * @return
 	 */
-	
+
 	@RequestMapping(value = "/userAbility", method = RequestMethod.POST)
-	public Result abilityLabel(UserAbility userAbility){
+	public Result abilityLabel(UserAbility userAbility) {
 		Result res = new Result();
 		UserAbility ability = userAbilityService.selectUserAbilityByUserId(TokenManager.getUserId());
-				if(ability == null){
-					userAbility.setId(UUID.randomUUID().toString());
-					userAbility.setUid(TokenManager.getUserId());
-					userAbilityService.insert(userAbility);
-				}else{
-					userAbility.setId(ability.getId());
-					userAbilityService.updateByPrimaryKeySelective(userAbility);
-				}
-				res.setData(userAbility);
+		if (ability == null) {
+			userAbility.setId(UUID.randomUUID().toString());
+			userAbility.setUid(TokenManager.getUserId());
+			userAbilityService.insert(userAbility);
+		} else {
+			userAbility.setId(ability.getId());
+			userAbilityService.updateByPrimaryKeySelective(userAbility);
+		}
+		res.setData(userAbility);
 		return res;
 	}
-	
+
 	/**
 	 * 团体会员基本信息
+	 * 
 	 * @param orgIdentityBo
 	 * @return
 	 */
-	@RequestMapping(value="/orgIdentity",method = RequestMethod.POST)
-	public Result groupBasicInfo(OrgIdentityBo orgIdentityBo){
+	@RequestMapping(value = "/orgIdentity", method = RequestMethod.POST)
+	public Result groupBasicInfo(OrgIdentityBo orgIdentityBo) {
 		Result res = new Result();
 		OrganizationIdentity organizationIdentity = new OrganizationIdentity();
 		OrganizationIdentity identity = organizationIdentityService.selectOrgIdentityByUserId(TokenManager.getUserId());
-		User u =userService.selectByPrimaryKey(TokenManager.getUserId());
-	    u.setEmail(orgIdentityBo.getEmail());
-	    userService.updateByPrimaryKeySelective(u);
+		User u = userService.selectByPrimaryKey(TokenManager.getUserId());
+		u.setEmail(orgIdentityBo.getEmail());
+		userService.updateByPrimaryKeySelective(u);
+		TokenManager.getToken().setEmail(orgIdentityBo.getEmail());
 		organizationIdentity.setContacts(orgIdentityBo.getContacts());
 		organizationIdentity.setFixedTel(orgIdentityBo.getFixedTel());
 		organizationIdentity.setQq(orgIdentityBo.getQq());
 		organizationIdentity.setPostalAddress(orgIdentityBo.getPostalAddress());
 		organizationIdentity.setPostcode(orgIdentityBo.getPostcode());
-		organizationIdentity.setLegalPerson(orgIdentityBo.getLegalPerson());
-		if(identity==null){
+		if (identity == null) {
 			organizationIdentity.setId(UUID.randomUUID().toString());
 			organizationIdentity.setUid(TokenManager.getUserId());
 			organizationIdentityService.insert(organizationIdentity);
-		}else{
+		} else {
 			organizationIdentity.setId(identity.getId());
 			organizationIdentityService.updateByPrimaryKeySelective(organizationIdentity);
 		}
 		res.setData(orgIdentityBo);
 		return res;
 	}
-	
+
 	/**
 	 * 团体会员单位资料
+	 * 
 	 * @param orgInfo
 	 * @return
 	 */
-	@RequestMapping(value="/orgPro",method = RequestMethod.POST)
-	public Result groupProInfo(OrgProBo proBo){
+	@RequestMapping(value = "/orgPro", method = RequestMethod.POST)
+	public Result groupProInfo(OrgProBo proBo) {
 		Result res = new Result();
 		OrganizationInfo orgInfo = proBo.getInfo();
 		OrganizationProperties orgPro = proBo.getPro();
 		OrganizationInfo info = organizationInfoService.selectOrgInfoByUserId(TokenManager.getUserId());
 		OrganizationProperties pro = organizationPropertiesService.selectOrgProByUserId(TokenManager.getUserId());
-		 if(info == null){
-			 orgInfo.setId(UUID.randomUUID().toString());
-			 orgInfo.setUid(TokenManager.getUserId());
-			 orgInfo = organizationInfoService.insert(orgInfo);
-		 }else{
-			 orgInfo.setId(info.getId());
-			 organizationInfoService.updateByPrimaryKeySelective(orgInfo);
-		 }
-		 if(pro == null){
-			 orgPro.setId(UUID.randomUUID().toString());
-			 orgPro.setOid(orgInfo.getId());
-			 organizationPropertiesService.insert(orgPro);
-		 }else{
-			 orgPro.setId(pro.getId());
-			 organizationPropertiesService.updateByPrimaryKeySelective(orgPro);
-		 }
-		 res.setData(proBo);
+		if (info == null) {
+			orgInfo.setId(UUID.randomUUID().toString());
+			orgInfo.setUid(TokenManager.getUserId());
+			orgInfo = organizationInfoService.insert(orgInfo);
+		} else {
+			orgInfo.setId(info.getId());
+			organizationInfoService.updateByPrimaryKeySelective(orgInfo);
+		}
+		if (pro == null) {
+			orgPro.setId(UUID.randomUUID().toString());
+			orgPro.setOid(orgInfo.getId());
+			organizationPropertiesService.insert(orgPro);
+		} else {
+			orgPro.setId(pro.getId());
+			organizationPropertiesService.updateByPrimaryKeySelective(orgPro);
+		}
+		res.setData(proBo);
 		return res;
 	}
-	
+
 	/**
 	 * 团体会员技术能力
+	 * 
 	 * @param orgTech
 	 * @return
 	 */
-	@RequestMapping(value="/orgTech",method = RequestMethod.POST)
-	public Result tech(OrganizationTech orgTech){
+	@RequestMapping(value = "/orgTech", method = RequestMethod.POST)
+	public Result tech(OrganizationTech orgTech) {
 		Result res = new Result();
 		OrganizationTech tech = organizationTechService.selectOrgTechByUserId(TokenManager.getUserId());
-		if(tech == null){
+		if (tech == null) {
 			orgTech.setId(UUID.randomUUID().toString());
 			orgTech.setUid(TokenManager.getUserId());
 			organizationTechService.insert(orgTech);
-			
-		}else{
+
+		} else {
 			orgTech.setId(tech.getId());
 			organizationTechService.updateByPrimaryKeySelective(orgTech);
 		}
 		res.setData(orgTech);
 		return res;
 	}
-	
-	
-	
+
 	/**
 	 * 个人会员基本信息/团体会员基本信息
+	 * 
 	 * @return
 	 */
-	@RequestMapping(value="/base",method = RequestMethod.POST)
-	public Result basic(){
+	@RequestMapping(value = "/base", method = RequestMethod.GET)
+	public Result basic() {
 		Result res = new Result();
-		UidAndTypeBo ub =basicInfo(userService);
-		if(ub.getType()==0){
-			UserIdentityBo  u = userIdentityService.selectUserIdentityBoByUserId(ub.getUid());
+		UidAndTypeBo ub = basicInfo(userService);
+		if (ub.getType() == 0) {
+			UserIdentityBo u = userIdentityService.selectUserIdentityBoByUserId(ub.getUid());
 			res.setData(u);
-		}else{
+		} else {
 			OrgIdentityBo o = organizationIdentityService.selectOrgIdentityBoByUserId(ub.getUid());
 			res.setData(o);
 		}
 		return res;
 	}
-	
+
 	/**
 	 * 个人资料/团体会员资料
+	 * 
 	 * @return
 	 */
-	@RequestMapping(value="/member",method = RequestMethod.POST)
-	public Result member(){
+	@RequestMapping(value = "/member", method = RequestMethod.GET)
+	public Result member() {
 		Result res = new Result();
-		UidAndTypeBo ub =basicInfo(userService);
-		if(ub.getType()==0){
-			UserInfoBo u=userInfoService.selectUserInfoBoByUserId(ub.getUid());
+		UidAndTypeBo ub = basicInfo(userService);
+		if (ub.getType() == 0) {
+			UserInfoBo u = userInfoService.selectUserInfoBoByUserId(ub.getUid());
 			res.setData(u);
-		}else{
+		} else {
 			OrganizationInfo o = organizationInfoService.selectOrgInfoByUserId(ub.getUid());
-			res.setData(o);
+			OrganizationProperties p = organizationPropertiesService.selectOrgProByUserId(ub.getUid());
+			OrgProBo bo = new OrgProBo(o, p);
+			res.setData(bo);
 		}
 		return res;
 	}
-	
+
 	/**
 	 * 个人会员教育信息
+	 * 
 	 * @return
 	 */
-	@RequestMapping(value="/educate",method = RequestMethod.POST)
-	public Result educate(){
+	@RequestMapping(value = "/educate", method = RequestMethod.GET)
+	public Result educate() {
 		Result res = new Result();
-		UidAndTypeBo ub =basicInfo(userService);
-			UserEdu  u = userEduService.selectUserEduByUserId(ub.getUid());
-			res.setData(u);
+		UidAndTypeBo ub = basicInfo(userService);
+		UserEdu u = userEduService.selectUserEduByUserId(ub.getUid());
+		res.setData(u);
 		return res;
 	}
-	
+
 	/**
 	 * 个人会员职业信息/团体会员技术能力
+	 * 
 	 * @return
 	 */
-	@RequestMapping(value="/job",method = RequestMethod.POST)
-	public Result job(){
+	@RequestMapping(value = "/job", method = RequestMethod.GET)
+	public Result job() {
 		Result res = new Result();
-		UidAndTypeBo ub =basicInfo(userService);
-		if(ub.getType()==0){
+		UidAndTypeBo ub = basicInfo(userService);
+		if (ub.getType() == 0) {
 			UserCareer u = userCareerService.selectUserCareerByUserId(ub.getUid());
 			res.setData(u);
-		}else{
+		} else {
 			OrganizationTech o = organizationTechService.selectOrgTechByUserId(ub.getUid());
 			res.setData(o);
 		}
 		return res;
 	}
-	
+
 	/**
 	 * 个人/团体能力标签
+	 * 
 	 * @return
 	 */
-	@RequestMapping(value="/ability",method = RequestMethod.POST)
-	public Result ability(){
+	@RequestMapping(value = "/ability", method = RequestMethod.GET)
+	public Result ability() {
 		Result res = new Result();
-		UserAbility u = userAbilityService.selectUserAbilityByUserId(basicInfo(userService).getUid());
+		//UserAbility u = userAbilityService.selectUserAbilityByUserId(basicInfo(userService).getUid());
+		UserAbility u =userAbilityService.selectUserAbilityByUserId("ba00235e-eb3a-45b4-8c9d-000fe507cbca");
 		res.setData(u);
 		return res;
 	}
+
 	
 	
 	
-	private  UidAndTypeBo basicInfo(UserService userService){
+	
+	
+	
+	private UidAndTypeBo basicInfo(UserService userService) {
 		User u = userService.selectByPrimaryKey(TokenManager.getUserId());
 		UidAndTypeBo ub = new UidAndTypeBo();
-		
+
 		ub.setType(u.getType());
 		ub.setUid(u.getId());
 		return ub;
 	}
-	
+
 	/**
 	 * 登陆后返回用户基本信息
+	 * 
 	 * @return
 	 */
-	@RequestMapping(value="/afterSignIn",method = RequestMethod.POST)
-	public Result afterSignIn(){
+	@RequestMapping(value = "/afterSignIn", method = RequestMethod.GET)
+	public Result afterSignIn() {
 		Result res = new Result();
-		if(TokenManager.isLogin()){
+		if (TokenManager.isLogin()) {
 			User u = userService.selectByPrimaryKey(TokenManager.getUserId());
 			u.setPassword("");
 			res.setData(u);
 		}
-		return res; 
+		return res;
 	}
-	
-	
-	
-		
-}
 
+}

+ 2 - 2
src/main/java/com/goafanti/user/controller/UserRegisterController.java

@@ -46,7 +46,7 @@ public class UserRegisterController extends BaseController{
 			return res;
 		}
 		//验证码15分钟有效
-		if(TimeUtils.checkOverTime("register")){
+		/*if(TimeUtils.checkOverTime("register")){
 			res.getError().add(buildError(ErrorConstants.MCODE_OVERTIME_ERROR,"手机验证码超时失效"));
 			return res;
 		}
@@ -54,7 +54,7 @@ public class UserRegisterController extends BaseController{
 		if(!TokenManager.getSession().getAttribute(VerifyCodeUtils.M_CODE).equals(mobileCode)){
 			res.getError().add(buildError(ErrorConstants.MCODE_ERROR,"手机验证码错误"));
 			return res;
-		}
+		}*/
 		if (bindingResult.hasErrors()) {
 			res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
 					bindingResult.getFieldError().getField()));

+ 1 - 1
src/main/java/com/goafanti/user/service/UserAbilityService.java

@@ -5,7 +5,7 @@ import com.goafanti.common.model.UserCareer;
 
 public interface UserAbilityService {
 
-	UserAbility selectUserAbilityByUserId(String userId);
+	UserAbility selectUserAbilityByUserId(String uid);
 
 	UserAbility insert(UserAbility userAbility);
 

+ 5 - 2
src/main/resources/props/config_dev.properties

@@ -38,7 +38,7 @@ jdbc.logAbandoned=true
 #\u7edf\u8ba1\u76d1\u63a7
 jdbc.filters=stat
 
-jedis.host=123.57.207.214
+jedis.host=localhost
 jedis.port=6379
 jedis.timeout=5000
 jedis.password=aft@2016!redis$
@@ -53,4 +53,7 @@ app.name=AFT
 static.host=//afts.hnzhiming.com
 
 upload.path=/data/wwwroot/aft/upload
-upload.private.path=/data/upload
+upload.private.path=/data/upload
+
+accessKey=LTAIqTgQLLwz252Z
+accessSecret=ICGuiUnqzaar7urw4zecVcJrJ1MHg9

+ 5 - 2
src/main/resources/props/config_local.properties

@@ -38,10 +38,10 @@ jdbc.logAbandoned=true
 #\u7edf\u8ba1\u76d1\u63a7
 jdbc.filters=stat
 
-jedis.host=localhost
+jedis.host=127.0.0.1
 jedis.port=6379
 jedis.timeout=5000
-#jedis.password=aft@2016!redis$
+#jedis.password=
 
 pwd.hash_algorithm_name=md5
 pwd.hash_iterations=2
@@ -54,3 +54,6 @@ static.host=//afts.hnzhiming.com
 
 upload.path=/Users/xiaolong/Sites/upload
 upload.private.path=/Users/xiaolong/Sites/doc
+
+accessKey=LTAIqTgQLLwz252Z
+accessSecret=ICGuiUnqzaar7urw4zecVcJrJ1MHg9