Antiloveg 8 years ago
parent
commit
67816d571f

+ 22 - 3
src/main/java/com/goafanti/achievement/service/impl/AchievementServiceImpl.java

@@ -28,6 +28,8 @@ import com.goafanti.common.dao.AchievementKeywordMapper;
 import com.goafanti.common.dao.AchievementMapper;
 import com.goafanti.common.dao.DemandKeywordMapper;
 import com.goafanti.common.dao.NoticeMapper;
+import com.goafanti.common.dao.OrganizationIdentityMapper;
+import com.goafanti.common.dao.UserIdentityMapper;
 import com.goafanti.common.dao.UserRoleMapper;
 import com.goafanti.common.enums.AchievementAuditStatus;
 import com.goafanti.common.enums.AchievementReleaseStatus;
@@ -43,6 +45,8 @@ import com.goafanti.common.model.AchievementDemandCount;
 import com.goafanti.common.model.AchievementKeyword;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.Notice;
+import com.goafanti.common.model.OrganizationIdentity;
+import com.goafanti.common.model.UserIdentity;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -70,6 +74,10 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 	private DemandKeywordMapper				demandKeywordMapper;
 	@Autowired
 	private AchievementDemandCountMapper	achievementDemandCountMapper;
+	@Autowired
+	private UserIdentityMapper				userIdentityMapper;
+	@Autowired
+	private OrganizationIdentityMapper		organizationIdentityMapper;
 
 	@SuppressWarnings("unchecked")
 	@Override
@@ -156,7 +164,7 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 				AchievementDemandCount adc = achievementDemandCountMapper.selectByUid(a.getOwnerId());
 				if (null != adc) {
 					adc.setAchievementCount(adc.getAchievementCount() - 1);
-					if (adc.getAchievementCount() < 0){
+					if (adc.getAchievementCount() < 0) {
 						adc.setAchievementCount(0);
 					}
 					achievementDemandCountMapper.updateByPrimaryKeySelective(adc);
@@ -260,6 +268,17 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 			a.setTechBrokerId(techBroderId);
 			String ownerId = a.getOwnerId();
 			if (StringUtils.isNotBlank(ownerId)) {
+				if (UserType.PERSONAL.getCode().equals(a.getOwnerType())){
+					UserIdentity ui = userIdentityMapper.selectUserIdentityByUserId(ownerId);
+					if (null != ui){
+						a.setOwnerName(ui.getUsername());
+					}
+				} else if (UserType.ORGANIZATION.getCode().equals(a.getOwnerType())){
+					OrganizationIdentity oi = organizationIdentityMapper.selectOrgIdentityByUserId(ownerId);
+					if (null != oi){
+						a.setOwnerName(oi.getUnitName());
+					}
+				}
 				AchievementDemandCount adc = achievementDemandCountMapper.selectByUid(ownerId);
 				if (null == adc) {
 					AchievementDemandCount achievementDemandCount = new AchievementDemandCount();
@@ -290,8 +309,8 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 		if (StringUtils.isNotBlank(a.getOwnerId())) {
 			AchievementDemandCount adc = achievementDemandCountMapper.selectByUid(a.getOwnerId());
 			if (null != adc) {
-				adc.setAchievementCount(adc.getAchievementCount() - 1); 
-				if (adc.getAchievementCount() < 0){
+				adc.setAchievementCount(adc.getAchievementCount() - 1);
+				if (adc.getAchievementCount() < 0) {
 					adc.setAchievementCount(0);
 				}
 				achievementDemandCountMapper.updateByPrimaryKeySelective(adc);

+ 3 - 5
src/main/java/com/goafanti/common/mapper/AchievementMapper.xml

@@ -984,13 +984,12 @@
   	select 
   		a.id, a.name, a.keyword,
   		a.serial_number as serialNumber, a.data_category as dataCategory, a.category,
-  		a.release_date as releaseDate, a.owner_type as ownerType, ui.username,
-  		oi.unit_name as unitName, a.field_a as fieldA, a.field_b as fieldB,
+  		a.release_date as releaseDate, a.owner_type as ownerType, 
+  		a.owner_name as ownerName,
+  		a.field_a as fieldA, a.field_b as fieldB,
   		a.transfer_price as transferPrice, a.maturity, a.transfer_mode as transferMode,
   		a.bargaining_mode as bargainingMode, u.lvl as level
   	from achievement a 
-  	left join user_identity ui on ui.uid = a.owner_id
-  	left join organization_identity oi on oi.uid = a.owner_id
   	left join user u on u.id = a.owner_id
   	where a.deleted_sign = 0 
   	<if test="keyword != null">
@@ -1002,7 +1001,6 @@
   	<if test="bargainingMode != null">
   		and a.bargaining_mode = #{bargainingMode,jdbcType=INTEGER}
   	</if>
-  	
   	<if test="maturity != null">
   		and a.maturity = #{maturity,jdbcType=INTEGER}
   	</if>

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

@@ -906,11 +906,9 @@
 	  		d.id, d.name, d.keyword,
 	  		d.serial_number as serialNumber, d.data_category as dataCategory, d.industry_category_a as industryCategoryA,
 	  		d.industry_category_b as industryCategoryB, d.demand_type as demandType, d.budget_cost as budgetCost,
-	  		d.problem_des as problemDes, d.release_date as releaseDate, ui.username,
-	  		oi.unit_name as unitName, u.lvl as level
+	  		d.problem_des as problemDes, d.release_date as releaseDate, a.employer_name as employerName,
+	  	 u.lvl as level
   		from demand d
-  		left join user_identity ui on d.employer_id = ui.uid
-  		left join organization_identity oi on d.employer_id = oi.uid
   		left join user u on u.id = d.employer_id
   		where d.deleted_sign = 0 and d.status = 0
   		<if test="keyword != null">

+ 23 - 4
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -23,6 +23,8 @@ import com.goafanti.common.dao.AchievementKeywordMapper;
 import com.goafanti.common.dao.DemandKeywordMapper;
 import com.goafanti.common.dao.DemandMapper;
 import com.goafanti.common.dao.NoticeMapper;
+import com.goafanti.common.dao.OrganizationIdentityMapper;
+import com.goafanti.common.dao.UserIdentityMapper;
 import com.goafanti.common.dao.UserMapper;
 import com.goafanti.common.dao.UserRoleMapper;
 import com.goafanti.common.enums.DeleteStatus;
@@ -39,7 +41,9 @@ import com.goafanti.common.model.AchievementDemandCount;
 import com.goafanti.common.model.Demand;
 import com.goafanti.common.model.DemandKeyword;
 import com.goafanti.common.model.Notice;
+import com.goafanti.common.model.OrganizationIdentity;
 import com.goafanti.common.model.User;
+import com.goafanti.common.model.UserIdentity;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -73,6 +77,10 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	private AchievementKeywordMapper		achievementKeywordMapper;
 	@Autowired
 	private AchievementDemandCountMapper	achievementDemandCountMapper;
+	@Autowired
+	private UserIdentityMapper				userIdentityMapper;
+	@Autowired
+	private OrganizationIdentityMapper		organizationIdentityMapper;
 
 	@SuppressWarnings("unchecked")
 	@Override
@@ -210,7 +218,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 				AchievementDemandCount adc = achievementDemandCountMapper.selectByUid(d.getEmployerId());
 				if (null != adc) {
 					adc.setDemandCount(adc.getDemandCount() - 1);
-					if (adc.getDemandCount() < 0){
+					if (adc.getDemandCount() < 0) {
 						adc.setDemandCount(0);
 					}
 					achievementDemandCountMapper.updateByPrimaryKeySelective(adc);
@@ -263,7 +271,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 			AchievementDemandCount adc = achievementDemandCountMapper.selectByUid(d.getEmployerId());
 			if (null != adc) {
 				adc.setDemandCount(adc.getDemandCount() - 1);
-				if (adc.getDemandCount() < 0){
+				if (adc.getDemandCount() < 0) {
 					adc.setDemandCount(0);
 				}
 				achievementDemandCountMapper.updateByPrimaryKeySelective(adc);
@@ -284,6 +292,17 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 			d.setTechBrokerId(techBroderId);
 			String employerId = d.getEmployerId();
 			if (StringUtils.isNotBlank(employerId)) {
+				if (UserType.PERSONAL.getCode().equals(d.getDataCategory())) {
+					UserIdentity ui = userIdentityMapper.selectUserIdentityByUserId(employerId);
+					if (null != ui) {
+						d.setEmployerName(ui.getUsername());
+					}
+				} else if (UserType.ORGANIZATION.getCode().equals(d.getDataCategory())) {
+					OrganizationIdentity oi = organizationIdentityMapper.selectOrgIdentityByUserId(employerId);
+					if (null != oi) {
+						d.setEmployerName(oi.getUnitName());
+					}
+				}
 				AchievementDemandCount adc = achievementDemandCountMapper.selectByUid(employerId);
 				if (null == adc) {
 					AchievementDemandCount achievementDemandCount = new AchievementDemandCount();
@@ -390,11 +409,11 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 			params.put("keyword", keyword);
 		}
 
-		if (null != industryCategoryA ) {
+		if (null != industryCategoryA) {
 			params.put("industryCategoryA", industryCategoryA);
 		}
 
-		if (null != industryCategoryB ) {
+		if (null != industryCategoryB) {
 			params.put("industryCategoryB", industryCategoryB);
 		}
 

+ 6 - 19
src/main/java/com/goafanti/portal/bo/AchievementSearchListBo.java

@@ -38,14 +38,9 @@ public class AchievementSearchListBo {
 	private Integer		category;
 
 	/**
-	 * 所有人名称(个人)
+	 * 成果所有人名称
 	 */
-	private String		username;
-
-	/**
-	 * 所有人名称(组织)
-	 */
-	private String		unitName;
+	private String		ownerName;
 
 	/**
 	 * 发布时间
@@ -151,20 +146,12 @@ public class AchievementSearchListBo {
 		this.category = category;
 	}
 
-	public String getUsername() {
-		return username;
-	}
-
-	public void setUsername(String username) {
-		this.username = username;
-	}
-
-	public String getUnitName() {
-		return unitName;
+	public String getOwnerName() {
+		return ownerName;
 	}
 
-	public void setUnitName(String unitName) {
-		this.unitName = unitName;
+	public void setOwnerName(String ownerName) {
+		this.ownerName = ownerName;
 	}
 
 	public Date getReleaseDate() {

+ 10 - 22
src/main/java/com/goafanti/portal/bo/DemandSearchListBo.java

@@ -65,20 +65,23 @@ public class DemandSearchListBo {
 	private Date releaseDate;
 	
 	/**
-	 * 个人雇主名称
+	 * 雇主名称
 	 */
-	private String username;
-	
-	/**
-	 * 组织雇主名称
-	 */
-	private String unitName;
+	private String employerName;
 	
 	/**
 	 * 用户等级
 	 */
 	private Integer level;
 	
+	public String getEmployerName() {
+		return employerName;
+	}
+
+	public void setEmployerName(String employerName) {
+		this.employerName = employerName;
+	}
+
 	public Integer getLevel() {
 		return level;
 	}
@@ -179,21 +182,6 @@ public class DemandSearchListBo {
 		this.releaseDate = releaseDate;
 	}
 	
-	public String getUsername() {
-		return username;
-	}
-
-	public void setUsername(String username) {
-		this.username = username;
-	}
-
-	public String getUnitName() {
-		return unitName;
-	}
-
-	public void setUnitName(String unitName) {
-		this.unitName = unitName;
-	}
 
 	public String getReleaseDateFormattedDate() {
 		if (this.releaseDate == null) {