浏览代码

限定项目客户情况查询开发

anderx 1 年之前
父节点
当前提交
ef73b56aae

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

@@ -107,6 +107,11 @@ public class InputRestrictProject extends RestrictProject {
         setUid(uid);
     }
 
+    /**
+     *
+     * @param uid 客户编号
+     * @param aid 所属人编号
+     */
     public InputRestrictProject(String uid, String aid) {
         setAid(aid);
         setUid(uid);

+ 25 - 0
src/main/java/com/goafanti/business/bo/UserRestrictProjectBo.java

@@ -0,0 +1,25 @@
+package com.goafanti.business.bo;
+
+public class UserRestrictProjectBo {
+    private String uid;
+    /**
+     * 0 自己的客户 1不是自己但是限定项目客户 2 不是自己并且没有限定项目客户 3 公共客户
+     */
+    private Integer type;
+
+    public String getUid() {
+        return uid;
+    }
+
+    public void setUid(String uid) {
+        this.uid = uid;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+}

+ 10 - 0
src/main/java/com/goafanti/business/controller/RestrictProjectController.java

@@ -2,6 +2,7 @@ package com.goafanti.business.controller;
 
 import com.goafanti.business.bo.InputRestrictProject;
 import com.goafanti.business.bo.RestrictProjectPageList;
+import com.goafanti.business.bo.UserRestrictProjectBo;
 import com.goafanti.business.service.RestrictProjectService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.controller.CertifyApiController;
@@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.util.List;
 
 @RestController
 @RequestMapping("/api/restrict/Project")
@@ -78,4 +80,12 @@ public class RestrictProjectController extends CertifyApiController {
     public Result<RestrictProjectPageList> getFollowDetails(String uid){
         return res().data(restrictProjectService.getFollowDetails(uid));
     }
+
+    /**
+     * 限定项目客户情况查询
+     */
+    @RequestMapping(value = "/getRestrictProjectUser",method = RequestMethod.GET)
+    public Result<List<UserRestrictProjectBo>> getRestrictProjectUser (String ids ){
+        return res().data(restrictProjectService.getRestrictProjectUser(ids));
+    }
 }

+ 2 - 0
src/main/java/com/goafanti/business/service/RestrictProjectService.java

@@ -13,4 +13,6 @@ public interface RestrictProjectService {
     Object pageList(InputRestrictProject in);
 
     Object getFollowDetails(String uid);
+
+    Object getRestrictProjectUser(String ids);
 }

+ 39 - 0
src/main/java/com/goafanti/business/service/impl/RestrictProjectServiceImpl.java

@@ -3,6 +3,7 @@ package com.goafanti.business.service.impl;
 import com.goafanti.business.bo.InputRestrictProject;
 import com.goafanti.business.bo.OutRestrictProject;
 import com.goafanti.business.bo.RestrictProjectPageList;
+import com.goafanti.business.bo.UserRestrictProjectBo;
 import com.goafanti.business.service.RestrictProjectService;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
@@ -159,6 +160,8 @@ public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMa
         return fbb;
     }
 
+
+
     private void pushPageList(List<RestrictProjectPageList> list) {
         LocalDateTime now = LocalDateTime.now();
         now=now.withHour(0).withMinute(0).withSecond(0).withNano(0);
@@ -195,4 +198,40 @@ public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMa
         }
         userTransferLogMapper.insertSelective(log);
     }
+
+    @Override
+    public Object getRestrictProjectUser(String ids) {
+        List<UserRestrictProjectBo> list = new ArrayList<>();
+        String aid=TokenManager.getAdminId();
+        if (ids!=null&& !ids.isEmpty()){
+            String[] split = ids.split(",");
+            for (String s : split) {
+                UserRestrictProjectBo bo = new UserRestrictProjectBo();
+                bo.setUid(s);
+                User user = userMapper.selectByPrimaryKey(s);
+                if (user.getShareType()==0||user.getShareType()==2){
+                    //0私有 2签单 查询当前是否有签订限定项目
+                    if (user.getAid().equals(aid)){
+                        //是自己的
+                        bo.setType(0);
+                    }else{
+                        //不是自己的
+                        List<RestrictProject> restrictProjects = restrictProjectMapper.selectListByParam(new InputRestrictProject(s, aid));
+                        if (!restrictProjects.isEmpty()){
+                            // 有限定项目
+                            bo.setType(1);
+                        }else{
+                            //没有限定
+                            bo.setType(2);
+                        }
+                    }
+                }else if(user.getShareType()==1){
+                    //公共客户
+                    bo.setType(3);
+                }
+            list.add(bo);
+            }
+        }
+        return list;
+    }
 }

+ 2 - 0
src/main/java/com/goafanti/common/dao/RestrictProjectMapper.java

@@ -43,4 +43,6 @@ public interface RestrictProjectMapper {
     void updateRelease(List<Integer> list2);
 
     void updateRefreshLockTime(@Param("uid") String uid, @Param("pid") String pid, @Param("aid") String aid);
+
+    Object selectRestrictProjectUser(List<String> list);
 }

+ 3 - 1
src/main/java/com/goafanti/common/mapper/RestrictProjectMapper.xml

@@ -120,7 +120,9 @@
         from restrict_project
         where aid = #{aid,jdbcType=VARCHAR}
         and uid =#{uid,jdbcType=VARCHAR}
-        and  pid = #{pid,jdbcType=VARCHAR}
+          <if test="pid != null">
+            and  pid = #{pid,jdbcType=VARCHAR}
+        </if>
     </select>
     <select id="selectByUidAndAid" resultType="com.goafanti.business.bo.OutRestrictProject">
         select a.id pid ,b.id,a.bname projectName,b.type,b.lock_time lockTime,b.release_time releaseTime ,