Antiloveg лет назад: 8
Родитель
Сommit
2d96541832

+ 4 - 1
schema/2017-05-24.sql

@@ -15,4 +15,7 @@ ENGINE = InnoDB
 COMMENT = '科技成果关键词';
 
 alter table `achievement` 
-modify column `contacts`  int(1) comment '联系人及方式';
+modify column `contacts`  int(1) NULL comment '联系人及方式';
+
+alter table `achievement_keyword` 
+modify column `keyword`  VARCHAR(16) NOT NULL COMMENT '科技成果关键词';

+ 33 - 0
src/main/java/com/goafanti/admin/controller/AdminAchievementApiController.java

@@ -25,12 +25,45 @@ import com.goafanti.common.enums.AchievementFields;
 import com.goafanti.common.enums.AttachmentType;
 import com.goafanti.common.model.Achievement;
 import com.goafanti.common.utils.StringUtils;
+import com.goafanti.user.service.UserService;
 
 @RestController
 @RequestMapping(value = "/api/admin/achievement")
 public class AdminAchievementApiController extends CertifyApiController {
 	@Resource
 	private AchievementService achievementService;
+	@Resource
+	private UserService userService;
+	
+	/**
+	 * 个人成果所有人列表
+	 */
+	@RequestMapping(value = "/userOwner", method = RequestMethod.GET)
+	public Result getAchievementUserOwner(String name){
+		Result res = new Result();
+		if (StringUtils.isBlank(name)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果所有人", "成果所有人"));
+			return res;
+		}
+		res.setData(userService.selectAchievementUserOwner(name));
+		return res;
+	}
+	
+	/**
+	 * 组织成果所有人列表
+	 */
+	@RequestMapping(value = "/orgOwner", method = RequestMethod.GET)
+	public Result getAchievementOrgOwner(String name){
+		Result res = new Result();
+		if (StringUtils.isBlank(name)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到成果所有人", "成果所有人"));
+			return res;
+		}
+		res.setData(userService.selectAchievementOrgOwner(name));
+		return res;
+	}
+	
+	
 
 	/**
 	 * 成果撤消发布(下架)

+ 5 - 3
src/main/java/com/goafanti/common/dao/OrganizationIdentityMapper.java

@@ -2,13 +2,14 @@ package com.goafanti.common.dao;
 
 import java.util.List;
 
+import org.apache.ibatis.annotations.Param;
+
 import com.goafanti.common.model.OrganizationIdentity;
 import com.goafanti.user.bo.AuditorOrgIdentityDetailBo;
 import com.goafanti.user.bo.OrgBasicInfoBo;
 import com.goafanti.user.bo.OrgIdentityBo;
 import com.goafanti.user.bo.OrgIdentityDetailBo;
 import com.goafanti.user.bo.OrgUnitNames;
-import com.goafanti.user.bo.UserNames;
 
 public interface OrganizationIdentityMapper {
     int deleteByPrimaryKey(String id);
@@ -37,7 +38,8 @@ public interface OrganizationIdentityMapper {
 
 	List<OrgUnitNames> selectManagerUnitNames(String aid);
 
-	List<UserNames> selectManagerUserNames(String aid);
+	List<OrgUnitNames> selectManagerAchievementOrgOwner(@Param("aid")String aid, @Param("name")String name);
+
+	List<OrgUnitNames> selectAchievementOrgOwner(@Param("aid")String aid, @Param("name")String name);
 
-	List<UserNames> selectAllUserNames(String aid);
 }

+ 13 - 0
src/main/java/com/goafanti/common/dao/UserIdentityMapper.java

@@ -1,8 +1,13 @@
 package com.goafanti.common.dao;
 
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
 import com.goafanti.common.model.UserIdentity;
 import com.goafanti.user.bo.AuditorUserIdentityDetailBo;
 import com.goafanti.user.bo.UserIdentityBo;
+import com.goafanti.user.bo.UserNames;
 
 public interface UserIdentityMapper {
     int deleteByPrimaryKey(String id);
@@ -22,4 +27,12 @@ public interface UserIdentityMapper {
 	UserIdentityBo selectUserIdentityBoByUserId(String uid);
 
 	AuditorUserIdentityDetailBo selectAuditorUserIdentityByUserId(String uid);
+
+	List<UserNames> selectManagerUserNames(String aid);
+
+	List<UserNames> selectAllUserNames(String aid);
+
+	List<UserNames> selectManagerAchievementUserOwner(@Param("aid")String aid, @Param("name")String name);
+
+	List<UserNames> selectAchievementUserOwner(@Param("aid")String aid, @Param("name")String name);
 }

+ 24 - 23
src/main/java/com/goafanti/common/mapper/OrganizationIdentityMapper.xml

@@ -1024,10 +1024,10 @@
 		parameterType="java.lang.String">
 		select u.id as uid, i.unit_name as unitName
 		from user u INNER JOIN
-		organization_identity i on u.id = i.uid and u.lvl = 1
-		and
+		organization_identity i on u.id = i.uid 
+		where
 		i.audit_status = 5
-		where 1 = 1
+		 and u.lvl = 1
 		<if test="_parameter != null">
 			and u.aid = #{aid,jdbcType=VARCHAR}
 		</if>
@@ -1116,40 +1116,41 @@
 		parameterType="java.lang.String">
 		select u.id as uid, i.unit_name as unitName
 		from user u INNER JOIN
-		organization_identity i on u.id = i.uid and u.lvl = 1
-		and
-		i.audit_status = 5
-		where 1 = 1
+		organization_identity i on u.id = i.uid 
+		where
+		i.audit_status = 5 and u.lvl = 1
 		<if test="_parameter != null">
 			and u.mid = #{aid,jdbcType=VARCHAR}
 		</if>
 	</select>
 	
-	<select id="selectManagerUserNames" resultType="com.goafanti.user.bo.UserNames"
-		parameterType="java.lang.String">
-		select u.id as uid, i.username
+	<select id="selectManagerAchievementOrgOwner" resultType="com.goafanti.user.bo.OrgUnitNames"
+		>
+		select u.id as uid, i.unit_name as unitName
 		from user u INNER JOIN
-		user_identity i on u.id = i.uid and u.lvl = 1
-		and
-		i.audit_status = 5
-		where 1 = 1
-		<if test="_parameter != null">
+		organization_identity i on u.id = i.uid 
+		where
+		i.audit_status = 5 and u.lvl = 1 and i.unit_name like
+				"%"#{name,jdbcType=VARCHAR}"%" 
+		<if test="aid != null">
 			and u.mid = #{aid,jdbcType=VARCHAR}
 		</if>
 	</select>
 	
-	<select id="selectAllUserNames" resultType="com.goafanti.user.bo.UserNames"
-		parameterType="java.lang.String">
-		select u.id as uid, i.username
+	<select id="selectAchievementOrgOwner" resultType="com.goafanti.user.bo.OrgUnitNames"
+		>
+		select u.id as uid, i.unit_name as unitName
 		from user u INNER JOIN
-		user_identity i on u.id = i.uid and u.lvl = 1
-		and
-		i.audit_status = 5
-		where 1 = 1
-		<if test="_parameter != null">
+		organization_identity i on u.id = i.uid 
+		where
+		i.audit_status = 5 and u.lvl = 1 and i.unit_name like
+				"%"#{name,jdbcType=VARCHAR}"%"
+		<if test="aid != null">
 			and u.aid = #{aid,jdbcType=VARCHAR}
 		</if>
 	</select>
+	
+	
 
 
 </mapper>

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

@@ -316,4 +316,55 @@
   	LEFT JOIN user_identity ui on u.id = ui.uid
   	where u.id = #{uid,jdbcType=VARCHAR}
   </select>
+  
+  <select id="selectManagerUserNames" resultType="com.goafanti.user.bo.UserNames"
+		parameterType="java.lang.String">
+		select u.id as uid, i.username
+		from user u INNER JOIN
+		user_identity i on u.id = i.uid 
+		where
+		i.audit_status = 5 and u.lvl = 1
+		<if test="_parameter != null">
+			and u.mid = #{aid,jdbcType=VARCHAR}
+		</if>
+	</select>
+	
+	<select id="selectAllUserNames" resultType="com.goafanti.user.bo.UserNames"
+		parameterType="java.lang.String">
+		select u.id as uid, i.username
+		from user u INNER JOIN
+		user_identity i on u.id = i.uid 
+		where
+		i.audit_status = 5 and u.lvl = 1
+		<if test="_parameter != null">
+			and u.aid = #{aid,jdbcType=VARCHAR}
+		</if>
+	</select>
+	
+	<select id="selectManagerAchievementUserOwner" resultType="com.goafanti.user.bo.UserNames">
+		select u.id as uid, ui.username, u.mobile
+			from user u INNER JOIN 
+			user_identity ui on u.id = ui.uid
+			where 
+				ui.audit_status = 5 and u.lvl = 1 and ui.username like
+				"%"#{name,jdbcType=VARCHAR}"%"
+			<if test="aid != null">
+				and u.mid = #{aid,jdbcType=VARCHAR}
+			</if>
+			
+	</select>
+	
+	<select id="selectAchievementUserOwner" resultType="com.goafanti.user.bo.UserNames">
+		select u.id as uid, ui.username, u.mobile
+			from user u INNER JOIN 
+			user_identity ui on u.id = ui.uid
+			where 
+				ui.audit_status = 5 and u.lvl = 1 and ui.username like
+				"%"#{name,jdbcType=VARCHAR}"%"
+			<if test="aid != null">
+				and u.aid = #{aid,jdbcType=VARCHAR}
+			</if>
+			
+	</select>
+  
 </mapper>

+ 10 - 0
src/main/java/com/goafanti/user/bo/OrgUnitNames.java

@@ -4,6 +4,16 @@ public class OrgUnitNames {
 	private String uid;
 	
 	private String unitName;
+	
+	private String mobile;
+	
+	public String getMobile() {
+		return mobile;
+	}
+
+	public void setMobile(String mobile) {
+		this.mobile = mobile;
+	}
 
 	public String getUid() {
 		return uid;

+ 12 - 0
src/main/java/com/goafanti/user/bo/UserNames.java

@@ -5,6 +5,8 @@ public class UserNames {
 	private String	uid;
 
 	private String	username;
+	
+	private String mobile;
 
 	public String getUid() {
 		return uid;
@@ -21,6 +23,16 @@ public class UserNames {
 	public void setUsername(String username) {
 		this.username = username;
 	}
+
+	public String getMobile() {
+		return mobile;
+	}
+
+	public void setMobile(String mobile) {
+		this.mobile = mobile;
+	}
+	
+	
 	
 	
 

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

@@ -2,6 +2,7 @@ package com.goafanti.user.service;
 
 import java.text.ParseException;
 import java.util.List;
+import java.util.Map;
 
 import com.goafanti.common.model.User;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -42,4 +43,8 @@ public interface UserService {
 
 	List<UserNames> selectDemandUserNames();
 
+	Map<String, String> selectAchievementUserOwner(String name);
+
+	List<OrgUnitNames> selectAchievementOrgOwner(String name);
+
 }

+ 96 - 80
src/main/java/com/goafanti/user/service/impl/UserServiceImpl.java

@@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
 
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.OrganizationIdentityMapper;
-import com.goafanti.common.dao.OrganizationInfoMapper;
+import com.goafanti.common.dao.UserIdentityMapper;
 import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.model.OrganizationIdentity;
 import com.goafanti.common.model.User;
@@ -29,23 +29,20 @@ import com.goafanti.user.bo.UserNames;
 import com.goafanti.user.bo.UserPageHomeBo;
 import com.goafanti.user.service.UserService;
 
-
-
 @Service
 public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserService {
 	@Autowired
-	UserMapper userMapper;
+	private UserMapper					userMapper;
 	@Autowired
-	OrganizationInfoMapper organizationInfoMapper;
+	private OrganizationIdentityMapper	organizationIdentityMapper;
 	@Autowired
-	OrganizationIdentityMapper organizationIdentityMapper;
-	
-	
+	private UserIdentityMapper			userIdentityMapper;
+
 	@Override
-	public User insertRegister(User user,String contacts,String unitName) {
+	public User insertRegister(User user, String contacts, String unitName) {
 		userMapper.insert(user);
-		if (null != user.getType() && 1 == user.getType()){
-			if (!StringUtils.isBlank(unitName) || !StringUtils.isBlank(contacts)){
+		if (null != user.getType() && 1 == user.getType()) {
+			if (!StringUtils.isBlank(unitName) || !StringUtils.isBlank(contacts)) {
 				OrganizationIdentity organizationIdentity = new OrganizationIdentity();
 				organizationIdentity.setUid(user.getId());
 				organizationIdentity.setUnitName(StringUtils.isBlank(unitName) ? "" : unitName);
@@ -59,15 +56,15 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 				organizationIdentity.setListedType(0);
 				organizationIdentityMapper.insert(organizationIdentity);
 			}
-	    }
+		}
 		return user;
 	}
-    
+
 	@Override
 	public User selectByMobieAndType(java.lang.String mobile, Integer type) {
-		return userMapper.selectByMobieAndType(mobile,type);
+		return userMapper.selectByMobieAndType(mobile, type);
 	}
-	
+
 	@Override
 	public User selectByPrimaryKey(String id) {
 		return userMapper.selectByPrimaryKey(id);
@@ -101,47 +98,47 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<UserListBo> listUser(String mobile, String email, String[] pDate, Integer number,
-			String unitName, Integer auditStatus, Integer pageNo, Integer pageSize) throws ParseException {
+	public Pagination<UserListBo> listUser(String mobile, String email, String[] pDate, Integer number, String unitName,
+			Integer auditStatus, Integer pageNo, Integer pageSize) throws ParseException {
 		Map<String, Object> params = new HashMap<>();
 		Date pStart = null;
 		Date pEnd = null;
-		
-		if (null != pDate ){
+
+		if (null != pDate) {
 			pStart = DateUtils.parseDate(pDate[0], AFTConstants.YYYYMMDD);
-			if (pDate.length == 2){
+			if (pDate.length == 2) {
 				pEnd = DateUtils.addDays(DateUtils.parseDate(pDate[1], AFTConstants.YYYYMMDD), 1);
 			}
 		}
-		 
-		if (null != pStart){
+
+		if (null != pStart) {
 			params.put("pStart", pStart);
 		}
-		
-		if (null != pEnd){
+
+		if (null != pEnd) {
 			params.put("pEnd", pEnd);
 		}
-		
-		if (!StringUtils.isBlank(mobile)){
+
+		if (!StringUtils.isBlank(mobile)) {
 			params.put("mobile", mobile);
 		}
-		
-		if (!StringUtils.isBlank(email)){
+
+		if (!StringUtils.isBlank(email)) {
 			params.put("email", email);
 		}
-		
-		if (null != number ){
+
+		if (null != number) {
 			params.put("number", number);
 		}
-		
-		if (!StringUtils.isBlank(unitName)){
+
+		if (!StringUtils.isBlank(unitName)) {
 			params.put("unitName", unitName);
 		}
-		
-		if (null != auditStatus){
+
+		if (null != auditStatus) {
 			params.put("auditStatus", auditStatus);
 		}
-		
+
 		if (pageNo == null || pageNo < 0) {
 			pageNo = 1;
 		}
@@ -149,10 +146,9 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 		if (pageSize == null || pageSize < 0) {
 			pageSize = 10;
 		}
-		return (Pagination<UserListBo>) findPage("findUserListByPage","findUserCount", params, pageNo,
-				pageSize);
+		return (Pagination<UserListBo>) findPage("findUserListByPage", "findUserCount", params, pageNo, pageSize);
 	}
-	
+
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<OrgListBo> listOrg(String uid, String mobile, String email, String[] pDate, Integer number,
@@ -160,49 +156,50 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 		Map<String, Object> params = new HashMap<>();
 		Date pStart = null;
 		Date pEnd = null;
-		
-		if (null != pDate && pDate.length > 0){
+
+		if (null != pDate && pDate.length > 0) {
 			pStart = StringUtils.isBlank(pDate[0]) ? null : DateUtils.parseDate(pDate[0], AFTConstants.YYYYMMDD);
-			pEnd = StringUtils.isBlank(pDate[1]) ? null : DateUtils.addDays(DateUtils.parseDate(pDate[1], AFTConstants.YYYYMMDD), 1);
-			
+			pEnd = StringUtils.isBlank(pDate[1]) ? null
+					: DateUtils.addDays(DateUtils.parseDate(pDate[1], AFTConstants.YYYYMMDD), 1);
+
 			pStart = DateUtils.parseDate(pDate[0], AFTConstants.YYYYMMDD);
-			if (pDate.length == 2){
+			if (pDate.length == 2) {
 				pEnd = DateUtils.addDays(DateUtils.parseDate(pDate[1], AFTConstants.YYYYMMDD), 1);
 			}
 		}
-		 
-		if (null != pStart){
+
+		if (null != pStart) {
 			params.put("pStart", pStart);
 		}
-		
-		if (null != pEnd){
+
+		if (null != pEnd) {
 			params.put("pEnd", pEnd);
 		}
-		
-		if (!StringUtils.isBlank(mobile)){
+
+		if (!StringUtils.isBlank(mobile)) {
 			params.put("mobile", mobile);
 		}
-		
-		if (!StringUtils.isBlank(uid)){
+
+		if (!StringUtils.isBlank(uid)) {
 			params.put("uid", uid);
 		}
-		
-		if (!StringUtils.isBlank(email)){
+
+		if (!StringUtils.isBlank(email)) {
 			params.put("email", email);
 		}
-		
-		if (null != number ){
+
+		if (null != number) {
 			params.put("number", number);
 		}
-		
-		if (!StringUtils.isBlank(aftUsername)){
+
+		if (!StringUtils.isBlank(aftUsername)) {
 			params.put("aftUsername", aftUsername);
 		}
-		
-		if (null != auditStatus){
+
+		if (null != auditStatus) {
 			params.put("auditStatus", auditStatus);
 		}
-		
+
 		if (pageNo == null || pageNo < 0) {
 			pageNo = 1;
 		}
@@ -210,8 +207,7 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 		if (pageSize == null || pageSize < 0) {
 			pageSize = 10;
 		}
-		return (Pagination<OrgListBo>) findPage("findOrgListByPage","findOrgCount", params, pageNo,
-				pageSize);
+		return (Pagination<OrgListBo>) findPage("findOrgListByPage", "findOrgCount", params, pageNo, pageSize);
 	}
 
 	@Override
@@ -222,10 +218,10 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 	@Override
 	public List<OrgUnitNames> selectDemandUnitNames() {
 		String aid = TokenManager.getAdminId();
-		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)){
+		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
 			return organizationIdentityMapper.selectManagerUnitNames(aid);
 		} else {
-			if (TokenManager.hasRole(AFTConstants.SUPERADMIN)){
+			if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
 				aid = null;
 			}
 			return organizationIdentityMapper.selectAllOrgIndentity(aid);
@@ -235,30 +231,50 @@ public class UserServiceImpl extends BaseMybatisDao<UserMapper> implements UserS
 	@Override
 	public List<UserNames> selectDemandUserNames() {
 		String aid = TokenManager.getAdminId();
-		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)){
-			return organizationIdentityMapper.selectManagerUserNames(aid);
+		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
+			return userIdentityMapper.selectManagerUserNames(aid);
 		} else {
-			if (TokenManager.hasRole(AFTConstants.SUPERADMIN)){
+			if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
 				aid = null;
 			}
-			return organizationIdentityMapper.selectAllUserNames(aid);
+			return userIdentityMapper.selectAllUserNames(aid);
 		}
 	}
 
-
-
-
+	@Override
+	public Map<String, String> selectAchievementUserOwner(String name) {
+		String aid = TokenManager.getAdminId();
+		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
+			return disposeAchievementUserOwner(userIdentityMapper.selectManagerAchievementUserOwner(aid, name));
+		} else {
+			if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
+				aid = null;
+			}
+			return disposeAchievementUserOwner(userIdentityMapper.selectAchievementUserOwner(aid, name));
+		}
+	}
 	
+	public List<OrgUnitNames> selectAchievementOrgOwner(String name){
+		String aid = TokenManager.getAdminId();
+		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
+			return organizationIdentityMapper.selectManagerAchievementOrgOwner(aid, name);
+		} else {
+			if (TokenManager.hasRole(AFTConstants.SUPERADMIN)) {
+				aid = null;
+			}
+			return organizationIdentityMapper.selectAchievementOrgOwner(aid, name);
+		}
+	}
 
-	
-	
-	
-	
-	
-	
-	
-	
-	
+	private Map<String, String> disposeAchievementUserOwner(List<UserNames> list) {
+		Map<String, String> map = new HashMap<>();
+		if (null != list && list.size() > 0) {
+			for(UserNames u : list){
+				map.put(u.getUid(), u.getUsername() + " " + u.getMobile());
+			}
+		}
+		return map;
+	}
 	
 
 }