Просмотр исходного кода

项目查询与项目任务查询条件更换、新增营销员查询项目的接口

anderx лет назад: 7
Родитель
Сommit
6d6a524673

+ 132 - 2
src/main/java/com/goafanti/common/mapper/TechProjectMapper.xml

@@ -783,7 +783,10 @@ from
 			e.nickname as buyerName,
 			f.name as taskReceiverName
 		from
-			contract_task a left join business_project b on
+			(select *
+		from contract_task_log
+		where task_receiver= #{taskReceiver,jdbcType=VARCHAR}) x left join contract_task a on 
+			x.contract_task_id=a.id	left join business_project b on
 			a.commodity_id = b.id left join business_varieties c on
 			b.cid = c.id left join contract d on
 			a.contract_id = d.id left join user e on
@@ -830,7 +833,10 @@ from
   		select
 			count(0)
 		from
-			contract_task a left join business_project b on
+			(select *
+		from contract_task_log
+		where task_receiver= #{taskReceiver,jdbcType=VARCHAR}) x left join contract_task a on 
+			x.contract_task_id=a.id	left join business_project b on
 			a.commodity_id = b.id left join business_varieties c on
 			b.cid = c.id left join contract d on
 			a.contract_id = d.id left join user e on
@@ -868,4 +874,128 @@ from
 			and c.id = #{categoryId,jdbcType=VARCHAR}
 		</if>
   </select>
+  
+  
+   <select id="salesmanListProjectByPage" resultType="com.goafanti.techproject.bo.ProjectListBo">
+	select
+		a.id,
+		a.serial_number as serialNumber,
+		date_format(a.sign_date,'%Y-%m-%d %H:%i:%S') as signDate,
+		date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as projectTime,
+		a.uid,
+		a.status as projectStatus,
+		a.task_distribution as taskDistribution,
+		a.deleted_sign as deletedSign,
+		a.order_no as orderNo,
+		b.nickname as buyerName,
+		b.type as buyerType,
+		f.cname as projectType,
+		c.create_time as orderTime,
+		c.order_status as orderStatus,
+		c.liquidation_status as liquidationStatus,
+		c.approval,
+		d.name as salesmanName,
+		e.name as departmentName,
+		g.name as principalName
+	from
+		contract a left join user b on
+		a.uid = b.id left join t_order c on
+		a.order_no = c.order_no left join admin d on
+		c.salesman_id = d.id left join department_management e on
+		d.department_id = e.id left join business_varieties f on
+		a.type = f.id left join admin g on
+		a.principal = g.id
+	where 1=1
+	and c.salesman_id= #{salesmanId,jdbcType=VARCHAR}
+	<if test="deletedSign != null">
+		and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
+	</if>
+	<if test="orderNo != null and orderNo != ''">
+		and a.order_no = #{orderNo,jdbcType=VARCHAR}
+	</if>
+	<if test="serialNumber != null and serialNumber != ''">
+		and a.serial_number = #{serialNumber,jdbcType=VARCHAR}
+	</if>
+	<if test="setUpStartDate != null and setUpStartDate != ''">
+		and a.create_time &gt; #{setUpStartDate,jdbcType=TIMESTAMP}
+	</if>
+	<if test="setUpEndDate != null and setUpEndDate != ''">
+		and a.create_time &lt; #{setUpEndDate,jdbcType=TIMESTAMP}
+	</if>
+	<if test="taskDistribution != null">
+		and a.task_distribution = #{taskDistribution,jdbcType=INTEGER}
+	</if>
+	<if test="buyerName != null and buyerName != ''">
+		and b.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="salesmanName != null and salesmanName !=''">
+		and d.name = #{salesmanName,jdbcType=VARCHAR}
+	</if>
+	<if test="depId != null and depId != ''">
+		and d.department_id = #{depId,jdbcType=VARCHAR}
+	</if>
+	<if test="orderStartDate != null and orderStartDate != ''">
+		and c.create_time &gt; #{orderStartDate,jdbcType=TIMESTAMP}
+	</if>
+	<if test="orderEndDate != null and orderEndDate != ''">
+		and c.create_time &lt; #{orderEndDate,jdbcType=TIMESTAMP}
+	</if>
+	<if test="principalName != null and principalName != ''">
+		and g.name = #{principalName,jdbcType=VARCHAR}
+	</if>
+		order by a.create_time desc
+	<if test="page_sql != null">
+		${page_sql}
+	</if>
+  </select>
+  <select id="salesmanListProjectCount" resultType="java.lang.Integer">
+  	select
+		count(0)
+	from
+		contract a left join user b on
+		a.uid = b.id left join t_order c on
+		a.order_no = c.order_no left join admin d on
+		c.salesman_id = d.id left join department_management e on
+		d.department_id = e.id left join business_varieties f on
+		a.type = f.id left join admin g on
+		a.principal = g.id
+	where 1=1
+	and c.salesman_id= #{salesmanId,jdbcType=VARCHAR}
+	<if test="deletedSign != null">
+		and a.deleted_sign = #{deletedSign,jdbcType=INTEGER}
+	</if>
+	<if test="orderNo != null and orderNo != ''">
+		and a.order_no = #{orderNo,jdbcType=VARCHAR}
+	</if>
+	<if test="serialNumber != null and serialNumber != ''">
+		and a.serial_number = #{serialNumber,jdbcType=VARCHAR}
+	</if>
+	<if test="setUpStartDate != null and setUpStartDate != ''">
+		and a.create_time &gt; #{setUpStartDate,jdbcType=TIMESTAMP}
+	</if>
+	<if test="setUpEndDate != null and setUpEndDate != ''">
+		and a.create_time &lt; #{setUpEndDate,jdbcType=TIMESTAMP}
+	</if>
+	<if test="taskDistribution != null">
+		and a.task_distribution = #{taskDistribution,jdbcType=INTEGER}
+	</if>
+	<if test="buyerName != null and buyerName != ''">
+		and b.nickname like concat('%',#{buyerName,jdbcType=VARCHAR},'%')
+	</if>
+	<if test="salesmanName != null and salesmanName !=''">
+		and d.name = #{salesmanName,jdbcType=VARCHAR}
+	</if>
+	<if test="depId != null and depId != ''">
+		and d.department_id = #{depId,jdbcType=VARCHAR}
+	</if>
+	<if test="orderStartDate != null and orderStartDate != ''">
+		and c.create_time &gt; #{orderStartDate,jdbcType=TIMESTAMP}
+	</if>
+	<if test="orderEndDate != null and orderEndDate != ''">
+		and c.create_time &lt; #{orderEndDate,jdbcType=TIMESTAMP}
+	</if>
+	<if test="principalName != null and principalName != ''">
+		and g.name = #{principalName,jdbcType=VARCHAR}
+	</if>
+  </select>
 </mapper>

+ 17 - 0
src/main/java/com/goafanti/techproject/controller/AdminTechProjectApiController.java

@@ -989,4 +989,21 @@ public class AdminTechProjectApiController extends CertifyApiController {
 		return res;
 	}
 	
+	/**
+	 * 营销员查询项目列表
+	 * @param bo
+	 * @param depId
+	 * @param orderStartTime
+	 * @param orderEndTime
+	 * @param setUpStartDate
+	 * @param setUpEndDate
+	 * @return
+	 */
+	@RequestMapping(value = "/salesmanListProject",method = RequestMethod.POST)
+	public Result salesmanListProject(ProjectListBo bo,String depId,
+			String orderStartDate,String orderEndDate,String setUpStartDate,String setUpEndDate,Integer pageNo,Integer pageSize){
+		Result res = new Result();
+		res.setData(techProjectService.salesmanListProject(bo, depId, orderStartDate, orderEndDate, setUpStartDate, setUpEndDate,pageNo,pageSize));
+		return res;
+	}
 }

+ 3 - 0
src/main/java/com/goafanti/techproject/service/TechProjectService.java

@@ -173,4 +173,7 @@ public interface TechProjectService {
 	 */
 	int updateDistributionTask(String taskId, String taskReceiverId);
 
+	Pagination<ProjectListBo> salesmanListProject(ProjectListBo bo, String depId, String orderStartDate, String orderEndDate,
+			String setUpStartDate, String setUpEndDate, Integer pageNo, Integer pageSize);
+
 }

+ 30 - 0
src/main/java/com/goafanti/techproject/service/impl/TechProjectServiceImpl.java

@@ -430,6 +430,7 @@ public class TechProjectServiceImpl extends BaseMybatisDao<TechProjectMapper> im
 		if(StringUtils.isNotBlank(deleteSign)) params.put("deleteSign", deleteSign);
 		if(StringUtils.isNotBlank(publishStatus)) params.put("publishStatus", publishStatus);
 		if(taskStatus != null) params.put("taskStatus", taskStatus);
+		 params.put("taskReceiver", TokenManager.getAdminId());
 		return (Pagination<TaskListBo>)findPage("selectProjectTaskByPage", "selectProjectTaskCount", params, pageNo, pageSize);
 	}
 
@@ -535,4 +536,33 @@ public class TechProjectServiceImpl extends BaseMybatisDao<TechProjectMapper> im
 		}
 		return 0;
 	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<ProjectListBo> salesmanListProject(ProjectListBo bo, String depId, String orderStartDate,
+			String orderEndDate, String setUpStartDate, String setUpEndDate, Integer pageNo, Integer pageSize) {
+		Map<String, Object> params = new HashMap<>();
+		if(StringUtils.isNotBlank(bo.getBuyerName())) params.put("buyerName", bo.getBuyerName());
+		if(bo.getDeletedSign() != null) params.put("deletedSign", bo.getDeletedSign());
+		if(bo.getTaskDistribution() != null) params.put("taskDistribution", bo.getTaskDistribution());
+		if(StringUtils.isNotBlank(bo.getOrderNo())) params.put("orderNo", bo.getOrderNo());
+		if(StringUtils.isNotBlank(bo.getSalesmanName())) params.put("salesmanName", bo.getSalesmanName());
+		if(StringUtils.isNotBlank(bo.getPrincipalName())) params.put("principalName", bo.getPrincipalName());
+		if(StringUtils.isNotBlank(bo.getSerialNumber())) params.put("serialNumber", bo.getSerialNumber());
+		if(StringUtils.isNotBlank(depId)) params.put("depId", depId);
+		params.put("salesmanId", TokenManager.getAdminId());
+		try {
+			if(StringUtils.isNotBlank(setUpStartDate))
+				params.put("setUpStartDate", DateUtils.parseDate(setUpStartDate, AFTConstants.YYYYMMDD));
+			if(StringUtils.isNotBlank(setUpEndDate))
+				params.put("setUpEndDate", DateUtils.parseDate(setUpEndDate, AFTConstants.YYYYMMDD));
+			if(StringUtils.isNotBlank(orderStartDate))
+				params.put("orderStartDate", DateUtils.parseDate(orderStartDate, AFTConstants.YYYYMMDD));
+			if(StringUtils.isNotBlank(orderEndDate))
+				params.put("orderEndDate", DateUtils.parseDate(orderEndDate, AFTConstants.YYYYMMDD));
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		return (Pagination<ProjectListBo>)findPage("salesmanListProjectByPage", "salesmanListProjectCount", params, pageNo, pageSize);
+	}
 }