Browse Source

Merge branch 'master' of https://git.coding.net/aft/AFT.git

Administrator 8 years ago
parent
commit
9f0ef89b80

+ 13 - 1
src/main/java/com/goafanti/admin/controller/AdminApiController.java

@@ -17,6 +17,7 @@ import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -123,6 +124,8 @@ import com.goafanti.copyright.bo.CopyrightInfoDetail;
 import com.goafanti.copyright.service.CopyrightInfoService;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.easemob.EasemobUtils;
+import com.goafanti.easemob.enums.EasemonSysUsers;
 import com.goafanti.patent.service.PatentInfoService;
 import com.goafanti.user.bo.InputOrganizationIdentity;
 import com.goafanti.user.bo.InputUser;
@@ -189,6 +192,9 @@ public class AdminApiController extends CertifyApiController {
 	@Resource
 	private OrgCognizanceProportionService	orgCognizanceProportionService;
 
+	@Autowired
+	EasemobUtils							easemobUtils;
+
 	/**
 	 * 获取营销员及营销经理下拉
 	 */
@@ -2801,7 +2807,13 @@ public class AdminApiController extends CertifyApiController {
 		BeanUtils.copyProperties(cog, ocl);
 
 		orgCognizanceService.updateCognizance(oc, ocl, recordTime, TokenManager.getAdminId());
-
+		if (cog.getState() != null && !cog.getState().equals(o.getState())
+				&& cog.getState() <= OrgCognizanceStatus.CALLBACK.getCode()
+				&& cog.getState() >= OrgCognizanceStatus.PREPARE.getCode()) {
+			easemobUtils.sendMessage(EasemonSysUsers.ADMIN_DDDT.getUsername(),
+					userService.selectNumberByPrimaryKey(o.getUid()), "您的科技项目申报订单:#%s,状态变更为%s", o.getSerialNumber(),
+					OrgCognizanceStatus.getStatus(cog.getState()).getDesc());
+		}
 		return res;
 	}
 

+ 19 - 4
src/main/java/com/goafanti/admin/controller/AdminCopyrightApiController.java

@@ -12,6 +12,7 @@ import javax.validation.Valid;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.BindingResult;
 import org.springframework.validation.FieldError;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -35,6 +36,8 @@ import com.goafanti.copyright.bo.CopyrightInfoDetail;
 import com.goafanti.copyright.bo.InputCopyright;
 import com.goafanti.copyright.service.CopyrightInfoService;
 import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.easemob.EasemobUtils;
+import com.goafanti.easemob.enums.EasemonSysUsers;
 import com.goafanti.user.service.UserService;
 
 @RestController
@@ -47,6 +50,9 @@ public class AdminCopyrightApiController extends CertifyApiController {
 	@Resource
 	private AdminService			adminService;
 
+	@Autowired
+	EasemobUtils					easemobUtils;
+
 	@RequestMapping(value = "/circulation", method = RequestMethod.POST)
 	public Result circulation(@RequestParam(name = "ids[]", required = false) String[] ids, @Valid InputCopyright ic,
 			BindingResult bindingResult, String recordTimeFormattedDate) {
@@ -56,7 +62,7 @@ public class AdminCopyrightApiController extends CertifyApiController {
 					CopyrightFields.getFieldDesc(bindingResult.getFieldError().getField())));
 			return res;
 		}
-		
+
 		if (ids == null || ids.length < 1) {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
 			return res;
@@ -162,6 +168,14 @@ public class AdminCopyrightApiController extends CertifyApiController {
 		cl.setOperator(TokenManager.getAdminId());
 		copyrightInfoService.updateByPrimaryKeySelective(ci, cl);
 		res.setData(1);
+		if (inputInfo.getStatus() != null && !inputInfo.getStatus().equals(oci.getStatus())
+				&& inputInfo.getStatus() <= CopyrightStatus.CALLBACK.getCode()
+				&& inputInfo.getStatus() >= CopyrightStatus.SUBMIT.getCode()) {
+			easemobUtils.sendMessage(EasemonSysUsers.ADMIN_DDDT.getUsername(),
+					userService.selectNumberByPrimaryKey(oci.getUid()), "您的软著申请订单:#%s%s,状态变更为%s", oci.getSerialNumber(),
+					oci.getCopyrightName() == null ? "" : oci.getCopyrightName(),
+					CopyrightStatus.getStatus(inputInfo.getStatus()).getDesc());
+		}
 		return res;
 	}
 
@@ -221,8 +235,9 @@ public class AdminCopyrightApiController extends CertifyApiController {
 	}
 
 	@RequestMapping(value = "/list", method = RequestMethod.GET)
-	public Result list(String contractId, Integer province, String unitName, String uid, String copyrightName, String status, String pageNo,
-			String pageSize, @RequestParam(name = "createTime[]", required = false) String[] createTime,
+	public Result list(String contractId, Integer province, String unitName, String uid, String copyrightName,
+			String status, String pageNo, String pageSize,
+			@RequestParam(name = "createTime[]", required = false) String[] createTime,
 			@RequestParam(name = "acceptTime[]", required = false) String[] acceptTime,
 			@RequestParam(name = "authTime[]", required = false) String[] authTime) {
 		Result res = new Result();
@@ -329,7 +344,7 @@ public class AdminCopyrightApiController extends CertifyApiController {
 		List<Admin> list = adminService.selectCopyrightPrincipal();
 		Map<String, String> map = new TreeMap<String, String>();
 		for (Admin o : list) {
-			map.put(o.getId(), o.getName()+ " " + (null == o.getPosition() ? "" : o.getPosition()));
+			map.put(o.getId(), o.getName() + " " + (null == o.getPosition() ? "" : o.getPosition()));
 		}
 		res.setData(map);
 		return res;

+ 14 - 0
src/main/java/com/goafanti/admin/controller/AdminPatentApiController.java

@@ -23,6 +23,7 @@ import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -67,6 +68,8 @@ import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.dataGlossory.service.DistrictGlossoryService;
+import com.goafanti.easemob.EasemobUtils;
+import com.goafanti.easemob.enums.EasemonSysUsers;
 import com.goafanti.patent.bo.InputPatentCost;
 import com.goafanti.patent.bo.InputPatentInfo;
 import com.goafanti.patent.bo.InputPatentRegistration;
@@ -111,6 +114,9 @@ public class AdminPatentApiController extends CertifyApiController {
 	@Value(value = "${aesSecretKey}")
 	private String							secretKey	= null;
 
+	@Autowired
+	EasemobUtils							easemobUtils;
+
 	/**
 	 * 专利批量流转
 	 * 
@@ -301,6 +307,14 @@ public class AdminPatentApiController extends CertifyApiController {
 		BeanUtils.copyProperties(patentInfo, pi);
 		BeanUtils.copyProperties(patentInfo, pl);
 		patentInfoService.updatePatentInfo(pi, pl, recordTime);
+		if (patentInfo.getState() != null && !patentInfo.getState().equals(p.getPatentState())
+				&& patentInfo.getState() <= PatentInfoStatus.CALLBACK.getCode()
+				&& patentInfo.getState() >= PatentInfoStatus.COMPOSE.getCode()) {
+			easemobUtils.sendMessage(EasemonSysUsers.ADMIN_DDDT.getUsername(),
+					userService.selectNumberByPrimaryKey(p.getUid()), "您的专利申请订单:#%s%s,状态变更为%s", p.getSerialNumber(),
+					p.getPatentName() == null ? "" : p.getPatentName(),
+					PatentInfoStatus.getStatus(patentInfo.getState()).getDesc());
+		}
 		return res;
 	}
 

+ 59 - 0
src/main/java/com/goafanti/admin/controller/AdminSystemController.java

@@ -0,0 +1,59 @@
+package com.goafanti.admin.controller;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpMethod;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import com.alibaba.fastjson.JSONObject;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.controller.BaseApiController;
+import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.easemob.EasemobUtils;
+import com.goafanti.easemob.bo.EasemobInfo;
+import com.goafanti.easemob.enums.EasemonSysUsers;
+
+@Controller
+@RequestMapping(value = "/api/admin")
+public class AdminSystemController extends BaseApiController {
+
+	@Autowired
+	EasemobUtils easemobUtils;
+
+	/**
+	 * 初始化系统消息用户
+	 */
+	@RequestMapping(value = "/sys/initEasemob", method = RequestMethod.GET)
+	public Result initEasemob() {
+		if (isSuperAdmin()) {
+			for (EasemonSysUsers esu : EasemonSysUsers.values()) {
+				JSONObject jo = new JSONObject();
+				jo.put("username", esu.getUsername());
+				jo.put("nickname", esu.getNickname());
+				jo.put("password", System.currentTimeMillis());
+				easemobUtils.sendLater(new EasemobInfo().uri("/users").data(jo.toJSONString()).method(HttpMethod.POST));
+			}
+			return res().data(true);
+		}
+		return res().data(false);
+	}
+
+	/**
+	 * 测试发送消息
+	 */
+	@RequestMapping(value = "/sys/sendMsg", method = RequestMethod.GET)
+	public Result sendMsg(String from, String to, String msg) {
+		if (isSuperAdmin()) {
+			easemobUtils.sendMessage(from, to, new ModelMap("nickname", EasemonSysUsers.getNickname(from)), msg, true);
+			return res().data(true);
+		}
+		return res().data(false);
+	}
+
+	private boolean isSuperAdmin() {
+		return TokenManager.hasRole(AFTConstants.SUPERADMIN);
+	}
+}

+ 18 - 3
src/main/java/com/goafanti/admin/controller/AdminTechProjectApiController.java

@@ -14,6 +14,7 @@ import javax.validation.Valid;
 
 import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Controller;
 import org.springframework.validation.BindingResult;
@@ -38,6 +39,8 @@ import com.goafanti.common.utils.AesUtils;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
+import com.goafanti.easemob.EasemobUtils;
+import com.goafanti.easemob.enums.EasemonSysUsers;
 import com.goafanti.techproject.bo.InputTechProject;
 import com.goafanti.techproject.bo.InputTechWebsite;
 import com.goafanti.techproject.bo.TechProjectManageListBo;
@@ -65,6 +68,9 @@ public class AdminTechProjectApiController extends CertifyApiController {
 	@Resource
 	private AdminService			adminService;
 
+	@Autowired
+	EasemobUtils					easemobUtils;
+
 	/**
 	 * 科技网址申报公司下拉
 	 * 
@@ -125,7 +131,8 @@ public class AdminTechProjectApiController extends CertifyApiController {
 	 */
 	@SuppressWarnings("unchecked")
 	@RequestMapping(value = "/listTechProject", method = RequestMethod.POST)
-	public Result listTechProject(String contractId, Integer province, String unitName, String uid, String pageNo, String pageSize) {
+	public Result listTechProject(String contractId, Integer province, String unitName, String uid, String pageNo,
+			String pageSize) {
 		Result res = new Result();
 		Integer pNo = 1;
 		Integer pSize = 10;
@@ -135,8 +142,8 @@ public class AdminTechProjectApiController extends CertifyApiController {
 		if (StringUtils.isNumeric(pageNo)) {
 			pNo = Integer.parseInt(pageNo);
 		}
-		Pagination<TechProjectManageListBo> t = techProjectService.listManageTechProject(contractId, province, unitName, uid, pNo,
-				pSize);
+		Pagination<TechProjectManageListBo> t = techProjectService.listManageTechProject(contractId, province, unitName,
+				uid, pNo, pSize);
 		if (null != t) {
 			List<TechProjectManageListBo> l = (List<TechProjectManageListBo>) t.getList();
 			for (TechProjectManageListBo w : l) {
@@ -274,6 +281,14 @@ public class AdminTechProjectApiController extends CertifyApiController {
 		BeanUtils.copyProperties(techProject, tp);
 		BeanUtils.copyProperties(techProject, tpl);
 		res.setData(techProjectService.updateTechProject(tp, tpl, recordTime));
+		if (techProject.getState() != null && !techProject.getState().equals(t.getState())
+				&& techProject.getState() <= TechProjectStatus.CALLBACK.getCode()
+				&& techProject.getState() >= TechProjectStatus.SUBMIT.getCode()) {
+			easemobUtils.sendMessage(EasemonSysUsers.ADMIN_DDDT.getUsername(),
+					userService.selectNumberByPrimaryKey(t.getUid()), "您的科技项目申报订单:#%s%s,状态变更为%s", t.getSerialNumber(),
+					t.getProjectName() == null ? "" : t.getProjectName(),
+					TechProjectStatus.getStatus(techProject.getState()).getDesc());
+		}
 		return res;
 	}
 

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

@@ -37,4 +37,6 @@ public interface UserMapper {
 	UserPartnerDetailBo findUserPartnerDetail(@Param("uid") String uid, @Param("tokenId") String tokenId);
 
 	OrgPartnerDetailBo findOrgPartnerDetail(@Param("uid") String uid, @Param("tokenId") String tokenId);
+
+	Long selectNumberByPrimaryKey(String userId);
 }

+ 2 - 2
src/main/java/com/goafanti/common/enums/CopyrightStatus.java

@@ -7,9 +7,9 @@ import org.apache.commons.lang3.StringUtils;
 
 public enum CopyrightStatus {
 	CREATE(0, "创建"),
-	SIGN(1,"签单"),
+	SIGN(1, "签单"),
 	DELIVERD(2, "派单"),
-	CIRCULATION(3,"流转"),
+	CIRCULATION(3, "流转"),
 	SUBMIT(4, "材料提交"),
 	ACCEPT(5, "受理"),
 	AMEND(6, "补正"),

+ 6 - 0
src/main/java/com/goafanti/common/mapper/UserMapper.xml

@@ -926,4 +926,10 @@
   		and uc.work_unit like CONCAT('%',#{workUnit,jdbcType=VARCHAR},'%')
   	</if>
   </select>
+  
+  <select id="selectNumberByPrimaryKey" parameterType="String" resultType="java.lang.Long">
+  	select number
+  	from user
+  	where id = #{id,jdbcType=VARCHAR}
+  </select>
 </mapper>

+ 12 - 1
src/main/java/com/goafanti/common/utils/LoggerUtils.java

@@ -53,7 +53,7 @@ public class LoggerUtils {
 			logger.debug(fmtString);
 		}
 	}
-	
+
 	/**
 	 * 
 	 * @param logger
@@ -66,6 +66,17 @@ public class LoggerUtils {
 	}
 
 	/**
+	 * 
+	 * @param logger
+	 * @param message
+	 */
+	public static void debug(Logger logger, Object message) {
+		if (isDebug) {
+			logger.debug(message.toString());
+		}
+	}
+
+	/**
 	 * Error 输出
 	 * 
 	 * @param clazz

+ 58 - 29
src/main/java/com/goafanti/easemob/EasemobUtils.java

@@ -10,8 +10,8 @@ import org.apache.http.HttpResponse;
 import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.concurrent.FutureCallback;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
@@ -27,13 +27,15 @@ import org.springframework.http.HttpMethod;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.easemob.bo.EasemobInfo;
 import com.goafanti.easemob.queue.EasemobRedisQueue;
 
 public class EasemobUtils implements InitializingBean, DisposableBean {
-	private static final String				UTF_8	= "UTF-8";
-	private static final Logger				logger	= LoggerFactory.getLogger(EasemobUtils.class);
-	private static final Optional<Integer>	UN_AUTH	= Optional.of(401);
+	private static final String				UTF_8		= "UTF-8";
+	private static final Logger				logger		= LoggerFactory.getLogger(EasemobUtils.class);
+	private static final Optional<Integer>	UN_AUTH		= Optional.of(401);
+	private static final Optional<Integer>	REACH_LIMIT	= Optional.of(429);
 
 	@Value(value = "${easemob.client.url}")
 	private String							clientUrl;
@@ -83,26 +85,29 @@ public class EasemobUtils implements InitializingBean, DisposableBean {
 		HttpUriRequest req = buildRequest(info);
 		CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault();
 		httpclient.start();
-		logger.debug(req.toString());
+		LoggerUtils.debug(logger, "SEND: [%s] - [%s]", info.getMethod(), info.getUri());
 		Future<HttpResponse> future = httpclient.execute(req, null);
 		try {
 			HttpResponse response = future.get();
-			if (info.isWithAuth() && isUnauth(response)) {
+			Optional<Integer> rescode = getResCode(response);
+			if (info.isWithAuth() && isUnauth(rescode)) {
 				auth();
+			} else if (isReachLimit(rescode)) {
+				LoggerUtils.debug(logger, "Reach Easemob API limitation!");
 			} else {
 				HttpEntity entity = response.getEntity();
 				if (entity != null) {
 					try {
 						String resStr = EntityUtils.toString(entity, UTF_8);
-						logger.debug(resStr);
 						return (JSONObject) JSON.parse(resStr);
 					} catch (Exception e) {
-						logger.error(e.getMessage(), e);
+						LoggerUtils.debug(logger, e.getMessage(), e);
 					}
 				}
 			}
+			LoggerUtils.debug(logger, response);
 		} catch (InterruptedException | ExecutionException e) {
-			logger.error(e.getMessage(), e);
+			LoggerUtils.debug(logger, e.getMessage(), e);
 		} finally {
 			try {
 				httpclient.close();
@@ -120,7 +125,7 @@ public class EasemobUtils implements InitializingBean, DisposableBean {
 		HttpUriRequest req = buildRequest(info);
 		CloseableHttpAsyncClient httpclient = HttpAsyncClients.createDefault();
 		httpclient.start();
-		logger.debug(req.toString());
+		LoggerUtils.debug(logger, "SEND: [%s] - [%s]", info.getMethod(), info.getUri());
 		httpclient.execute(req, new FutureCallback<HttpResponse>() {
 			@Override
 			public void failed(Exception ex) {
@@ -130,29 +135,21 @@ public class EasemobUtils implements InitializingBean, DisposableBean {
 
 			@Override
 			public void completed(HttpResponse result) {
-				if (info.isWithAuth() && isUnauth(result)) {
+				Optional<Integer> rescode = getResCode(result);
+				if (info.isWithAuth() && isUnauth(rescode)) {
 					auth();
-				} else {
-					HttpEntity entity = result.getEntity();
-					if (entity != null) {
-						try {
-							logger.debug(EntityUtils.toString(entity, UTF_8));
-						} catch (Exception e) {
-							logger.error(e.getMessage(), e);
-						}
-					}
-				}
-				try {
-					httpclient.close();
-				} catch (IOException e) {
+				} else if (isReachLimit(rescode)) {
+					LoggerUtils.debug(logger, "Reach Easemob API limitation!");
+					sendLater(info.tryCount(info.getTryCount() + 1));
 				}
+				LoggerUtils.debug(logger, result);
 				close();
 			}
 
 			@Override
 			public void cancelled() {
 				close();
-				logger.debug(req.toString() + "cancelled!");
+				LoggerUtils.debug(logger, "CANCELLED: [%s] - [%s]", req.getMethod(), req.getURI());
 			}
 
 			private void close() {
@@ -164,14 +161,46 @@ public class EasemobUtils implements InitializingBean, DisposableBean {
 		});
 	}
 
-	private boolean isUnauth(HttpResponse response) {
-		return UN_AUTH
-				.equals(Optional.ofNullable(response).map(res -> res.getStatusLine()).map(sl -> sl.getStatusCode()));
+	public void sendMessage(String from, String to, String msg, Object... value) {
+		sendAsync(new EasemobInfo().uri("/messages").data(buildMessage(from, to, null, String.format(msg, value)))
+				.method(HttpMethod.POST));
+	}
+
+	public void sendMessage(String from, String to, Object ext, String msg, Object... value) {
+		sendAsync(new EasemobInfo().uri("/messages").data(buildMessage(from, to, ext, String.format(msg, value)))
+				.method(HttpMethod.POST));
+	}
+
+	private String buildMessage(String from, String to, Object ext, String msg) {
+		JSONObject message = new JSONObject();
+		message.put("type", "txt");
+		message.put("msg", msg);
+		JSONObject jo = new JSONObject();
+		jo.put("target_type", "users");
+		jo.put("target", new String[] { to });
+		jo.put("msg", message);
+		jo.put("from", from);
+		if (ext != null) {
+			jo.put("ext", ext);
+		}
+		return jo.toJSONString();
+	}
+
+	private Optional<Integer> getResCode(HttpResponse response) {
+		return Optional.ofNullable(response).map(res -> res.getStatusLine()).map(sl -> sl.getStatusCode());
+	}
+
+	private boolean isUnauth(Optional<Integer> responseStatus) {
+		return UN_AUTH.equals(responseStatus);
+	}
+
+	private boolean isReachLimit(Optional<Integer> responseStatus) {
+		return REACH_LIMIT.equals(responseStatus);
 	}
 
 	@Override
 	public void destroy() throws Exception {
-		logger.debug("消息系统关闭");
+		LoggerUtils.debug(logger, "消息系统关闭");
 	}
 
 	@Override

+ 52 - 0
src/main/java/com/goafanti/easemob/enums/EasemonSysUsers.java

@@ -0,0 +1,52 @@
+package com.goafanti.easemob.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum EasemonSysUsers {
+	ADMIN_DDDT("ADMIN_DDDT", "订单动态"),
+	ADMIN_XQDT("ADMIN_XQDT", "需求动态"),
+	ADMIN_CGDT("ADMIN_CGDT", "成果动态"),
+	ADMIN_XTXX("ADMIN_XTXX", "系统消息");
+
+	private EasemonSysUsers(String username, String nickname) {
+		this.username = username;
+		this.nickname = nickname;
+	}
+
+	private String	username;
+
+	private String	nickname;
+
+	public String getUsername() {
+		return username;
+	}
+
+	public String getNickname() {
+		return nickname;
+	}
+
+	private static Map<String, EasemonSysUsers> users = new HashMap<String, EasemonSysUsers>();
+
+	static {
+		for (EasemonSysUsers value : EasemonSysUsers.values()) {
+			users.put(value.getUsername(), value);
+		}
+	}
+
+	public static EasemonSysUsers getField(String code) {
+		if (containsType(code)) {
+			return users.get(code);
+		}
+		return ADMIN_XTXX;
+	}
+
+	public static String getNickname(String code) {
+		return getField(code).getNickname();
+	}
+
+	public static boolean containsType(String code) {
+		return users.containsKey(code);
+	}
+
+}

+ 9 - 6
src/main/java/com/goafanti/user/service/UserService.java

@@ -20,6 +20,8 @@ public interface UserService {
 
 	User selectByPrimaryKey(String userId);
 
+	String selectNumberByPrimaryKey(String userId);
+
 	int updateByPrimaryKeySelective(User u);
 
 	int updateByPrimaryKey(User u);
@@ -40,8 +42,9 @@ public interface UserService {
 	Pagination<OrgListBo> listOrg(String uid, String mobile, String email, String[] createTime, Integer number,
 			String unitName, Integer auditStatus, Integer pNo, Integer pSize) throws ParseException;
 
-	Pagination<OrgListBo> selectUserByAid(Integer number, String mobile, Integer auditStatus, String auditName, String email,
-			String adminId, String startCreateTime, String endCreateTime, Integer type, Integer pNo, Integer pSize);
+	Pagination<OrgListBo> selectUserByAid(Integer number, String mobile, Integer auditStatus, String auditName,
+			String email, String adminId, String startCreateTime, String endCreateTime, Integer type, Integer pNo,
+			Integer pSize);
 
 	List<OrgUnitNames> selectDemandUnitNames();
 
@@ -59,10 +62,10 @@ public interface UserService {
 
 	Object findOrgPartnerDetail(String uid);
 
-	Pagination<StarListBo> listStar(Integer number, String engagedField, String username, String professionalTitle, String workUnit,
-			Integer pNo, Integer pSize);
-
-	Pagination<StarAndExpertListBo> listStarAndExpert(Integer number, String engagedField, String username, String professionalTitle,
+	Pagination<StarListBo> listStar(Integer number, String engagedField, String username, String professionalTitle,
 			String workUnit, Integer pNo, Integer pSize);
 
+	Pagination<StarAndExpertListBo> listStarAndExpert(Integer number, String engagedField, String username,
+			String professionalTitle, String workUnit, Integer pNo, Integer pSize);
+
 }

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

@@ -9,6 +9,7 @@ import java.util.UUID;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.common.constant.AFTConstants;
@@ -504,4 +505,10 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 				params, pNo, pSize);
 	}
 
+	@Override
+	@Cacheable(value = "UserNumberCache", key = "'UserNumberCache:UID:'+#userId")
+	public String selectNumberByPrimaryKey(String userId) {
+		return String.valueOf(userMapper.selectNumberByPrimaryKey(userId));
+	}
+
 }

+ 54 - 9
src/main/webapp/WEB-INF/views/portal/membership.html

@@ -1,12 +1,10 @@
 <!DOCTYPE html>
-<html xmlns="http://www.w3.org/1999/xhtml"
-	xmlns:th="http://www.thymeleaf.org"
-	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
 
 <head th:replace="common::header(~{::title},~{::link})">
-<title>用户会员申请</title>
-<link th:href="${portalHost + '/vendors.css'}" rel="stylesheet">
-<link th:href="${portalHost + '/membership.css'}" rel="stylesheet">
+	<title>用户会员申请</title>
+	<link th:href="${portalHost + '/vendors.css'}" rel="stylesheet">
+	<link th:href="${portalHost + '/membership.css'}" rel="stylesheet">
 </head>
 
 <body>
@@ -15,14 +13,61 @@
 			<div class="container">
 				<div class="lt">欢迎进入科技认知计算交易平台!</div>
 				<div class="rt">
-					<a href="/user/login.html" class="login">登录</a> <a
-						href="/user/signIn.html">注册</a> <a href="#">导航</a> <a href="#">关于我们</a>
+					<a href="/user/login.html" class="login">登录</a> <a href="/user/signIn.html">注册</a> <a href="#">导航</a> <a href="#">关于我们</a>
 					<a href="#">联系我们</a>
 				</div>
 			</div>
 		</div>
 	</header>
-	<div></div>
+	<div class="wrap">
+		<div class="member-title">申请会员获得更多增值服务</div>
+		<div class="member-text">根据企业所需选择合适的付费方案,更高效地为您提供服务</div>
+		<div class="member-card">
+			<ul id="member-list" class="clearfix">
+				<li>
+					<div class="level level1">黄金会员</div>
+					<div class="top">
+						<i class="topImg"></i>
+						<span>提供的专属服务</span>
+					</div>
+					<div class="server">
+						<p>科技成果,专家信息定点推送</p>
+						<p>查看专家的联系方式</p>
+						<p>任何业务申请,付费业享受会员专属折扣。</p>
+						<p>一对一的技术经纪人服务,进行技术成果媒合服务</p>
+						<p>一对一的科技咨询师服务</p>
+					</div>
+					<div class="money">
+						<p><a href="">800/3月</a></p>
+						<p><a href="">1400/6月</a></p>
+						<p><a href="">2000/12月</a></p>
+					</div>
+				</li>
+				<li>
+					<div class="level level2">钻石会员</div>
+					<div class="top">
+						<i class="topImg"></i>
+						<span>提供的专属服务</span>
+					</div>
+					<div class="server">
+						<p>科技成果,专家信息定点推送</p>
+						<p>查看专家的联系方式</p>
+						<p>任何业务申请,付费业享受会员专属折扣。</p>
+						<p>一对一的技术经纪人服务,进行技术成果媒合服务</p>
+						<p>一对一的科技咨询师服务</p>
+						<p>一对一的专业技术顾问,搜集技术情报,提供研发高参</p>
+						<p>免费参加现场业务培训会</p>
+						<p>免前期费用做科技类扶持资金项目申报</p>
+					</div>
+					<div class="money">
+						<p><a href="">2000/3月</a></p>
+						<p><a href="">3500/6月</a></p>
+						<p><a href="">5000/12月</a></p>
+					</div>
+				</li>
+			</ul>
+		</div>
+	</div>
 	<footer>
 		<div th:replace="common::copyright"></div>
 	</footer>