Browse Source

新增限制项目列表

anderx 1 year ago
parent
commit
d9e68e2989

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

@@ -39,4 +39,16 @@ public class RestrictProjectController extends CertifyApiController {
         }
         return res.data(restrictProjectService.list(in));
     }
+
+    /**
+     * 限定项目修改
+     * @param id 编号
+     * @param type 0=移除,1=转交
+     * @param takeAid 接受者
+     */
+    @RequestMapping(value ="/update",method = RequestMethod.POST)
+    public Result update(Integer id,Integer type,String takeAid){
+        Result res = res();
+        return res.data(restrictProjectService.update(id,type,takeAid));
+    }
 }

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

@@ -1,9 +1,12 @@
 package com.goafanti.business.service;
 
+
 import com.goafanti.business.bo.InputRestrictProject;
 
 public interface RestrictProjectService {
     int add(InputRestrictProject in);
 
     Object list(InputRestrictProject in);
+
+    Object update(Integer id,Integer type,String takeAid);
 }

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

@@ -3,8 +3,10 @@ package com.goafanti.business.service.impl;
 import com.goafanti.business.bo.InputRestrictProject;
 import com.goafanti.business.service.RestrictProjectService;
 import com.goafanti.common.dao.RestrictProjectMapper;
+import com.goafanti.common.dao.UserTransferLogMapper;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.RestrictProject;
+import com.goafanti.common.model.UserTransferLog;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.shiro.token.TokenManager;
 import org.springframework.stereotype.Service;
@@ -16,6 +18,8 @@ import java.util.Date;
 public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMapper> implements RestrictProjectService {
     @Resource
     private RestrictProjectMapper restrictProjectMapper;
+    @Resource
+    private UserTransferLogMapper userTransferLogMapper;
     @Override
     public int add(InputRestrictProject in) {
         String aid = TokenManager.getAdminId();
@@ -32,12 +36,57 @@ public class RestrictProjectServiceImpl extends BaseMybatisDao<RestrictProjectMa
             in.setId(use.getId());
             restrictProjectMapper.updateByPrimaryKeySelective(in);
         }
+        addUserLog(in,0);
         return 1;
     }
 
+    /**
+     *
+     * @param in
+     * @param i 0=新增 1=移除
+     */
+    private void addUserLog(RestrictProject in, int i) {
+        addUserLog(in,i,null);
+    }
+
     @Override
     public Object list(InputRestrictProject in) {
         in.setAid(TokenManager.getAdminId());
         return restrictProjectMapper.selectByUidAndAid(in);
     }
+
+    @Override
+    public Object update(Integer id,Integer type,String takeAid) {
+        Date date = new Date();
+        RestrictProject in = new RestrictProject();
+        RestrictProject use = restrictProjectMapper.selectByPrimaryKey(id);
+        in.setId(id);
+        if (type==0){
+            in.setReleaseTime(date);
+            addUserLog(use,1);
+        }else if (in.getType()==1){
+            in.setLockTime(date);
+            in.setAid(takeAid);
+            in.setPid(use.getPid());
+            in.setUid(use.getUid());
+            addUserLog(use,0,takeAid);
+        }
+        return restrictProjectMapper.updateByPrimaryKeySelective(in);
+    }
+
+    private void addUserLog(RestrictProject in, int i, String takeAid) {
+        UserTransferLog log = new UserTransferLog();
+        log.setUid(in.getUid());
+
+        log.setPid(in.getPid());
+        if (i == 0){
+            log.setAid(in.getAid());
+            log.setType(15);
+        } else if (i == 1) {
+            log.setAid(TokenManager.getAdminId());
+            log.setTakeAid(takeAid);
+            log.setType(16);
+        }
+        userTransferLogMapper.insertSelective(log);
+    }
 }

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

@@ -14,13 +14,13 @@ import java.util.List;
 */
 public interface RestrictProjectMapper {
 
-    int deleteByPrimaryKey(Long id);
+    int deleteByPrimaryKey(Integer id);
 
     int insert(RestrictProject record);
 
     int insertSelective(RestrictProject record);
 
-    RestrictProject selectByPrimaryKey(Long id);
+    RestrictProject selectByPrimaryKey(Integer id);
 
     int updateByPrimaryKeySelective(RestrictProject record);
 

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

@@ -21,7 +21,7 @@
         release_time,create_time
     </sql>
 
-    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
         select
         <include refid="Base_Column_List" />
         from restrict_project
@@ -29,7 +29,7 @@
     </select>
 
 
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
         delete from restrict_project
         where  id = #{id,jdbcType=INTEGER} 
     </delete>

+ 5 - 6
src/main/java/com/goafanti/common/model/UserTransferLog.java

@@ -1,7 +1,7 @@
 package com.goafanti.common.model;
 
-import java.util.Date;
 import java.io.Serializable;
+import java.util.Date;
 
 public class UserTransferLog implements Serializable {
 
@@ -31,8 +31,7 @@ public class UserTransferLog implements Serializable {
 	 */
 	private String takeAid;
 	/**
-	 * This field was generated by MyBatis Generator. This field corresponds to the database column user_transfer_log.type
-	 * @mbg.generated  Fri Apr 23 09:38:20 CST 2021
+	 * 类型 0录入 1 领取 2 转交私有客户 3转交业务 4 未跟进丢失(30) 5未签单丢失(270天)6释放  7转交签单客户 8渠道录入 9渠道客户总监分配 10 渠道客户经理分配 11渠道释放 12回收 13离职客户转交 14离职签单业务转交
 	 */
 	private Integer type;
 	/**
@@ -151,9 +150,9 @@ public class UserTransferLog implements Serializable {
 	}
 
 	/**
-	 * This method was generated by MyBatis Generator. This method sets the value of the database column user_transfer_log.type
-	 * @param type  the value for user_transfer_log.type
-	 * @mbg.generated  Fri Apr 23 09:38:20 CST 2021
+	 * 类型 0录入 1 领取 2 转交私有客户 3转交业务 4 未跟进丢失(30) 5未签单丢失(270天)6释放  7转交签单客户 8渠道录入 9渠道客户总监分配
+	 * 10 渠道客户经理分配 11渠道释放 12回收 13离职客户转交 14离职签单业务转交 15限定项目新增 16限项目移除 17限定项目转交 18限定项目私有释放
+	 * 19 限定项目签单释放
 	 */
 	public void setType(Integer type) {
 		this.type = type;