Browse Source

techBroker

Antiloveg 8 years ago
parent
commit
eb7d88bc34

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

@@ -481,18 +481,18 @@
 	from  demand d 
 	LEFT JOIN user_identity ui on d.employer_id = ui.uid
 	LEFT JOIN admin a on a.id = d.tech_broker_id
-	<if test="mid != null">
+	<if test="adminId != null">
 		LEFT JOIN user u on d.employer_id = u.id
 	</if>
 	where d.deleted_sign = 0 and d.data_category = 0 
-	<if test="mid != null">
-		and u.mid = #{mid,jdbcType=VARCHAR}
+	<if test="adminId != null">
+		and u.mid = #{adminId,jdbcType=VARCHAR}
 	</if>
-	<if test="principal != null">
-		and  d.principal_id = #{principal,jdbcType=VARCHAR}
+	<if test="adminId != null">
+		or  d.principal_id = #{adminId,jdbcType=VARCHAR}
 	</if>
-	<if test="techBroker != null">
-		and  d.tech_broker_id = #{techBroker,jdbcType=VARCHAR}
+	<if test="adminId != null">
+		or  d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
 	</if>
 	<if test="province != null">
 		and  ui.province = #{province,jdbcType=INTEGER}
@@ -551,18 +551,18 @@
 	from  demand d 
 	LEFT JOIN user_identity ui on d.employer_id = ui.uid
 	LEFT JOIN admin a on a.id = d.tech_broker_id
-	<if test="mid != null">
+	<if test="adminId != null">
 		LEFT JOIN user u on d.employer_id = u.id
 	</if>
 	where d.deleted_sign = 0 and d.data_category = 0 
-	<if test="mid != null">
-		and u.mid = #{mid,jdbcType=VARCHAR}
+	<if test="adminId != null">
+		and u.mid = #{adminId,jdbcType=VARCHAR}
 	</if>
-	<if test="principal != null">
-		and  d.principal_id = #{principal,jdbcType=VARCHAR}
+	<if test="adminId != null">
+		or  d.principal_id = #{adminId,jdbcType=VARCHAR}
 	</if>
-	<if test="techBroker != null">
-		and  d.tech_broker_id = #{techBroker,jdbcType=VARCHAR}
+	<if test="adminId != null">
+		or  d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
 	</if>
 	<if test="serialNumber != null">
 		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}
@@ -623,18 +623,18 @@
 	from  demand d 
 	LEFT JOIN organization_identity oi on d.employer_id = oi.uid
 	LEFT JOIN admin a on a.id = d.tech_broker_id
-	<if test="mid != null">
+	<if test="adminId != null">
 		LEFT JOIN user u on d.employer_id = u.id
 	</if>
 	where d.deleted_sign = 0 and d.data_category = 1 
-	<if test="mid != null">
-		and u.mid = #{mid,jdbcType=VARCHAR}
+	<if test="adminId != null">
+		and u.mid = #{adminId,jdbcType=VARCHAR}
 	</if>
-	<if test="principal != null">
-		and  d.principal_id = #{principal,jdbcType=VARCHAR}
+	<if test="adminId != null">
+		or  d.principal_id = #{adminId,jdbcType=VARCHAR}
 	</if>
-	<if test="techBroker != null">
-		and  d.tech_broker_id = #{techBroker,jdbcType=VARCHAR}
+	<if test="adminId != null">
+		or  d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
 	</if>
 	<if test="province != null">
 		and  oi.licence_province = #{province,jdbcType=INTEGER}
@@ -693,18 +693,18 @@
 	from  demand d 
 	LEFT JOIN organization_identity oi on d.employer_id = oi.uid
 	LEFT JOIN admin a on a.id = d.tech_broker_id
-	<if test="mid != null">
+	<if test="adminId != null">
 		LEFT JOIN user u on d.employer_id = u.id
 	</if>
 	where d.deleted_sign = 0 and d.data_category = 1
-	<if test="mid != null">
-		and u.mid = #{mid,jdbcType=VARCHAR}
+	<if test="adminId != null">
+		and u.mid = #{adminId,jdbcType=VARCHAR}
 	</if>
-	<if test="principal != null">
-		and  d.principal_id = #{principal,jdbcType=VARCHAR}
+	<if test="adminId != null">
+		or  d.principal_id = #{adminId,jdbcType=VARCHAR}
 	</if>
-	<if test="techBroker != null">
-		and  d.tech_broker_id = #{techBroker,jdbcType=VARCHAR}
+	<if test="adminId != null">
+		or  d.tech_broker_id = #{adminId,jdbcType=VARCHAR}
 	</if>
 	<if test="serialNumber != null">
 		and  d.serial_number = #{serialNumber,jdbcType=INTEGER}

+ 42 - 31
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -85,10 +85,11 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<DemandManageListBo> selectUserDemandManageList(String employerName, Integer auditStatus, Integer province,
-			Integer serialNumber, String name, String keyword, Integer infoSources, Integer demandType,
-			String validityPeriodStartDate, String validityPeriodEndDate, String username, Integer status,
-			Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, Integer pNo, Integer pSize) {
+	public Pagination<DemandManageListBo> selectUserDemandManageList(String employerName, Integer auditStatus,
+			Integer province, Integer serialNumber, String name, String keyword, Integer infoSources,
+			Integer demandType, String validityPeriodStartDate, String validityPeriodEndDate, String username,
+			Integer status, Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, Integer pNo,
+			Integer pSize) {
 
 		Map<String, Object> params = disposeParams(auditStatus, province, serialNumber, name, keyword, infoSources,
 				demandType, validityPeriodStartDate, validityPeriodEndDate, username, status, releaseStatus,
@@ -102,23 +103,27 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 			pSize = 10;
 		}
 
-		if (TokenManager.hasRole(AFTConstants.SALESMANAGERADMIN) || TokenManager.hasRole(AFTConstants.SALESMANADMIN)) {
-			params.put("principal", TokenManager.getAdminId());
-		}
+		/*
+		 * if (TokenManager.hasRole(AFTConstants.SALESMANAGERADMIN) ||
+		 * TokenManager.hasRole(AFTConstants.SALESMANADMIN)) {
+		 * params.put("principal", TokenManager.getAdminId()); }
+		 * 
+		 * if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
+		 * params.put("mid", TokenManager.getAdminId()); }
+		 * 
+		 * if (TokenManager.hasRole(AFTConstants.TECHBROKER)) {
+		 * params.put("techBroker", TokenManager.getAdminId()); }
+		 */
 
-		if (TokenManager.hasRole(AFTConstants.MANAGERADMIN)) {
-			params.put("mid", TokenManager.getAdminId());
-		}
-
-		if (TokenManager.hasRole(AFTConstants.TECHBROKER)) {
-			params.put("techBroker", TokenManager.getAdminId());
+		if (!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.AUDITORADMIN)) {
+			params.put("adminId", TokenManager.getAdminId());
 		}
 		
-		if (StringUtils.isNotBlank(employerName)){
+		if (StringUtils.isNotBlank(employerName)) {
 			params.put("employerName", employerName);
 		}
-		
-		if (StringUtils.isNotBlank(username)){
+
+		if (StringUtils.isNotBlank(username)) {
 			params.put("username", username);
 		}
 
@@ -129,10 +134,11 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<DemandManageListBo> selectOrgDemandManageList(String employerName, Integer auditStatus, Integer province,
-			Integer serialNumber, String name, String keyword, Integer infoSources, Integer demandType,
-			String validityPeriodStartDate, String validityPeriodEndDate, String username, Integer status,
-			Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, Integer pNo, Integer pSize) {
+	public Pagination<DemandManageListBo> selectOrgDemandManageList(String employerName, Integer auditStatus,
+			Integer province, Integer serialNumber, String name, String keyword, Integer infoSources,
+			Integer demandType, String validityPeriodStartDate, String validityPeriodEndDate, String username,
+			Integer status, Integer releaseStatus, String releaseDateStartDate, String releaseDateEndDate, Integer pNo,
+			Integer pSize) {
 		Map<String, Object> params = disposeParams(auditStatus, province, serialNumber, name, keyword, infoSources,
 				demandType, validityPeriodStartDate, validityPeriodEndDate, username, status, releaseStatus,
 				releaseDateStartDate, releaseDateEndDate);
@@ -145,7 +151,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 			pSize = 10;
 		}
 
-		if (TokenManager.hasRole(AFTConstants.SALESMANAGERADMIN) || TokenManager.hasRole(AFTConstants.SALESMANADMIN)) {
+		/*if (TokenManager.hasRole(AFTConstants.SALESMANAGERADMIN) || TokenManager.hasRole(AFTConstants.SALESMANADMIN)) {
 			params.put("principal", TokenManager.getAdminId());
 		}
 
@@ -155,13 +161,17 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 
 		if (TokenManager.hasRole(AFTConstants.TECHBROKER)) {
 			params.put("techBroker", TokenManager.getAdminId());
-		}
+		}*/
 		
-		if (StringUtils.isNotBlank(employerName)){
+		if (!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.AUDITORADMIN)) {
+			params.put("adminId", TokenManager.getAdminId());
+		}
+
+		if (StringUtils.isNotBlank(employerName)) {
 			params.put("employerName", employerName);
 		}
-		
-		if (StringUtils.isNotBlank(username)){
+
+		if (StringUtils.isNotBlank(username)) {
 			params.put("unitName", username);
 		}
 
@@ -314,12 +324,12 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 			d.setReleaseDate(now.getTime());
 			d.setReleaseStatus(DemandReleaseStatus.RELEASED.getCode());
 			d.setTechBrokerId(techBroderId);
-			
-			if (StringUtils.isNotBlank(d.getKeyword())){
+
+			if (StringUtils.isNotBlank(d.getKeyword())) {
 				String[] keywords = d.getKeyword().trim().split(",|,");
 				disposeDemandKeyword(keywords, d, false);
 			}
-			
+
 			String employerId = d.getEmployerId();
 			if (StringUtils.isNotBlank(employerId)) {
 				if (UserType.PERSONAL.getCode().equals(d.getDataCategory())) {
@@ -553,9 +563,10 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 			params.put("keyword", keyword);
 		}
 
-		/*if (!StringUtils.isBlank(username)) {
-			params.put("username", username);
-		}*/
+		/*
+		 * if (!StringUtils.isBlank(username)) { params.put("username",
+		 * username); }
+		 */
 
 		if (null != infoSources) {
 			params.put("infoSources", infoSources);