Browse Source

"伙伴" 详情

Antiloveg 8 years ago
parent
commit
e073ca2f5d

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

@@ -6,8 +6,10 @@ import org.apache.ibatis.annotations.Param;
 
 import com.goafanti.common.model.User;
 import com.goafanti.user.bo.OrgListBo;
+import com.goafanti.user.bo.OrgPartnerDetailBo;
 import com.goafanti.user.bo.UserDownLoadBo;
 import com.goafanti.user.bo.UserPageHomeBo;
+import com.goafanti.user.bo.UserPartnerDetailBo;
 
 
 public interface UserMapper {
@@ -34,4 +36,8 @@ public interface UserMapper {
 	String findUserByNameAndMobile(@Param("name")String name, @Param("mobile")String mobile);
 
 	String findOrgByNameAndMobile(@Param("name")String name, @Param("mobile")String mobile);
+
+	UserPartnerDetailBo findUserPartnerDetail(String uid);
+
+	OrgPartnerDetailBo findOrgPartnerDetail(String uid);
 }

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

@@ -1186,6 +1186,9 @@
 			<if test="field != null">
 				AND oi.field like CONCAT(#{field,jdbcType=VARCHAR}, '%')
 			</if>
+			<if test="name != null">
+				AND oi.unit_name like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
+			</if>
 		) x
 		LEFT JOIN achievement a ON a.owner_id = x.uid AND a.release_status = 1
 		AND a.audit_status = 3 AND a.deleted_sign = 0
@@ -1230,6 +1233,9 @@
 			<if test="field != null">
 				AND oi.field like CONCAT(#{field,jdbcType=VARCHAR}, '%')
 			</if>
+			<if test="name != null">
+				AND oi.unit_name like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
+			</if>
 		) x
 		LEFT JOIN achievement a ON a.owner_id = x.uid AND a.release_status = 1
 		AND a.audit_status = 3 AND a.deleted_sign = 0

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

@@ -428,6 +428,9 @@
 		<if test="field != null">
 			AND uc.engaged_field like CONCAT(#{field,jdbcType=VARCHAR}, '%')
 		</if>
+		<if test="name != null">
+			AND ui.username like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
+		</if>
 	) x
 	LEFT JOIN achievement a ON a.owner_id = x.uid AND a.release_status = 1
 	AND a.audit_status = 3 AND a.deleted_sign = 0
@@ -473,6 +476,9 @@
 			<if test="field != null">
 				AND uc.engaged_field like CONCAT(#{field,jdbcType=VARCHAR}, '%')
 			</if>
+			<if test="name != null">
+				AND ui.username like CONCAT('%', #{name,jdbcType=VARCHAR}, '%')
+			</if>
 		) x
 		LEFT JOIN achievement a ON a.owner_id = x.uid AND a.release_status = 1
 		AND a.audit_status = 3 AND a.deleted_sign = 0

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

@@ -573,4 +573,48 @@
 		</foreach>
 	</if>
   </select>  
+  
+  <select id="findUserPartnerDetail" parameterType="java.lang.String" resultType="com.goafanti.user.bo.UserPartnerDetailBo">
+  	SELECT
+		ui.username,
+		ui.province,
+		ui.city,
+		ui.area,
+		uc.engaged_field AS engagedField,
+		info.personal_profile AS personalProfile,
+		u.lvl AS LEVEL,
+		ua.ability_label AS abilityLabel,
+		info.personal_profile AS personalProfile,
+		info.life_photo_url AS lifePhotoUrl
+	FROM
+		user u
+	LEFT JOIN user_identity ui ON ui.uid = u.id
+	LEFT JOIN user_career uc ON uc.uid = u.id
+	LEFT JOIN user_ability ua ON ua.uid = u.id
+	LEFT JOIN user_info info ON info.uid = u.id
+	WHERE
+		u.type = 0
+	and u.id = #{uid,jdbcType=VARCHAR}
+  </select>
+  
+  <select id="findOrgPartnerDetail" parameterType="java.lang.String" resultType="com.goafanti.user.bo.OrgPartnerDetailBo">
+  	SELECT
+		oi.unit_name AS unitName,
+		oi.licence_province AS province,
+		oi.licence_city AS city,
+		oi.licence_area AS area,
+		u.lvl AS LEVEL,
+		ua.ability_label AS abilityLabel,
+		info.logo_url AS logoUrl,
+		info.company_introduction AS company_introduction,
+		info.publicity_picture_url AS publicityPictureUrl
+	FROM
+	USER u
+	LEFT JOIN organization_identity oi ON oi.uid = u.id
+	LEFT JOIN organization_info info ON info.uid = u.id
+	LEFT JOIN user_ability ua ON ua.uid = u.id
+	WHERE
+		u.type = 1
+	and u.id = #{uid,jdbcType=VARCHAR} 
+  </select>
 </mapper>

+ 3 - 3
src/main/java/com/goafanti/portal/controller/PortalSearchApiController.java

@@ -77,7 +77,7 @@ public class PortalSearchApiController extends BaseApiController {
 	 * 用户搜索
 	 */
 	@RequestMapping(value = "/subscriberList", method = RequestMethod.GET)
-	public Result subscriberSearchList(Integer level, Integer type, String field, Integer province, Integer city,
+	public Result subscriberSearchList(String name, Integer level, Integer type, String field, Integer province, Integer city,
 			Integer area, String pageNo, String pageSize) {
 		Result res = new Result();
 		if (null == type) {
@@ -104,9 +104,9 @@ public class PortalSearchApiController extends BaseApiController {
 			pNo = Integer.parseInt(pageNo);
 		}
 		if (UserType.PERSONAL.getCode().equals(type)) {
-			res.setData(userIdentityService.listSubscriber(level, field, province, city, area, pNo, pSize));
+			res.setData(userIdentityService.listSubscriber(name, level, field, province, city, area, pNo, pSize));
 		} else {
-			res.setData(organizationIdentityService.listSubscriber(level, field, province, city, area, pNo, pSize));
+			res.setData(organizationIdentityService.listSubscriber(name, level, field, province, city, area, pNo, pSize));
 		}
 		return res;
 	}

+ 1 - 1
src/main/java/com/goafanti/user/bo/InterestUserListBo.java

@@ -131,7 +131,7 @@ public class InterestUserListBo {
 		if (this.createTime == null) {
 			return null;
 		} else {
-			return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDDHHMMSS);
+			return DateFormatUtils.format(this.getCreateTime(), AFTConstants.YYYYMMDD);
 		}
 	}
 

+ 106 - 0
src/main/java/com/goafanti/user/bo/OrgPartnerDetailBo.java

@@ -0,0 +1,106 @@
+package com.goafanti.user.bo;
+
+public class OrgPartnerDetailBo {
+	private String	unitName;
+
+	private Integer	province;
+
+	private Integer	city;
+
+	private Integer	area;
+
+	private Integer	level;
+
+	private String	abilityLabel;
+
+	private String	logoUrl;
+
+	private String	publicityPictureUrl;
+
+	private String	field;
+
+	private String	companyIntroduction;
+
+	public String getUnitName() {
+		return unitName;
+	}
+
+	public void setUnitName(String unitName) {
+		this.unitName = unitName;
+	}
+
+	public Integer getProvince() {
+		return province;
+	}
+
+	public void setProvince(Integer province) {
+		this.province = province;
+	}
+
+	public Integer getCity() {
+		return city;
+	}
+
+	public void setCity(Integer city) {
+		this.city = city;
+	}
+
+	public Integer getArea() {
+		return area;
+	}
+
+	public void setArea(Integer area) {
+		this.area = area;
+	}
+
+	public Integer getLevel() {
+		return level;
+	}
+
+	public void setLevel(Integer level) {
+		this.level = level;
+	}
+
+	public String getAbilityLabel() {
+		return abilityLabel;
+	}
+
+	public void setAbilityLabel(String abilityLabel) {
+		this.abilityLabel = abilityLabel;
+	}
+
+	public String getLogoUrl() {
+		return logoUrl;
+	}
+
+	public void setLogoUrl(String logoUrl) {
+		this.logoUrl = logoUrl;
+	}
+
+	public String getPublicityPictureUrl() {
+		return publicityPictureUrl;
+	}
+
+	public void setPublicityPictureUrl(String publicityPictureUrl) {
+		this.publicityPictureUrl = publicityPictureUrl;
+	}
+
+	public String getField() {
+		return field;
+	}
+
+	public void setField(String field) {
+		this.field = field;
+	}
+
+	public String getCompanyIntroduction() {
+		return companyIntroduction;
+	}
+
+	public void setCompanyIntroduction(String companyIntroduction) {
+		this.companyIntroduction = companyIntroduction;
+	}
+	
+	
+
+}

+ 106 - 0
src/main/java/com/goafanti/user/bo/UserPartnerDetailBo.java

@@ -0,0 +1,106 @@
+package com.goafanti.user.bo;
+
+public class UserPartnerDetailBo {
+	private String	username;
+
+	private Integer	province;
+
+	private Integer	city;
+
+	private Integer	area;
+
+	private String	engagedField;
+
+	private String	personalProfile;
+
+	private Integer	level;
+
+	private String	abilityLabel;
+
+	private String	personPortraitUrl;
+
+	private String	lifePhotoUrl;
+
+	public String getUsername() {
+		return username;
+	}
+
+	public void setUsername(String username) {
+		this.username = username;
+	}
+
+	public Integer getProvince() {
+		return province;
+	}
+
+	public void setProvince(Integer province) {
+		this.province = province;
+	}
+
+	public Integer getCity() {
+		return city;
+	}
+
+	public void setCity(Integer city) {
+		this.city = city;
+	}
+
+	public Integer getArea() {
+		return area;
+	}
+
+	public void setArea(Integer area) {
+		this.area = area;
+	}
+
+	public String getEngagedField() {
+		return engagedField;
+	}
+
+	public void setEngagedField(String engagedField) {
+		this.engagedField = engagedField;
+	}
+
+	public String getPersonalProfile() {
+		return personalProfile;
+	}
+
+	public void setPersonalProfile(String personalProfile) {
+		this.personalProfile = personalProfile;
+	}
+
+	public Integer getLevel() {
+		return level;
+	}
+
+	public void setLevel(Integer level) {
+		this.level = level;
+	}
+
+	public String getAbilityLabel() {
+		return abilityLabel;
+	}
+
+	public void setAbilityLabel(String abilityLabel) {
+		this.abilityLabel = abilityLabel;
+	}
+
+	public String getPersonPortraitUrl() {
+		return personPortraitUrl;
+	}
+
+	public void setPersonPortraitUrl(String personPortraitUrl) {
+		this.personPortraitUrl = personPortraitUrl;
+	}
+
+	public String getLifePhotoUrl() {
+		return lifePhotoUrl;
+	}
+
+	public void setLifePhotoUrl(String lifePhotoUrl) {
+		this.lifePhotoUrl = lifePhotoUrl;
+	}
+	
+	
+
+}

+ 33 - 21
src/main/java/com/goafanti/user/controller/UserPartnerApiController.java

@@ -1,5 +1,7 @@
 package com.goafanti.user.controller;
 
+import javax.annotation.Resource;
+
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -7,45 +9,55 @@ import org.springframework.web.bind.annotation.RestController;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.enums.UserType;
 import com.goafanti.common.utils.StringUtils;
+import com.goafanti.user.service.UserService;
 
 @RestController
-@RequestMapping(value = "/api/user/Partner")
+@RequestMapping(value = "/api/user/partner")
 public class UserPartnerApiController extends CertifyApiController {
+	@Resource
+	private UserService userService;
 
 	/**
-	 * 个人"伙伴"主页详情
+	 * "伙伴"主页详情
 	 */
-	@RequestMapping(value = "/userDetail", method = RequestMethod.GET)
-	public Result userDetail(String uid) {
+	@RequestMapping(value = "/detail", method = RequestMethod.GET)
+	public Result detail(String uid, Integer type) {
 		Result res = new Result();
+
 		if (StringUtils.isBlank(uid)) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "用户ID"));
 			return res;
 		}
-		return res;
-	}
-	
-	/**
-	 * 组织"伙伴"主页详情
-	 */
-	@RequestMapping(value = "/orgDetail", method = RequestMethod.GET)
-	public Result orgDetail(String uid){
-		Result res = new Result();
-		if (StringUtils.isBlank(uid)) {
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "用户ID"));
+		
+		if (null == type) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "", "用户类型"));
 			return res;
 		}
+
+		if (!UserType.PERSONAL.getCode().equals(type) && !UserType.ORGANIZATION.getCode().equals(type)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户类型"));
+			return res;
+		}
+		
+		if (UserType.PERSONAL.getCode().equals(type)) {
+			res.setData(userService.findUserPartnerDetail(uid));
+		} else {
+			res.setData(userService.findOrgPartnerDetail(uid));
+		}
 		return res;
 	}
-	
+
 	@RequestMapping(value = "/demandList", method = RequestMethod.GET)
-	public Result demandList(){
+	public Result demandList() {
 		Result res = new Result();
 		return res;
 	}
-	
-	/*public Result achievementList(){
-		
-	}*/
+
+	/*
+	 * public Result achievementList(){
+	 * 
+	 * }
+	 */
 }

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

@@ -44,7 +44,7 @@ public interface OrganizationIdentityService {
 
 	int updateOrgDetailByAuditAdmin(OrganizationIdentity oi, String aid, String mid, Integer level);
 
-	Pagination<OrgSubscriberListBo> listSubscriber(Integer level, String field, Integer province, Integer city,
+	Pagination<OrgSubscriberListBo> listSubscriber(String name, Integer level, String field, Integer province, Integer city,
 			Integer area, Integer pNo, Integer pSize);
 
 }

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

@@ -29,7 +29,7 @@ public interface UserIdentityService {
 
 	int updateUserDetailByAuditAdmin(UserIdentity ui, String aid, String mid, Integer level);
 
-	Pagination<UserSubscriberListBo> listSubscriber(Integer level, String field, Integer province, Integer city,
+	Pagination<UserSubscriberListBo> listSubscriber(String name, Integer level, String field, Integer province, Integer city,
 			Integer area, Integer pNo, Integer pSize);
 
 }

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

@@ -12,6 +12,7 @@ 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;
 
 public interface UserService {
 
@@ -51,4 +52,8 @@ public interface UserService {
 
 	String findOrgNameByNameAndMobile(String name, String mobile);
 
+	UserPartnerDetailBo findUserPartnerDetail(String uid);
+
+	Object findOrgPartnerDetail(String uid);
+
 }

+ 5 - 1
src/main/java/com/goafanti/user/service/impl/OrganizationIdentityServiceImpl.java

@@ -229,9 +229,13 @@ public class OrganizationIdentityServiceImpl extends BaseMybatisDao<Organization
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<OrgSubscriberListBo> listSubscriber(Integer level, String field, Integer province, Integer city,
+	public Pagination<OrgSubscriberListBo> listSubscriber(String name, Integer level, String field, Integer province, Integer city,
 			Integer area, Integer pNo, Integer pSize) {
 		Map<String, Object> params = new HashMap<>();
+		
+		if (StringUtils.isNotBlank(name)) {
+			params.put("name", name);
+		}
 
 		if (null != level) {
 			params.put("level", level);

+ 5 - 1
src/main/java/com/goafanti/user/service/impl/UserIdentityServiceImpl.java

@@ -139,9 +139,13 @@ public class UserIdentityServiceImpl extends BaseMybatisDao<UserIdentityMapper>
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<UserSubscriberListBo> listSubscriber(Integer level, String field, Integer province, Integer city,
+	public Pagination<UserSubscriberListBo> listSubscriber(String name, Integer level, String field, Integer province, Integer city,
 			Integer area, Integer pNo, Integer pSize) {
 		Map<String, Object> params = new HashMap<>();
+		
+		if (StringUtils.isNotBlank(name)) {
+			params.put("name", name);
+		}
 
 		if (null != level) {
 			params.put("level", level);

+ 29 - 15
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -30,35 +30,37 @@ import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.user.bo.OrgListBo;
+import com.goafanti.user.bo.OrgPartnerDetailBo;
 import com.goafanti.user.bo.OrgUnitNames;
 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;
 import com.goafanti.user.service.UserService;
 
 @Service
 public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserService {
 	@Autowired
-	private UserMapper					userMapper;
+	private UserMapper						userMapper;
 	@Autowired
-	private OrganizationIdentityMapper	organizationIdentityMapper;
+	private OrganizationIdentityMapper		organizationIdentityMapper;
 	@Autowired
-	private UserIdentityMapper			userIdentityMapper;
+	private UserIdentityMapper				userIdentityMapper;
 	@Autowired
-	private AdminLocationMapper			adminLocationMapper;
+	private AdminLocationMapper				adminLocationMapper;
 	@Autowired
-	private PatentInfoMapper patentInfoMapper;
+	private PatentInfoMapper				patentInfoMapper;
 	@Autowired
-	private CopyrightInfoMapper copyrightInfoMapper;
+	private CopyrightInfoMapper				copyrightInfoMapper;
 	@Autowired
-	private TechProjectMapper techProjectMapper;
+	private TechProjectMapper				techProjectMapper;
 	@Autowired
-	private DemandMapper demandMapper;
+	private DemandMapper					demandMapper;
 	@Autowired
-	private AchievementMapper achievementMapper;
+	private AchievementMapper				achievementMapper;
 	@Autowired
-	private OrgIntellectualPropertyMapper orgIntellectualPropertyMapper;
+	private OrgIntellectualPropertyMapper	orgIntellectualPropertyMapper;
 
 	@Override
 	public User insertRegister(User user, String contacts, String unitName) {
@@ -187,7 +189,8 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 			if (null != cityList && cityList.size() > 0) {
 				params.put("cityList", cityList);
 			}
-			return (Pagination<UserListBo>) findPage("findAreaManagerUserListByPage", "findAreaManagerUserCount", params, pageNo, pageSize);
+			return (Pagination<UserListBo>) findPage("findAreaManagerUserListByPage", "findAreaManagerUserCount",
+					params, pageNo, pageSize);
 		} else if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
 			return (Pagination<UserListBo>) findPage("findUserListByPage", "findUserCount", params, pageNo, pageSize);
 		}
@@ -252,11 +255,12 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 		if (pageSize == null || pageSize < 0) {
 			pageSize = 10;
 		}
-		
-		if (TokenManager.hasRole(AFTConstants.SUPERADMIN)){
+
+		if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
 			return (Pagination<OrgListBo>) findPage("findOrgListByPage", "findOrgCount", params, pageNo, pageSize);
-		} else if (TokenManager.hasRole(AFTConstants.AREAADMIN) || TokenManager.hasRole(AFTConstants.MANAGERADMIN)){
-			return (Pagination<OrgListBo>) findPage("findAreaManagerOrgListByPage", "findAreaManagerOrgCount", params, pageNo, pageSize);
+		} else if (TokenManager.hasRole(AFTConstants.AREAADMIN) || TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
+			return (Pagination<OrgListBo>) findPage("findAreaManagerOrgListByPage", "findAreaManagerOrgCount", params,
+					pageNo, pageSize);
 		}
 		return null;
 	}
@@ -337,4 +341,14 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 		return userMapper.findOrgByNameAndMobile(name, mobile);
 	}
 
+	@Override
+	public UserPartnerDetailBo findUserPartnerDetail(String uid) {
+		return userMapper.findUserPartnerDetail(uid);
+	}
+
+	@Override
+	public OrgPartnerDetailBo findOrgPartnerDetail(String uid) {
+		return userMapper.findOrgPartnerDetail(uid);
+	}
+
 }