Pārlūkot izejas kodu

科技需求管理

wanghui 7 gadi atpakaļ
vecāks
revīzija
d53f92451e

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

@@ -890,21 +890,39 @@
   <!-- 查询需求列表 -->
 	<select id="selectDemandListByPage" resultType="com.goafanti.demand.bo.DemandListBo">
 		select
-			id,
-			serial_number as serialNumber,
-			name,
-			demand_type as demandType,
-			audit_status as auditStatus,
-			create_time as createTime
-		from
-			demand
-		where
-			employer_id = #{employerId,jdbcType=VARCHAR}
+			a.id,
+			a.serial_number as serialNumber,
+			a.name,
+			a.demand_type as demandType,
+			a.audit_status as auditStatus,
+			a.create_time as createTime,
+			a.budget_cost as budgetCost,
+			b.identify_name as employerName
+		from demand a left join user b on a.employer_id = b.id 
+		where a.deleted_sign = 0
+		<if test="employerId != null">
+			a.employer_id = #{employerId,jdbcType=VARCHAR}
+		</if>
 		<if test="startDate != null">
-			and create_time <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
+			and a.create_time <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
 		</if>
 		<if test="endDate != null">
-			and create_time <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
+			and a.create_time <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
+		</if>
+		<if test="name != null">
+			and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
+		</if>
+		<if test="demandType != null">
+			and a.demand_type = #{demandType,jdbcType=INTEGER}
+		</if>
+		<if test="auditStatus != null">
+			and a.audit_status = #{auditStatus,jdbcType=INTEGER}
+		</if>
+		<if test="status != null">
+			and a.status = #{status,jdbcType=INTEGER}
+		</if>
+		<if test="identifyName != null">
+			b.identify_name like concat('%',#{identifyName,jdbcType=VARCHAR},'%')
 		</if>
 		<if test="page_sql!=null">
 			${page_sql}
@@ -915,17 +933,31 @@
 			count(0)
 		from
 			demand
-		where
-			employer_id = #{employerId,jdbcType=VARCHAR}
-			<if test="startDate != null">
-				and create_time <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
-			</if>
-			<if test="endDate != null">
-				and create_time <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
-			</if>
-			<if test="name != null">
-				and name like concat('%',#{name,jdbcType=VARCHAR},'%')
-			</if>
+		where a.deleted_sign = 0
+		<if test="employerId != null">
+			a.employer_id = #{employerId,jdbcType=VARCHAR}
+		</if>
+		<if test="startDate != null">
+			and a.create_time <![CDATA[ >= ]]> #{startDate,jdbcType=TIMESTAMP}
+		</if>
+		<if test="endDate != null">
+			and a.create_time <![CDATA[ <= ]]> #{endDate,jdbcType=TIMESTAMP}
+		</if>
+		<if test="name != null">
+			and a.name like concat('%',#{name,jdbcType=VARCHAR},'%')
+		</if>
+		<if test="demandType != null">
+			and a.demand_type = #{demandType,jdbcType=INTEGER}
+		</if>
+		<if test="auditStatus != null">
+			and a.audit_status = #{auditStatus,jdbcType=INTEGER}
+		</if>
+		<if test="status != null">
+			and a.status = #{status,jdbcType=INTEGER}
+		</if>
+		<if test="identifyName != null">
+			b.identify_name like concat('%',#{identifyName,jdbcType=VARCHAR},'%')
+		</if>
 	</select>
   
 	<select id="countInterest" resultType="Integer">

+ 67 - 124
src/main/java/com/goafanti/demand/controller/AdminDemandApiController.java

@@ -8,6 +8,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 import com.goafanti.admin.service.AftFileService;
 import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.enums.AttachmentType;
@@ -15,8 +16,6 @@ import com.goafanti.common.enums.DeleteStatus;
 import com.goafanti.common.enums.DemandAuditStatus;
 import com.goafanti.common.model.AftFile;
 import com.goafanti.common.model.Demand;
-import com.goafanti.common.model.DemandFollow;
-import com.goafanti.common.model.DemandFollowDetail;
 import com.goafanti.common.model.DemandPublish;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.demand.service.DemandFollowService;
@@ -110,6 +109,20 @@ public class AdminDemandApiController extends CertifyApiController {
 	}
 
 	/**
+	 * 需求列表
+	 * @param pageNo
+	 * @param pageSize
+	 * @return
+	 */
+	@RequestMapping(value = "/list", method = RequestMethod.GET)
+	public Result list(String name,String employerName,Integer demandType,
+			Integer auditStatus,Integer status,String startDate, String endDate,Integer pageNo, Integer pageSize){
+		Result res = new Result();
+		res.setData(demandService.listDemand(name, employerName, demandType, auditStatus, status,startDate,endDate, pageNo, pageSize));
+		return res;
+	}
+	
+	/**
 	 * 个人需求详情
 	 */
 	@RequestMapping(value = "/userDemandDetail", method = RequestMethod.GET)
@@ -119,7 +132,6 @@ public class AdminDemandApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
 			return res;
 		}
-
 		res.setData(demandService.selectUserDemandDetail(id));
 		return res;
 	}
@@ -144,7 +156,57 @@ public class AdminDemandApiController extends CertifyApiController {
 		}
 		return res;
 	}
-
+	
+	/**
+	 * 需求详情
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/demandDetail", method = RequestMethod.GET)
+	public Result demandDetail(String id){
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+		res.setData(demandService.selectDemandDetail(id));
+		return res;
+	}
+	
+	/**
+	 * 审核需求
+	 * @param id
+	 * @param auditResult
+	 * @return
+	 */
+	
+	@RequestMapping(value = "/auditDemand", method = RequestMethod.GET)
+	public Result auditDemand(String id, Integer auditResult,String auditInfo){
+		Result res = new Result();
+		if (StringUtils.isBlank(id)) {
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
+			return res;
+		}
+		Demand d = demandService.selectByPrimaryKey(id);
+		if (null == d) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
+			return res;
+		}
+		if(d.getAuditStatus() != DemandAuditStatus.INAUDIT.getCode()){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求未达审核条件"));
+			return res;
+		}
+		if(AFTConstants.NO == auditResult && StringUtils.isBlank(auditInfo)){
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需填写审核意见"));
+			return res;
+		}
+		if(AFTConstants.YES == auditResult || AFTConstants.NO == auditResult){
+			d.setAuditStatus(auditResult);
+		}
+		demandService.updateByPrimaryKeySelective(d);
+		return res;
+	}
+	
 	/**
 	 * 需求管理--获取个人用户下拉
 	 */
@@ -320,124 +382,5 @@ public class AdminDemandApiController extends CertifyApiController {
     	Result res=new Result();
     	return res.data(DemandPublishPageService.getBranchInformation());
     }
-    /**
-     * 新增匹配跟进保存
-     */
-    @RequestMapping(value = "/addDemandFollow", method = RequestMethod.POST)
-    private Result addDemandFollow(DemandFollow d) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(d.getDemandId())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求", "需求"));
-            return res;
-        }
-    	if (StringUtils.isBlank(d.getContactMobile())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到联系人电话", "联系人电话"));
-            return res;
-        }
-    	if (StringUtils.isBlank(d.getContacts())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到联系人", "联系人"));
-            return res;
-        }
-    	if (StringUtils.isBlank(d.getOrganization())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到机构", "机构"));
-            return res;
-        }
-    	res.data(demandFollowService.insertDemandFollow(d));     
-        return res;
-    }
-    
-    /**
-     * 修改匹配跟进
-     */
-    @RequestMapping(value = "/updateDemandFollow", method = RequestMethod.POST)
-    private Result DemandFollow(DemandFollow d) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(d.getId())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求匹配", "匹配跟进"));
-            return res;
-        }
-    	res.setData(demandFollowService.updateDemandFollow(d));     
-        return res;
-    }
-    
-    /**
-     * 新增跟进情况
-     */
-    @RequestMapping(value = "/addDemandFollowDetail", method = RequestMethod.POST)
-    private Result addDemandFollowDetail(DemandFollowDetail d,String createTimeFormattedDate) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(d.getDemandFollowId())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求匹配跟进", "需求匹配跟进"));
-            return res;
-        }
-    	if (StringUtils.isBlank(d.getRemarks())) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到跟进情况", "跟进情况"));
-            return res;
-        }
-    	if (null==d.getResult()) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到跟进结果", "跟进结果"));
-            return res;
-        }
-    	if (StringUtils.isBlank(createTimeFormattedDate)) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到跟进时间", "跟进时间"));
-            return res;
-        }
-    	res.data(demandFollowService.insertDemandFollowDetail(d,createTimeFormattedDate));     
-        return res;
-    }
-    
-    /**
-     * 跟进列表
-     */
-    @RequestMapping(value = "/listDemandFollow", method = RequestMethod.GET)
-    private Result listDemandFollow(String id,Integer pNo,Integer pSize) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(id)) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求匹配跟进", "需求匹配跟进"));
-            return res;
-        }
-    	res.data(demandFollowService.selectDemandFollow( id, pNo, pSize));
-        return res;
-    }
-    
-    /**
-     * 删除跟进
-     */
-    @RequestMapping(value = "/deleteDemandFollow", method = RequestMethod.GET)
-    private Result deleteDemandFollow(String id) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(id)) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求匹配跟进", "需求匹配跟进"));
-            return res;
-        }
-    	res.data(demandFollowService.deleteDemandFollow( id));
-        return res;
-    }
-    
-    /**
-     * 跟进情况列表
-     */
-    @RequestMapping(value = "/listDemandFollowDetail", method = RequestMethod.GET)
-    private Result listDemandFollowDetail(String id,Integer pNo, Integer pSize) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(id)) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求跟进", "需求跟进"));
-            return res;
-        }
-    	res.data(demandFollowService.selectDemandFollowDetail( id,pNo,  pSize));
-        return res;
-    }
-    /**
-     * 匹配跟进
-     */
-    @RequestMapping(value = "/DemandFollowDetails", method = RequestMethod.GET)
-    private Result DemandFollowDetails(String id) {
-    	Result res = new Result();
-    	if (StringUtils.isBlank(id)) {
-            res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求跟进", "需求跟进"));
-            return res;
-        }
-    	res.data(demandService.DemandFollowDetails(id));
-        return res;
-    }
+   
 }

+ 4 - 7
src/main/java/com/goafanti/demand/controller/UserDemandApiController.java

@@ -216,10 +216,10 @@ public class UserDemandApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "当前状态无法提交审核!"));
 			return res;
 		}
-		Demand demand = new Demand();
-		demand.setId(id);
-		demand.setAuditStatus(DemandAuditStatus.INAUDIT.getCode());
-		demandService.updateByPrimaryKeySelective(demand);
+		Demand d = new Demand();
+		d.setId(id);
+		d.setAuditStatus(DemandAuditStatus.INAUDIT.getCode());
+		demandService.updateByPrimaryKeySelective(d);
 		return res;
 	}
 	
@@ -233,14 +233,11 @@ public class UserDemandApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求ID", "需求ID"));
 			return res;
 		}
-
 		Demand d = demandService.selectByPrimaryKey(id);
-
 		if (null == d) {
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "需求ID"));
 			return res;
 		}
-
 		res.setData(demandService.updateReleaseStatus(d));
 		return res;
 	}

+ 4 - 1
src/main/java/com/goafanti/demand/service/DemandService.java

@@ -12,7 +12,10 @@ import com.goafanti.portal.bo.DemandSearchDetailBo;
 import com.goafanti.portal.bo.DemandSearchListBo;
 
 public interface DemandService {
-	Pagination<DemandSearchListBo> listMyDemand(String name,String startDate,String endDate,Integer pageNo, Integer pageSize);
+	Pagination<DemandListBo> listMyDemand(String name,String startDate,String endDate,Integer pageNo, Integer pageSize);
+	
+	Pagination<DemandListBo> listDemand(String name,String employerName,Integer demandType, 
+			Integer auditStatus,Integer status,String startDate, String endDate,Integer pageNo, Integer pageSize);
 	
 	int updateUserDemand(Demand d, String validityPeriodFormattedDate, String[] keywords,List<String> webPages,List<String> appPages);
 

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

@@ -186,6 +186,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 				achievementDemandCountMapper.updateByPrimaryKeySelective(adc);
 			}
 		}
+		disposeDemandPublish(d, null, null, true);
 		return i;
 
 	}
@@ -500,7 +501,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		}
 		DemandPublish dp = null;
 		String defaultPlatformId = branchInformationMapper.selectByDomain(PageConstants.DEFAULT_DOMAIN).getId();
-		if(webPages.size()>0){
+		if(webPages != null && webPages.size()>0){
 			for(String page: webPages){
 				dp = new DemandPublish();
 				dp.setId(UUID.randomUUID().toString());
@@ -516,7 +517,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 				demandPublishMapper.insert(dp);
 			}
 		}
-		if(appPages.size()>0){
+		if(webPages != null && appPages.size()>0){
 			for(String page: webPages){
 				dp = new DemandPublish();
 				dp.setId(UUID.randomUUID().toString());
@@ -827,19 +828,36 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<DemandSearchListBo> listMyDemand(String name, String startDate, String endDate,
+	public Pagination<DemandListBo> listMyDemand(String name, String startDate, String endDate,
 			Integer pageNo, Integer pageSize) {
 		Map<String,Object> params = new HashMap<String,Object>();
 		if(StringUtils.isNotBlank(name)) params.put("name", name);
 		if(StringUtils.isNotBlank(startDate)) params.put("startDate", startDate);
 		if(StringUtils.isNotBlank(endDate)) params.put("endDate", endDate);
-		return (Pagination<DemandSearchListBo>) findPage("selectDemandListByPage", "selectDemandListCount", params, pageNo, pageSize);
+		return (Pagination<DemandListBo>) findPage("selectDemandListByPage", "selectDemandListCount", params, pageNo, pageSize);
 	}
 
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<DemandListBo> listDemand(String name, String employerName, Integer demandType,
+			Integer auditStatus, Integer status, String startDate, String endDate,Integer pageNo, Integer pageSize) {
+		Map<String,Object> params = new HashMap<String,Object>();
+		if(StringUtils.isNotBlank(name)) params.put("name", name);
+		if(StringUtils.isNotBlank(employerName)) params.put("identifyName", employerName);
+		if(demandType != null) params.put("demandType", demandType);
+		if(auditStatus != null) params.put("auditStatus", auditStatus);
+		if(status != null) params.put("status",status);
+ 		if(StringUtils.isNotBlank(startDate)) params.put("startDate", startDate);
+		if(StringUtils.isNotBlank(endDate)) params.put("endDate", endDate);
+		return (Pagination<DemandListBo>) findPage("selectDemandListByPage", "selectDemandListCount", params, pageNo, pageSize);
+	}
+	
 	@Override
 	public DemandDetailBo selectDemandDetail(String id) {
 		DemandDetailBo bo = demandMapper.selectDemandDetail(id);
 		bo.setPublishPages(demandPublishMapper.selectPublishPages(id));
 		return bo;
 	}
+
+	
 }