|
|
@@ -1,38 +1,100 @@
|
|
|
package com.goafanti.admin.controller;
|
|
|
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
+
|
|
|
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.BusinessProjectService;
|
|
|
import com.goafanti.common.bo.Result;
|
|
|
+import com.goafanti.common.constant.AFTConstants;
|
|
|
import com.goafanti.common.constant.ErrorConstants;
|
|
|
-import com.goafanti.common.controller.BaseController;
|
|
|
+
|
|
|
+import com.goafanti.common.controller.CertifyApiController;
|
|
|
+import com.goafanti.common.enums.AttachmentType;
|
|
|
import com.goafanti.common.utils.StringUtils;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("open/api/admin/ProjectSize")
|
|
|
-public class BusinessProjectController extends BaseController{
|
|
|
+public class BusinessProjectController extends CertifyApiController{
|
|
|
|
|
|
+ @Resource
|
|
|
BusinessProjectService businessprojectService;
|
|
|
|
|
|
/**
|
|
|
* 新增项目
|
|
|
*/
|
|
|
@RequestMapping(value = "/addProject" , method = RequestMethod.POST)
|
|
|
- public Result addProject(String bname,String cid,String country,String province,String city,String district) {
|
|
|
+ public Result addProject(String bname,String vid,String country,String province,String city,String district) {
|
|
|
Result res=new Result();
|
|
|
if (StringUtils.isBlank(bname)) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "项目名称名称为空", "项目名称"));
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(vid)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "所属品类为空", "所属品类"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ if (businessprojectService.getBnamecount(bname)>0) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_BEING_ERROR, "项目名称已存在", "项目名称"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ res.setData(businessprojectService.insert(bname, vid, country,province,city,district));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 项目搜索
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/listProject" , method = RequestMethod.POST)
|
|
|
+ public Result listProject(String bname,String cid,String country,String province,String city,String district,String activityFlag,String status,Integer pageNo, Integer pageSize ){
|
|
|
+ Result res=new Result();
|
|
|
+ if (StringUtils.isBlank(bname)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "项目名称名称为空", "项目名称"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
if (StringUtils.isBlank(cid)) {
|
|
|
res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "所属品类为空", "所属品类"));
|
|
|
return res;
|
|
|
}
|
|
|
- res.setData(businessprojectService.insert(bname, cid, country,province,city,district));
|
|
|
+ if (country==AFTConstants.USER_TYPE_PERSONAL) {
|
|
|
+ if (StringUtils.isBlank(province)) {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "所属品类为空", "所属省份"));
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ res.setData(businessprojectService.listProject( bname, cid, country,province, city, district ,activityFlag, status, pageNo,pageSize ));
|
|
|
return res;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 文本文件上传
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/uploadTextFile", method = RequestMethod.POST)
|
|
|
+ public Result uploadTextFile(HttpServletRequest req, String sign) {
|
|
|
+ Result res = new Result();
|
|
|
+ AttachmentType attachmentType = AttachmentType.getField(sign);
|
|
|
|
|
|
+ if (attachmentType == AttachmentType.BUSINESS_PROJECT_MIN_PICTURE
|
|
|
+ || attachmentType == AttachmentType.BUSINESS_PROJECT_MIN_PICTURE
|
|
|
+ ) {
|
|
|
+ res.setData(handleFiles(res, "/Project/", false, req, sign, "project"));
|
|
|
+ } else {
|
|
|
+ res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "附件"));
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取项目详情
|
|
|
+ */
|
|
|
+ /*@RequestMapping(value = "/orgProject", method = RequestMethod.POST)
|
|
|
+ public Result orgProject(String id){
|
|
|
+
|
|
|
+ }*/
|
|
|
}
|