Antiloveg лет назад: 8
Родитель
Сommit
a4d6687eb0

+ 7 - 0
schema/2017-05-16.sql

@@ -0,0 +1,7 @@
+alter table `demand` 
+modify 
+column `industry_category_a`  int(3)  comment '行业类别下拉A',
+modify 
+column `industry_category_b`  int(3)  comment '行业类别下拉B',
+modify 
+column `industry_category_c`  int(3)  comment '行业类别下拉C';

+ 63 - 42
src/main/java/com/goafanti/admin/controller/AdminDemandApiController.java

@@ -1,6 +1,8 @@
 package com.goafanti.admin.controller;
 
 
+import java.util.Arrays;
+
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
@@ -9,6 +11,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.goafanti.common.bo.Result;
@@ -29,6 +32,8 @@ public class AdminDemandApiController extends CertifyApiController {
 	@Resource
 	private DemandService demandService;
 	
+	
+	
 	/**
 	 * 个人需求详情
 	 */
@@ -46,49 +51,7 @@ public class AdminDemandApiController extends CertifyApiController {
 	}
 	
 	
-	/**
-	 * 需求资料--图片上传
-	 */
-	@RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
-	public Result uploadPicture(HttpServletRequest req, String sign, String uid) {
-		Result res = new Result();
-		if (StringUtils.isBlank(uid)){
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户ID", "用户ID"));
-			return res;
-		}
-		
-		AttachmentType attachmentType = AttachmentType.getField(sign);
-
-		if (attachmentType == AttachmentType.DEMAND_PICTURE) {
-			res.setData(handleFiles(res, "/demand/", false, req, sign, uid));
-		} else {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
-		}
-		
-		return res;
-	}
 	
-	/**
-	 * 需求资料--文本文件上传
-	 */
-	@RequestMapping(value = "/uploadTextFile", method = RequestMethod.POST)
-	public Result uploadTextFile(HttpServletRequest req, String sign, String uid){
-		Result res = new Result();
-	
-		if (StringUtils.isBlank(uid)){
-			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户ID", "用户ID"));
-			return res;
-		}
-		
-		AttachmentType attachmentType = AttachmentType.getField(sign);
-
-		if (attachmentType == AttachmentType.DEMAND_TEXT_FILE) {
-			res.setData(handleFiles(res, "/demand/", false, req, sign, uid));
-		} else {
-			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
-		}
-		return res;
-	}
 
 	/**
 	 * 个人用户--需求列表
@@ -188,6 +151,64 @@ public class AdminDemandApiController extends CertifyApiController {
 		return res;
 	}
 	
+	/**
+	 * 需求资料--图片上传
+	 */
+	@RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
+	public Result uploadPicture(HttpServletRequest req, String sign, String uid) {
+		Result res = new Result();
+		if (StringUtils.isBlank(uid)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户ID", "用户ID"));
+			return res;
+		}
+		
+		AttachmentType attachmentType = AttachmentType.getField(sign);
+
+		if (attachmentType == AttachmentType.DEMAND_PICTURE) {
+			res.setData(handleFiles(res, "/demand/", false, req, sign, uid));
+		} else {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
+		}
+		
+		return res;
+	}
+	
+	/**
+	 * 需求资料--文本文件上传
+	 */
+	@RequestMapping(value = "/uploadTextFile", method = RequestMethod.POST)
+	public Result uploadTextFile(HttpServletRequest req, String sign, String uid){
+		Result res = new Result();
+	
+		if (StringUtils.isBlank(uid)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到用户ID", "用户ID"));
+			return res;
+		}
+		
+		AttachmentType attachmentType = AttachmentType.getField(sign);
+
+		if (attachmentType == AttachmentType.DEMAND_TEXT_FILE) {
+			res.setData(handleFiles(res, "/demand/", false, req, sign, uid));
+		} else {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件标示"));
+		}
+		return res;
+	}
+	
+	/**
+	 * 删除需求(个人&团体)
+	 */
+	@RequestMapping(value = "/delete", method = RequestMethod.POST)
+	public Result delete(@RequestParam(name = "ids[]", required = false) String[] ids){
+		Result res = new Result();
+		if (ids == null || ids.length < 1) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", ""));
+		} else {
+			res.setData(demandService.deleteByPrimaryKey(Arrays.asList(ids)));
+		}
+		return res;
+	}
+	
 	private Result disposeDemand(Result res, InputDemand demand){
 		if (StringUtils.isBlank(demand.getName())) {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "找不到需求名称", "需求名称"));

+ 4 - 0
src/main/java/com/goafanti/common/dao/DemandMapper.java

@@ -1,5 +1,7 @@
 package com.goafanti.common.dao;
 
+import java.util.List;
+
 import com.goafanti.common.model.Demand;
 import com.goafanti.demand.bo.DemandManageDetailBo;
 
@@ -17,4 +19,6 @@ public interface DemandMapper {
     int updateByPrimaryKey(Demand record);
 
 	DemandManageDetailBo selectUserDemandDetail(String id);
+
+	int batchDeleteByPrimaryKey(List<String> id);
 }

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

@@ -707,4 +707,12 @@
   	where d.data_category = 0 and d.id = #{id,jdbcType=VARCHAR}
   </select>
   
+  <update id="batchDeleteByPrimaryKey" parameterType="java.util.List">
+  	update demand set deleted_sign = 1
+  	where  id in 
+	<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+		#{item}
+	</foreach>
+  </update>
+  
 </mapper>

+ 3 - 3
src/main/java/com/goafanti/demand/bo/InputDemand.java

@@ -28,15 +28,15 @@ public class InputDemand {
 	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	private Integer		infoSources;
 	
-	@Max(value = 99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Max(value = 999, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	private Integer		industryCategoryA;
 	
-	@Max(value = 99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Max(value = 999, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	private Integer		industryCategoryB;
 	
-	@Max(value = 99, message = "{" + ErrorConstants.PARAM_ERROR + "}")
+	@Max(value = 999, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	@Min(value = 0, message = "{" + ErrorConstants.PARAM_ERROR + "}")
 	private Integer		industryCategoryC;
 	

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

@@ -1,5 +1,7 @@
 package com.goafanti.demand.service;
 
+import java.util.List;
+
 import com.goafanti.common.model.Demand;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.demand.bo.DemandManageDetailBo;
@@ -23,4 +25,6 @@ public interface DemandService {
 
 	DemandManageDetailBo selectUserDemandDetail(String id);
 
+	int deleteByPrimaryKey(List<String> asList);
+
 }

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

@@ -4,6 +4,7 @@ import java.text.ParseException;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
@@ -358,4 +359,9 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 	public DemandManageDetailBo selectUserDemandDetail(String id) {
 		return demandMapper.selectUserDemandDetail(id);
 	}
+
+	@Override
+	public int deleteByPrimaryKey(List<String> id) {
+		return demandMapper.batchDeleteByPrimaryKey(id);
+	}
 }