Browse Source

新增修改,必须添加跟进进度和客户状态

anderx 1 year ago
parent
commit
3058a1e39e

+ 27 - 0
src/main/java/com/goafanti/business/bo/InputRestrictProject.java

@@ -1,6 +1,10 @@
 package com.goafanti.business.bo;
 
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.model.RestrictProject;
+import com.goafanti.common.utils.Param;
+
+import javax.validation.constraints.NotNull;
 
 public class InputRestrictProject extends RestrictProject {
     private Integer pageSize;
@@ -13,6 +17,29 @@ public class InputRestrictProject extends RestrictProject {
     private String endTime;
 
     private Integer type;
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR +"}")
+    @Param(name="跟进进度")
+    private Integer followSituation;
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR +"}")
+    @Param(name="客户状态")
+    private Integer customerStatus;
+
+
+    public Integer getFollowSituation() {
+        return followSituation;
+    }
+
+    public void setFollowSituation(Integer followSituation) {
+        this.followSituation = followSituation;
+    }
+
+    public Integer getCustomerStatus() {
+        return customerStatus;
+    }
+
+    public void setCustomerStatus(Integer customerStatus) {
+        this.customerStatus = customerStatus;
+    }
 
     public String getUserName() {
         return userName;

+ 9 - 2
src/main/java/com/goafanti/business/controller/RestrictProjectController.java

@@ -5,6 +5,9 @@ import com.goafanti.business.bo.RestrictProjectPageList;
 import com.goafanti.business.service.RestrictProjectService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.utils.ParamUtils;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
@@ -21,9 +24,13 @@ public class RestrictProjectController extends CertifyApiController {
      * 添加限制项目
      */
     @RequestMapping(value = "/add", method = RequestMethod.POST)
-    public Result add(InputRestrictProject in){
+    public Result add(@Validated InputRestrictProject in, BindingResult bindingResult){
         Result res = res();
-
+        if (bindingResult.hasErrors()) {
+            res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+                    ParamUtils.getParamName(in,bindingResult.getFieldError().getField())));
+            return res;
+        }
         return res.data(restrictProjectService.add(in));
     }
 

+ 14 - 4
src/main/java/com/goafanti/business/service/impl/RestrictProjectServiceImpl.java

@@ -4,9 +4,11 @@ import com.goafanti.business.bo.InputRestrictProject;
 import com.goafanti.business.bo.RestrictProjectPageList;
 import com.goafanti.business.service.RestrictProjectService;
 import com.goafanti.common.dao.RestrictProjectMapper;
+import com.goafanti.common.dao.UserBusinessMapper;
 import com.goafanti.common.dao.UserTransferLogMapper;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.RestrictProject;
+import com.goafanti.common.model.UserBusiness;
 import com.goafanti.common.model.UserTransferLog;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -16,10 +18,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
 import java.time.temporal.ChronoUnit;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMapper> implements RestrictProjectService {
@@ -27,6 +26,8 @@ public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMa
     private RestrictProjectMapper restrictProjectMapper;
     @Resource
     private UserTransferLogMapper userTransferLogMapper;
+    @Resource
+    private UserBusinessMapper userBusinessMapper;
     @Override
     public int add(InputRestrictProject in) {
         String aid = TokenManager.getAdminId();
@@ -43,6 +44,15 @@ public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMa
             in.setId(use.getId());
             restrictProjectMapper.updateByPrimaryKeySelective(in);
         }
+        UserBusiness ub=new UserBusiness();
+        ub.setId(UUID.randomUUID().toString());
+        ub.setAid(aid);
+        ub.setUid(in.getUid());
+        ub.setBusinessProjectId(in.getPid());
+        ub.setCustomerStatus(in.getCustomerStatus());
+        ub.setFollowSituation(in.getFollowSituation());
+        ub.setRemarks("领取限定项目触发");
+        userBusinessMapper.insertSelective(ub);
         addUserLog(in,0);
         return 1;
     }