Browse Source

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

Michael_9527 8 years ago
parent
commit
6fa5ef9709

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

@@ -398,7 +398,7 @@ public class AchievementServiceImpl extends BaseMybatisDao<AchievementMapper> im
 		List<AchievementKeyword> AchievementKeywordList = new ArrayList<>();
 		Calendar now = Calendar.getInstance();
 		now.set(Calendar.MILLISECOND, 0);
-		String techBrokerId = TokenManager.hasRole(AFTConstants.TECHBROKER) ? TokenManager.getAdminId() : null;
+		String techBrokerId = TokenManager.getAdminId();
 		for (AchievementImportBo bo : data) {
 			a = new Achievement();
 			BeanUtils.copyProperties(bo, a);

+ 77 - 0
src/main/java/com/goafanti/admin/bo/BusinessBo.java

@@ -0,0 +1,77 @@
+package com.goafanti.admin.bo;
+
+import java.util.Date;
+
+public class BusinessBo {
+	private Integer id;
+	private String create_id;
+	private Date create_time;
+	private Date update_time;
+	private Integer deleteSign;
+	private String cid;
+	private String cname;
+	private Integer super_id;
+	private Integer layer;
+	private Integer status;
+	
+	public Integer getId() {
+		return id;
+	}
+	public void setId(Integer id) {
+		this.id = id;
+	}
+	public String getCreate_id() {
+		return create_id;
+	}
+	public void setCreate_id(String create_id) {
+		this.create_id = create_id;
+	}
+	public Date getCreate_time() {
+		return create_time;
+	}
+	public void setCreate_time(Date create_time) {
+		this.create_time = create_time;
+	}
+	public Date getUpdate_time() {
+		return update_time;
+	}
+	public void setUpdate_time(Date update_time) {
+		this.update_time = update_time;
+	}
+	public Integer getDeleteSign() {
+		return deleteSign;
+	}
+	public void setDeleteSign(Integer deleteSign) {
+		this.deleteSign = deleteSign;
+	}
+	public String getCid() {
+		return cid;
+	}
+	public void setCid(String cid) {
+		this.cid = cid;
+	}
+	public String getCname() {
+		return cname;
+	}
+	public void setCname(String cname) {
+		this.cname = cname;
+	}
+	public Integer getSuper_id() {
+		return super_id;
+	}
+	public void setSuper_id(Integer super_id) {
+		this.super_id = super_id;
+	}
+	public Integer getLayer() {
+		return layer;
+	}
+	public void setLayer(Integer layer) {
+		this.layer = layer;
+	}
+	public Integer getStatus() {
+		return status;
+	}
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+}

+ 0 - 3
src/main/java/com/goafanti/admin/controller/AdminApiController.java

@@ -122,7 +122,6 @@ import com.goafanti.common.utils.PasswordUtil;
 import com.goafanti.common.utils.StringUtils;
 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;
@@ -131,9 +130,7 @@ import com.goafanti.user.bo.InputOrganizationIdentity;
 import com.goafanti.user.bo.InputUser;
 import com.goafanti.user.bo.InputUserAbility;
 import com.goafanti.user.bo.InputUserIdentity;
-import com.goafanti.user.bo.OrgListBo;
 import com.goafanti.user.bo.OrgUnitNames;
-import com.goafanti.user.bo.UserListBo;
 import com.goafanti.user.service.OrgHumanResourceService;
 import com.goafanti.user.service.OrganizationIdentityService;
 import com.goafanti.user.service.UserAbilityService;

+ 49 - 0
src/main/java/com/goafanti/admin/controller/AdminBusinessApiController.java

@@ -0,0 +1,49 @@
+package com.goafanti.admin.controller;
+
+import javax.annotation.Resource;
+
+import org.junit.runner.Request;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.goafanti.admin.service.BusinessService;
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.utils.StringUtils;
+
+@RestController
+@RequestMapping(value="/api/admin/business")
+public class AdminBusinessApiController extends CertifyApiController{
+	@Resource
+	private BusinessService businessService; 
+	/**
+	 * 品种列表
+	 * @return
+	 */
+	@RequestMapping(value="/list" , method=RequestMethod.GET)
+	private Result varietiesList(String cname,Integer super_id,Integer layer,
+								Integer status,String pageNo,
+					            String pageSize,Integer hot) {
+		Result res=new Result();
+		Integer pNo=1;
+		Integer pSize=10;
+		if (StringUtils.isNumeric(pageSize)) {
+			pSize= Integer.parseInt(pageSize);
+		}
+		if(StringUtils.isNumeric(pageNo)) {
+			pNo=Integer.parseInt(pageNo);
+		}
+		res.setData(businessService.listBusiness(cname,super_id,layer,status,pNo,pSize,hot));
+		return res;
+		
+	}
+	/**
+	 * 品种名列表
+	 * @return
+	 */
+	@RequestMapping(value="/namelist",method=RequestMethod.GET)
+	private Result varietiesNamelist(String cname) {
+		return null;
+	}
+}

+ 11 - 0
src/main/java/com/goafanti/admin/service/BusinessService.java

@@ -0,0 +1,11 @@
+package com.goafanti.admin.service;
+
+
+
+import com.goafanti.admin.bo.BusinessBo;
+import com.goafanti.core.mybatis.page.Pagination;
+
+public interface BusinessService {
+	Pagination<BusinessBo> listBusiness(String cname,Integer super_id,Integer layer,
+			Integer status,Integer pNo,Integer pSize,Integer hot);
+}

+ 57 - 0
src/main/java/com/goafanti/admin/service/impl/BusinessServiceImpl.java

@@ -0,0 +1,57 @@
+package com.goafanti.admin.service.impl;
+
+import java.util.HashMap;
+
+import java.util.Map;
+
+import org.springframework.stereotype.Service;
+
+
+import com.goafanti.admin.bo.BusinessBo;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.core.mybatis.page.Pagination;
+import com.goafanti.admin.service.BusinessService;
+import com.goafanti.common.dao.AchievementMapper;
+@Service
+public class BusinessServiceImpl extends BaseMybatisDao<AchievementMapper> implements BusinessService {
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<BusinessBo> listBusiness(String cname, Integer super_id, Integer layer, Integer status, Integer pNo,
+			Integer pSize,Integer hot) {
+		Map<String, Object> params=disposeParams(cname,super_id,layer,status,hot);
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0 || pSize > 10) {
+			pSize = 10;
+		}
+		return (Pagination<BusinessBo>) findPage("findBusinessVarietiesListByPage",
+				"findBusinessVarietiesCount",params,
+				pNo, pSize);
+	};
+	
+
+	private Map<String, Object> disposeParams(String cname, Integer super_id, Integer layer, Integer status,Integer hot) {
+		Map<String, Object> params = new HashMap<>();
+		if (null!=cname) {
+			params.put("cname", cname);
+		}
+		if (null!=super_id) {
+			params.put("super_id", super_id);
+		}
+		if (null!=layer) {
+			params.put("layer", layer);
+		}
+		if (null!=status) {
+			params.put("status", status);
+		}
+		if (null!=hot) {
+			params.put("hot", hot);
+		}
+		return params;
+	}
+
+
+}

+ 46 - 2
src/main/java/com/goafanti/common/mapper/AchievementMapper.xml

@@ -1157,7 +1157,7 @@
     	 name, keyword, category,
     	 owner_name, owner_type, owner_id_number,
     	 owner_mobile, owner_email, owner_postal_address,
-    	 cooperation_mode, introduction
+    	 cooperation_mode, introduction, tech_broker_id
     	 )
     values 
     <foreach item="item" index="index" collection="list" separator=",">
@@ -1167,7 +1167,7 @@
       	#{item.name,jdbcType=VARCHAR}, #{item.keyword,jdbcType=VARCHAR}, #{item.category,jdbcType=INTEGER},
       	#{item.ownerName,jdbcType=VARCHAR}, #{item.ownerType,jdbcType=VARCHAR}, #{item.ownerIdNumber,jdbcType=VARCHAR},
       	#{item.ownerMobile,jdbcType=VARCHAR}, #{item.ownerEmail,jdbcType=VARCHAR}, #{item.ownerPostalAddress,jdbcType=VARCHAR},
-      	#{item.cooperationMode,jdbcType=INTEGER}, #{item.introduction,jdbcType=LONGVARCHAR}
+      	#{item.cooperationMode,jdbcType=INTEGER}, #{item.introduction,jdbcType=LONGVARCHAR},#{item.techBrokerId,jdbcType=VARCHAR}
       )
     </foreach>
   </insert>
@@ -1649,6 +1649,50 @@
         </if>
   	    order by a.release_date desc limit 0,4
   </select>
+  <select id="findBusinessVarietiesListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.BusinessBo">
+  	select 
+  		b.id,b.create_id,b.create_time,b.update_time,b.delete_sign,b.cid,
+  		b.cname,b.super_id,b.super_id,b.layer,b.status,b2.cname
+  	from  business_varieties b
+  	LEFT JOIN business_varieties b2 on b.super_id = b2.id
+  	where b.deleted_sign= 1	
+  	<if test="cname != null">
+  		and  b.cname= #{cname,jdbcType=VARCHAR}
+  	</if>
+  	<if test="super_id != null">
+  		and  b.super_id= #{super_id,jdbcType=INTEGER}
+  	</if>
+  	<if test="layer != null">
+  		and  layer= #{layer,jdbcType=VARCHAR}
+  	</if>
+  	<if test="status != null">
+  		and  status= #{status,jdbcType=VARCHAR}
+  	</if>
+	order by b.id desc
+	<if test="page_sql!=null">
+			${page_sql}
+	</if>
+  </select>
   
+    <select id="findBusinessVarietiesListByPage" parameterType="String" resultType="com.goafanti.achievement.bo.BusinessBo">
+  	select 
+  		count(distinct(c.id))
+  	from  business_varieties b
+  	LEFT JOIN business_varieties b2 on b.super_id = b2.id
+  	where b.deleted_sign= 1	
+  	<if test="cname != null">
+  		and  b.cname= #{cname,jdbcType=VARCHAR}
+  	</if>
+  	<if test="super_id != null">
+  		and  b.super_id= #{super_id,jdbcType=INTEGER}
+  	</if>
+  	<if test="layer != null">
+  		and  layer= #{layer,jdbcType=VARCHAR}
+  	</if>
+  	<if test="status != null">
+  		and  status= #{status,jdbcType=VARCHAR}
+  	</if>
+	
+  </select>
   
 </mapper>

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

@@ -769,9 +769,6 @@
 	<if test="adminId != null">
 		LEFT JOIN user u on d.employer_id = u.id
 	</if>
-	<if test="adminId != null">
-		LEFT JOIN user u on d.employer_id = u.id
-	</if>
 	<if test="hot != null and hot == 1"><!-- 在首页 -->
 		inner join marketing_management mm on d.id = mm.product_id
 	</if>
@@ -1001,7 +998,7 @@
     	status, release_status, create_time, 
     	keyword, data_category, name,
     	demand_type, problem_des, employer_name,
-    	employer_contacts, employer_contacts_mobile, employer_contacts_mailbox, info_sources)
+    	employer_contacts, employer_contacts_mobile, employer_contacts_mailbox, info_sources,tech_broker_id)
     values 
     <foreach item="item" index="index" collection="list" separator=",">
       (
@@ -1010,7 +1007,7 @@
       	#{item.keyword,jdbcType=VARCHAR}, #{item.dataCategory,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR},
       	#{item.demandType,jdbcType=INTEGER}, #{item.problemDes,jdbcType=VARCHAR}, #{item.employerName,jdbcType=VARCHAR},
       	#{item.employerContacts,jdbcType=VARCHAR}, #{item.employerContactsMobile,jdbcType=VARCHAR}, #{item.employerContactsMailbox,jdbcType=VARCHAR},
-      	#{item.infoSources,jdbcType=INTEGER}
+      	#{item.infoSources,jdbcType=INTEGER},#{item.techBrokerId,jdbcType=VARCHAR}
       )
     </foreach>
   </insert>

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

@@ -139,7 +139,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 			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, Integer boutique, Integer hot,String techBrokerId) {
+			Integer pSize, Integer boutique, Integer hot, String techBrokerId) {
 		Map<String, Object> params = disposeParams(auditStatus, province, serialNumber, name, keyword, infoSources,
 				demandType, validityPeriodStartDate, validityPeriodEndDate, username, status, releaseStatus,
 				releaseDateStartDate, releaseDateEndDate, boutique, hot);
@@ -412,7 +412,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		List<DemandKeyword> demandKeywordList = new ArrayList<>();
 		Calendar now = Calendar.getInstance();
 		now.set(Calendar.MILLISECOND, 0);
-		String techBrokerId = TokenManager.hasRole(AFTConstants.TECHBROKER) ? TokenManager.getAdminId() : null;
+		String techBrokerId = TokenManager.getAdminId();
 		for (DemandImportBo bo : data) {
 			d = new Demand();
 			BeanUtils.copyProperties(bo, d);