Browse Source

管理端--科技需求线索单/意向单列表(组织用户)

Antiloveg 8 years ago
parent
commit
85e33fb6ec

+ 18 - 0
src/main/java/com/goafanti/admin/controller/AdminOrderApiController.java

@@ -36,4 +36,22 @@ public class AdminOrderApiController {
 		res.setData(demandOrderService.listUserDemandOrder(uid, username, status, pNo, pSize));
 		return res;
 	}
+	
+	/**
+	 * 科技需求线索单/意向单列表(组织用户)
+	 */
+	@RequestMapping(value = "/orgDemandOrderList", method = RequestMethod.GET)
+	public Result orgDemandOrderList(String uid, String unitName, Integer status, String pageNo, String pageSize){
+		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(demandOrderService.listOrgDemandOrder(uid, unitName, status, pNo, pSize));
+		return res;
+	}
 }

+ 55 - 0
src/main/java/com/goafanti/common/mapper/DemandOrderMapper.xml

@@ -284,4 +284,59 @@
   		and ui.username = #{username,jdbcType=VARCHAR}
   	</if>
   </select>
+  
+  
+   <select id="findOrgDemandOrderListByPage" parameterType="String" resultType="com.goafanti.demand.bo.OrgDemandOrderListBo">
+  	select 
+  		do.id, do.serial_number as serialNumber, do.demand_id as demandId,
+  		do.create_time as createTime, do.enclosure_url as enclosureUrl, do.status,
+  		do.intention_money as intentionMoney, do.contract_money as contractMoney, do.commission,
+  		do.service_money as serviceMoney, d.name, d.serial_number as demandSerialNumber,
+  		d.deleted_sign as deletedSign, d.audit_status as auditStatus,
+  		do.uid, oi.unit_name as unitName
+  	from demand_order do
+  	left join demand d on d.id = do.demand_id
+  	left join organization_identity oi on oi.uid = do.uid
+  	where do.deleted_sign = 0 
+  	and   d.deleted_sign = 0 
+  	and   d.data_category = 1
+  	and   d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
+  	<if test="status != null">
+  		and do.status = #{status,jdbcType=INTEGER}
+  	</if>
+  	<if test="uid != null">
+  		and d.uid = #{uid,jdbcType=VARCHAR}
+  	</if>
+  	<if test="username != null">
+  		and oi.unit_name = #{unitName,jdbcType=VARCHAR}
+  	</if>
+  	order by do.serial_number desc
+  	<if test="page_sql!=null">
+		${page_sql}
+	</if>
+  </select>
+  
+  <select id="findOrgDemandOrderCount" parameterType="String" resultType="java.lang.Integer">
+  	select 
+  		count(1)
+  	from demand_order do
+  	left join demand d on d.id = do.demand_id
+  	left join organization_identity oi on oi.uid = do.uid
+  	where do.deleted_sign = 0 
+  	and   d.deleted_sign = 0 
+  	and   d.data_category = 1
+  	and   d.tech_broker_id = #{techBrokerId,jdbcType=VARCHAR}
+  	<if test="status != null">
+  		and do.status = #{status,jdbcType=INTEGER}
+  	</if>
+  	<if test="uid != null">
+  		and d.uid = #{uid,jdbcType=VARCHAR}
+  	</if>
+  	<if test="username != null">
+  		and oi.unit_name = #{unitName,jdbcType=VARCHAR}
+  	</if>
+  </select>
+  
+  
+  
 </mapper>

+ 26 - 0
src/main/java/com/goafanti/demand/bo/OrgDemandOrderListBo.java

@@ -0,0 +1,26 @@
+package com.goafanti.demand.bo;
+
+public class OrgDemandOrderListBo extends DemandOrderListBo {
+	private String uid;
+	
+	private String unitName;
+
+	public String getUid() {
+		return uid;
+	}
+
+	public void setUid(String uid) {
+		this.uid = uid;
+	}
+
+	public String getUnitName() {
+		return unitName;
+	}
+
+	public void setUnitName(String unitName) {
+		this.unitName = unitName;
+	}
+	
+	
+
+}

+ 3 - 0
src/main/java/com/goafanti/demand/service/DemandOrderService.java

@@ -6,6 +6,7 @@ import com.goafanti.common.model.DemandOrder;
 import com.goafanti.common.model.DemandOrderLog;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.demand.bo.DemandOrderListBo;
+import com.goafanti.demand.bo.OrgDemandOrderListBo;
 import com.goafanti.demand.bo.UserDemandOrderListBo;
 
 public interface DemandOrderService {
@@ -24,4 +25,6 @@ public interface DemandOrderService {
 
 	Pagination<UserDemandOrderListBo> listUserDemandOrder(String uid, String username, Integer status, Integer pNo, Integer pSize);
 
+	Pagination<OrgDemandOrderListBo> listOrgDemandOrder(String uid, String unitName, Integer status, Integer pNo, Integer pSize);
+
 }

+ 44 - 22
src/main/java/com/goafanti/demand/service/impl/DemandOrderServiceImpl.java

@@ -20,6 +20,7 @@ import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.demand.bo.DemandOrderListBo;
+import com.goafanti.demand.bo.OrgDemandOrderListBo;
 import com.goafanti.demand.bo.UserDemandOrderListBo;
 import com.goafanti.demand.service.DemandOrderService;
 
@@ -62,13 +63,6 @@ public class DemandOrderServiceImpl extends BaseMybatisDao<DemandOrderMapper> im
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<DemandOrderListBo> listOrderList(Integer status, Integer pNo, Integer pSize) {
-		Map<String, Object> params = new HashMap<>();
-
-		if (null != status) {
-			params.put("status", status);
-		}
-
-		params.put("uid", TokenManager.getUserId());
 
 		if (pNo == null || pNo < 0) {
 			pNo = 1;
@@ -77,8 +71,8 @@ public class DemandOrderServiceImpl extends BaseMybatisDao<DemandOrderMapper> im
 		if (pSize == null || pSize < 0 || pSize > 10) {
 			pSize = 10;
 		}
-		return (Pagination<DemandOrderListBo>) findPage("findDemandOrderListByPage", "findDemandOrderCount", params,
-				pNo, pSize);
+		return (Pagination<DemandOrderListBo>) findPage("findDemandOrderListByPage", "findDemandOrderCount",
+				disposeDemandOrderList(null, null, null, status, false), pNo, pSize);
 	}
 
 	@Override
@@ -96,31 +90,59 @@ public class DemandOrderServiceImpl extends BaseMybatisDao<DemandOrderMapper> im
 	@Override
 	public Pagination<UserDemandOrderListBo> listUserDemandOrder(String uid, String username, Integer status,
 			Integer pNo, Integer pSize) {
+
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0 || pSize > 10) {
+			pSize = 10;
+		}
+		return (Pagination<UserDemandOrderListBo>) findPage("findUserDemandOrderListByPage", "findUserDemandOrderCount",
+				disposeDemandOrderList(uid, username, null, status, true), pNo, pSize);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<OrgDemandOrderListBo> listOrgDemandOrder(String uid, String unitName, Integer status, Integer pNo,
+			Integer pSize) {
+		if (pNo == null || pNo < 0) {
+			pNo = 1;
+		}
+
+		if (pSize == null || pSize < 0 || pSize > 10) {
+			pSize = 10;
+		}
+		return (Pagination<OrgDemandOrderListBo>) findPage("findOrgDemandOrderListByPage", "findOrgDemandOrderCount",
+				disposeDemandOrderList(uid, null, unitName, status, true), pNo, pSize);
+	}
+
+	private Map<String, Object> disposeDemandOrderList(String uid, String username, String unitName, Integer status,
+			Boolean flag) {
 		Map<String, Object> params = new HashMap<>();
 
 		if (null != status) {
 			params.put("status", status);
 		}
-		
+
 		if (!StringUtils.isBlank(uid)) {
 			params.put("uid", uid);
 		}
-		
-		if (!StringUtils.isBlank(username)){
+
+		if (!StringUtils.isBlank(username)) {
 			params.put("username", username);
 		}
-		
-		params.put("techBrokerId", TokenManager.getAdminId());
-		
-		if (pNo == null || pNo < 0) {
-			pNo = 1;
-		}
 
-		if (pSize == null || pSize < 0 || pSize > 10) {
-			pSize = 10;
+		if (!StringUtils.isBlank(unitName)) {
+			params.put("unitName", unitName);
 		}
-		return (Pagination<UserDemandOrderListBo>) findPage("findUserDemandOrderListByPage", "findUserDemandOrderCount", params,
-				pNo, pSize);
+		if (flag) {
+			params.put("techBrokerId", TokenManager.getAdminId());
+		} else {
+			params.put("uid", TokenManager.getUserId());
+		}
+
+		return params;
 	}
 
 }