Browse Source

新增项目日志

anderx 4 years ago
parent
commit
3bcdee2380

+ 1 - 1
GeneratorConfig.xml

@@ -43,7 +43,7 @@
     <property name="enableSubPackages" value="false"/>
      <property name="nullCatalogMeansCurrent" value="true"/>
     </javaClientGenerator>
-    <table schema="aft" tableName="user_channel"   enableCountByExample="false"
+    <table schema="aft" tableName="task_attribution_log"   enableCountByExample="false"
                enableUpdateByExample="false"
                enableDeleteByExample="false"
                enableSelectByExample="false"

+ 4 - 1
src/main/java/com/goafanti/common/controller/BaseController.java

@@ -61,7 +61,10 @@ public class BaseController {
 	protected Error buildError(String key, String message) {
 		String msg = (String) errorResource.getProperty(key);
 		if (StringUtils.isEmpty(msg)) {
-			msg = message;
+				msg = message;
+		}
+		if (StringUtils.isEmpty(msg)) {
+				msg = key;
 		}
 		return new Error(key, msg);
 	}

+ 47 - 0
src/main/java/com/goafanti/common/dao/TaskAttributionLogMapper.java

@@ -0,0 +1,47 @@
+package com.goafanti.common.dao;
+
+import java.util.List;
+
+import com.goafanti.common.model.TaskAttributionLog;
+import com.goafanti.order.bo.taskAttributionLogBo;
+
+public interface TaskAttributionLogMapper {
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table task_attribution_log
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	int deleteByPrimaryKey(Integer id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table task_attribution_log
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	int insert(TaskAttributionLog record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table task_attribution_log
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	int insertSelective(TaskAttributionLog record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table task_attribution_log
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	TaskAttributionLog selectByPrimaryKey(Integer id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table task_attribution_log
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	int updateByPrimaryKeySelective(TaskAttributionLog record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table task_attribution_log
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	int updateByPrimaryKey(TaskAttributionLog record);
+
+	List<taskAttributionLogBo> selectByTid(Integer tid);
+}

+ 2 - 2
src/main/java/com/goafanti/common/enums/OrderLogProcess.java

@@ -14,8 +14,8 @@ public enum OrderLogProcess {
 	TP(4, "特批通过"),
 	CWPD(5, "财务派单"),
 	CWSF(6, "财务首付"),
-	XMDDPD(7, "项目订单派单"),
-	XMPD(8, "项目派单"),
+	XMDDPD(7, "项目总监派单"),
+	XMJLPD(8, "项目经理派单"),
 	XMWC(9, "项目完成"),
 	FQTD(0,"发起退单"),
 	WCTD(10,"退单完成"),

+ 1 - 1
src/main/java/com/goafanti/common/error/SystemExceptionResolver.java

@@ -83,7 +83,7 @@ public class SystemExceptionResolver extends SimpleMappingExceptionResolver{
 			error = new Error((String) message);
 		} else {
 			error = new Error((String) errorResource.getProperty(ex.getClass().getName()));
-			LoggerUtils.fmtError(getClass(), ex, "系统异常。");
+			LoggerUtils.fmtError(getClass(), ex, "系统异常。",ex.getClass().getName());
 		}
 		if (StringUtils.isEmpty(error.getMessage())) {
 			error.setMessage("系统异常,请联系管理员。");

+ 164 - 0
src/main/java/com/goafanti/common/mapper/TaskAttributionLogMapper.xml

@@ -0,0 +1,164 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.TaskAttributionLogMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.TaskAttributionLog">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri May 14 13:44:50 CST 2021.
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="tid" jdbcType="INTEGER" property="tid" />
+    <result column="aid" jdbcType="VARCHAR" property="aid" />
+    <result column="receive_id" jdbcType="VARCHAR" property="receiveId" />
+    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri May 14 13:44:50 CST 2021.
+    -->
+    id, tid, aid, receive_id, remarks, `status`, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri May 14 13:44:50 CST 2021.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from task_attribution_log
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri May 14 13:44:50 CST 2021.
+    -->
+    delete from task_attribution_log
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.TaskAttributionLog">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri May 14 13:44:50 CST 2021.
+    -->
+    insert into task_attribution_log (id, tid, aid, 
+      receive_id, remarks, `status`, 
+      create_time)
+    values (#{id,jdbcType=INTEGER}, #{tid,jdbcType=INTEGER}, #{aid,jdbcType=VARCHAR}, 
+      #{receiveId,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, 
+      #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.TaskAttributionLog">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri May 14 13:44:50 CST 2021.
+    -->
+    insert into task_attribution_log
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="tid != null">
+        tid,
+      </if>
+      <if test="aid != null">
+        aid,
+      </if>
+      <if test="receiveId != null">
+        receive_id,
+      </if>
+      <if test="remarks != null">
+        remarks,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="tid != null">
+        #{tid,jdbcType=INTEGER},
+      </if>
+      <if test="aid != null">
+        #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="receiveId != null">
+        #{receiveId,jdbcType=VARCHAR},
+      </if>
+      <if test="remarks != null">
+        #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TaskAttributionLog">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri May 14 13:44:50 CST 2021.
+    -->
+    update task_attribution_log
+    <set>
+      <if test="tid != null">
+        tid = #{tid,jdbcType=INTEGER},
+      </if>
+      <if test="aid != null">
+        aid = #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="receiveId != null">
+        receive_id = #{receiveId,jdbcType=VARCHAR},
+      </if>
+      <if test="remarks != null">
+        remarks = #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TaskAttributionLog">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri May 14 13:44:50 CST 2021.
+    -->
+    update task_attribution_log
+    set tid = #{tid,jdbcType=INTEGER},
+      aid = #{aid,jdbcType=VARCHAR},
+      receive_id = #{receiveId,jdbcType=VARCHAR},
+      remarks = #{remarks,jdbcType=VARCHAR},
+      `status` = #{status,jdbcType=INTEGER},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  
+  <select id="selectByTid" resultType="com.goafanti.order.bo.taskAttributionLogBo">
+  select a.id,a.tid,b.name aName ,c.name receiveName,a.status ,a.remarks,date_format(a.create_time ,'%Y-%m-%d %H:%i:%S') createTimes 
+   	from task_attribution_log a left join admin b on a.aid =b.id
+   	left join admin c on a.receive_id =c.id  
+   	where tid= #{tid} order by a.create_time 
+  </select>
+</mapper>

+ 216 - 0
src/main/java/com/goafanti/common/model/TaskAttributionLog.java

@@ -0,0 +1,216 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class TaskAttributionLog implements Serializable {
+	
+	
+	public TaskAttributionLog() {};
+	/**
+	 * 
+	 * @param tid
+	 * @param aid
+	 * @param receiveId
+	 * @param remarks
+	 * @param status
+	 * @param createTime
+	 */
+	public TaskAttributionLog(Integer tid,String aid,String receiveId,String remarks,Integer status,Date createTime) {
+		this.tid=tid;
+		this.aid=aid;
+		this.receiveId=receiveId;
+		this.remarks=remarks;
+		this.status=status;
+		this.createTime=createTime;
+	};
+
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column task_attribution_log.id
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	private Integer id;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column task_attribution_log.tid
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	private Integer tid;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column task_attribution_log.aid
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	private String aid;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column task_attribution_log.receive_id
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	private String receiveId;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column task_attribution_log.remarks
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	private String remarks;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column task_attribution_log.status
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	private Integer status;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column task_attribution_log.create_time
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	private Date createTime;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database table task_attribution_log
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column task_attribution_log.id
+	 * @return  the value of task_attribution_log.id
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public Integer getId() {
+		return id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column task_attribution_log.id
+	 * @param id  the value for task_attribution_log.id
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column task_attribution_log.tid
+	 * @return  the value of task_attribution_log.tid
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public Integer getTid() {
+		return tid;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column task_attribution_log.tid
+	 * @param tid  the value for task_attribution_log.tid
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public void setTid(Integer tid) {
+		this.tid = tid;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column task_attribution_log.aid
+	 * @return  the value of task_attribution_log.aid
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public String getAid() {
+		return aid;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column task_attribution_log.aid
+	 * @param aid  the value for task_attribution_log.aid
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public void setAid(String aid) {
+		this.aid = aid == null ? null : aid.trim();
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column task_attribution_log.receive_id
+	 * @return  the value of task_attribution_log.receive_id
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public String getReceiveId() {
+		return receiveId;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column task_attribution_log.receive_id
+	 * @param receiveId  the value for task_attribution_log.receive_id
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public void setReceiveId(String receiveId) {
+		this.receiveId = receiveId == null ? null : receiveId.trim();
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column task_attribution_log.remarks
+	 * @return  the value of task_attribution_log.remarks
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public String getRemarks() {
+		return remarks;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column task_attribution_log.remarks
+	 * @param remarks  the value for task_attribution_log.remarks
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public void setRemarks(String remarks) {
+		this.remarks = remarks == null ? null : remarks.trim();
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column task_attribution_log.status
+	 * @return  the value of task_attribution_log.status
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public Integer getStatus() {
+		return status;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column task_attribution_log.status
+	 * @param status  the value for task_attribution_log.status
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column task_attribution_log.create_time
+	 * @return  the value of task_attribution_log.create_time
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column task_attribution_log.create_time
+	 * @param createTime  the value for task_attribution_log.create_time
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table task_attribution_log
+	 * @mbg.generated  Fri May 14 13:44:50 CST 2021
+	 */
+	@Override
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		sb.append(getClass().getSimpleName());
+		sb.append(" [");
+		sb.append("Hash = ").append(hashCode());
+		sb.append(", id=").append(id);
+		sb.append(", tid=").append(tid);
+		sb.append(", aid=").append(aid);
+		sb.append(", receiveId=").append(receiveId);
+		sb.append(", remarks=").append(remarks);
+		sb.append(", status=").append(status);
+		sb.append(", createTime=").append(createTime);
+		sb.append(", serialVersionUID=").append(serialVersionUID);
+		sb.append("]");
+		return sb.toString();
+	}
+}

+ 52 - 0
src/main/java/com/goafanti/order/bo/taskAttributionLogBo.java

@@ -0,0 +1,52 @@
+package com.goafanti.order.bo;
+
+
+import com.goafanti.common.model.TaskAttributionLog;
+import com.goafanti.order.enums.TaskAttributionLogStatus;
+
+public class taskAttributionLogBo  extends TaskAttributionLog{
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	
+	private String createTimes;
+
+	private String receiveName;
+	private String aName;
+	
+	
+	public String getReceiveName() {
+		return receiveName;
+	}
+
+	public void setReceiveName(String receiveName) {
+		this.receiveName = receiveName;
+	}
+
+	public String getaName() {
+		return aName;
+	}
+
+	public void setaName(String aName) {
+		this.aName = aName;
+	}
+
+	public String getCreateTimes() {
+		return createTimes;
+	}
+
+	public void setCreateTimes(String createTimes) {
+		this.createTimes = createTimes;
+	}
+
+	public String getStatusName() {
+		if (getStatus()!=null) {
+			return TaskAttributionLogStatus.getValueByCode(getStatus());
+		}
+		return "未知";
+	}
+
+	
+}

+ 28 - 3
src/main/java/com/goafanti/order/controller/OrderProjectApiController.java

@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
+import org.apache.poi.hssf.util.HSSFColor.TURQUOISE;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.BindingResult;
@@ -18,11 +19,13 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.model.TTaskHours;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.common.utils.excel.NewExcelUtil;
+import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.order.bo.TOrderTaskDetailBo;
 import com.goafanti.order.bo.TOrderTaskListBo;
 import com.goafanti.order.bo.TaskProgressBo;
@@ -45,16 +48,26 @@ public class OrderProjectApiController extends CertifyApiController {
 	 * 项目分配
 	 * taskId 项目ID
 	 * taskReceiverId 受理人ID
-	 * specially 0 任务派单(咨询师经理派单) 1项目派单(咨询师管理员派单)2咨询师退回给经理
+	 * type 0管理员派单 1经理转交 2经理派单 3咨询师转交 4回退
 	 */
 	@RequestMapping(value = "/projectDistribution", method = RequestMethod.POST)
-	public Result projectDistribution(Integer taskId,String taskReceiverId,Integer specially ,String remarks){
+	public Result projectDistribution(Integer taskId,String taskReceiverId ,String remarks,Integer type){
 		Result res = new Result();
 		if(null==taskId || StringUtils.isBlank(taskReceiverId)){
 			res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "任务编号和受理人"));
 			return res;
 		}
-		res.setData(orderProjectService.updateProjectDistribution( taskId, taskReceiverId,specially,remarks));
+		if(type==null) type=0;
+		boolean flag=true;
+		if (type==0&&(TokenManager.hasRole(AFTConstants.TECH_ADMIN)||TokenManager.hasRole(AFTConstants.SUPERADMIN)))flag=false;
+		else if ((type==1||type==2)&&TokenManager.hasRole(AFTConstants.TECH_MANAGER))flag=false;
+		else if ((type==3||type==4)&&TokenManager.hasRole(AFTConstants.TECH))flag=false;
+		if (flag) {
+			res.getError().add(buildError("角色不正确,请勿在浏览器登录多个账号!"));
+			return res;
+		}
+		
+		res.setData(orderProjectService.updateProjectDistribution( taskId, taskReceiverId,remarks,type));
 		return res;
 	}
 	
@@ -336,4 +349,16 @@ public class OrderProjectApiController extends CertifyApiController {
 		NewExcelUtil<TOrderTaskListBo>excel=new NewExcelUtil<>(TOrderTaskListBo.class);
 		return excel.exportExcel(list, str, response);
 		}
+	
+	
+	@RequestMapping(value = "/taskAttributionLog",method = RequestMethod.GET)
+	public Result taskAttributionLog(Integer tid) {
+		Result res =new Result();
+		if (tid==null) {
+			res.getError().add(buildError(ErrorConstants.PARAM_ERROR,"项目编号","项目编号"));
+			return res;
+		}
+		res.data(orderProjectService.taskAttributionLog(tid));
+		return res;
+	}
 }

+ 66 - 0
src/main/java/com/goafanti/order/enums/TaskAttributionLogStatus.java

@@ -0,0 +1,66 @@
+package com.goafanti.order.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum TaskAttributionLogStatus {
+
+//	状态 0管理员分配 1经理转交 2经理分配 3咨询师转交 4咨询师回退
+		/** 管理员分配 */
+		GLYFP(0,"管理员分配"),
+		/** 经理转交 **/
+		JLZJ(1,"经理转交"),
+		/** 经理分配 **/
+		JLFP(2,"经理分配"),
+		/** 锁定 **/
+		ZXSZJ(3,"咨询师转交"),
+		/** 咨询师回退 **/
+		HT(3,"咨询师回退"),
+		/** 无效 **/
+		NULL(10, "");
+		
+		private TaskAttributionLogStatus(Integer code, String desc) {
+			this.code = code;
+			this.desc = desc;
+		}
+
+		private static Map<Integer, TaskAttributionLogStatus> status = new HashMap<Integer, TaskAttributionLogStatus>();
+
+		static {
+			for (TaskAttributionLogStatus value : TaskAttributionLogStatus.values()) {
+				status.put(value.getCode(), value);
+			}
+		}
+		public static TaskAttributionLogStatus getStatus(Integer code) {
+			if (containsType(code)) {
+				return status.get(code);
+			}
+			return NULL;
+		}
+		
+		public static String getValueByCode(Integer code){
+	        for(TaskAttributionLogStatus TaskAttributionLogStatus:TaskAttributionLogStatus.values()){
+	            if(code.equals(TaskAttributionLogStatus.getCode())){
+	                return TaskAttributionLogStatus.getDesc();
+	            }
+	        }
+	        return  null;
+	    }
+		public static boolean containsType(Integer code) {
+			return status.containsKey(code);
+		}
+		private Integer	code;
+		private String	desc;
+		public Integer getCode() {
+			return code;
+		}
+		public void setCode(Integer code) {
+			this.code = code;
+		}
+		public String getDesc() {
+			return desc;
+		}
+		public void setDesc(String desc) {
+			this.desc = desc;
+		}
+	}

+ 3 - 0
src/main/java/com/goafanti/order/service/OrderNewService.java

@@ -200,6 +200,9 @@ public interface OrderNewService {
 	
 	int pushOutsourceProjectAudit(TOrderOutsource o);
 	Pagination<OutArrearsDunListBo> arrearsDunList(InputArrearsDunListBo in);
+	/**
+	 * 	非特批触发订单催款
+	 */
 	void pushOrderDun(String orderNo);
 	int checkOutAudit(Integer id);
 	

+ 11 - 1
src/main/java/com/goafanti/order/service/OrderProjectService.java

@@ -15,11 +15,20 @@ import com.goafanti.order.bo.UpdateProjectStatusBo;
 import com.goafanti.order.bo.inuptTaskHoursListBo;
 import com.goafanti.order.bo.inuptTaskListBo;
 import com.goafanti.order.bo.managerListBo;
+import com.goafanti.order.bo.taskAttributionLogBo;
 import com.goafanti.organization.bo.OutPaymentNode;
 
 public interface OrderProjectService {
 
-	int updateProjectDistribution(Integer taskId, String taskReceiverId,Integer specially, String remarks);
+	/**
+	 * 
+	 * @param taskId
+	 * @param taskReceiverId
+	 * @param remarks
+	 * @param type 0管理员派单 1经理转交 2经理派单 3咨询师转交 4回退
+	 * @return
+	 */
+	int updateProjectDistribution(Integer taskId, String taskReceiverId, String remarks,Integer type);
 
 	Pagination<TOrderTaskListBo> orderTaskList(inuptTaskListBo ib);
 
@@ -66,6 +75,7 @@ public interface OrderProjectService {
 
 	int updateProjectStatus(UpdateProjectStatusBo b);
 
+	List<taskAttributionLogBo> taskAttributionLog(Integer tid);
 
 
 }

+ 4 - 1
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -643,8 +643,10 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 	}
 
 
-
+	
 	public void pushOrderDun(String orderNo) {
+		TOrderNew b=tOrderNewMapper.selectByPrimaryKey(orderNo);
+		if(b.getApproval()==0){
 			List<OutNewOrderDunBo> list=newOrderDunMapper.selectListNewOrderDun(orderNo,null,0);
 			for (OutNewOrderDunBo o : list) {
 				if (o.getDunType()==1) {	
@@ -667,6 +669,7 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 					addNewDunNoticAndSendEmail(orderNo,o);
 				}
 			}
+		}
 	}
 
 

+ 77 - 47
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -42,6 +42,7 @@ import com.goafanti.common.dao.TOrderTaskMapper;
 import com.goafanti.common.dao.TTaskHoursMapper;
 import com.goafanti.common.dao.TTaskLogMapper;
 import com.goafanti.common.dao.TTaskMidMapper;
+import com.goafanti.common.dao.TaskAttributionLogMapper;
 import com.goafanti.common.dao.TaskHoursCountMapper;
 import com.goafanti.common.dao.TaskLogMapper;
 import com.goafanti.common.dao.TaskProgressLogMapper;
@@ -68,11 +69,11 @@ import com.goafanti.common.model.TOrderTask;
 import com.goafanti.common.model.TTaskHours;
 import com.goafanti.common.model.TTaskLog;
 import com.goafanti.common.model.TTaskMid;
+import com.goafanti.common.model.TaskAttributionLog;
 import com.goafanti.common.model.TaskHoursCount;
 import com.goafanti.common.model.TaskLog;
 import com.goafanti.common.model.TaskProgress;
 import com.goafanti.common.model.TaskProgressLog;
-import com.goafanti.common.model.User;
 import com.goafanti.common.model.UserBusiness;
 import com.goafanti.common.model.UserChannel;
 import com.goafanti.common.model.UserLockRelease;
@@ -93,6 +94,7 @@ import com.goafanti.order.bo.UpdateProjectStatusBo;
 import com.goafanti.order.bo.inuptTaskHoursListBo;
 import com.goafanti.order.bo.inuptTaskListBo;
 import com.goafanti.order.bo.managerListBo;
+import com.goafanti.order.bo.taskAttributionLogBo;
 import com.goafanti.order.enums.BonusSubject;
 import com.goafanti.order.enums.NewOrderDunType;
 import com.goafanti.order.enums.NewProjectStatus;
@@ -102,7 +104,7 @@ import com.goafanti.order.service.OrderNewService;
 import com.goafanti.order.service.OrderProjectService;
 import com.goafanti.organization.bo.OutPaymentNode;
 import com.goafanti.techproject.enums.TaskState;
-import com.mysql.fabric.xmlrpc.base.Data;
+
 @Service
 public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> implements OrderProjectService {
 	@Autowired
@@ -155,13 +157,15 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 	private UserBusinessMapper	userBusinessMapper;
 	@Autowired
 	private UserChannelMapper	userChannelMapper;
+	@Autowired
+	private TaskAttributionLogMapper	taskAttributionLogMapper;
 	@Value(value = "${upload.path}")
 	private String 					uploadPath 			= null;
 	
 	Logger							logger	= LoggerFactory.getLogger(OrderProjectServiceImpl.class);
 	
 	@Override
-	public int updateProjectDistribution(Integer taskId, String taskReceiverId,Integer specially,String remarks) {
+	public int updateProjectDistribution(Integer taskId, String taskReceiverId,String remarks,Integer type) {
 		TOrderTask t=tOrderTaskMapper.selectByPrimaryKey(taskId);
 		TOrderNew tn=checkDeleteSign(t.getOrderNo());
 		Date date=new Date();
@@ -170,58 +174,26 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		t.setTaskReceiver(taskReceiverId);
 		t.setTaskDistributionTime(date);
 		Admin a=adminMapper.selectByPrimaryKey(taskReceiverId);
+		insetLog(taskId, taskReceiverId);
+		addtaskAttributionLog(taskId,taskReceiverId,remarks,type,date);
 		if (a==null||a.getId()==null) {
 			throw  new BusinessException(new Error("分配人员不存在!","分配人员不存在!"));
 		}
-		insetLog(taskId, taskReceiverId);
-		//0-经理 (经理分派会创建子项目)1 管理员或经理转交
-		if (specially==1) {
+		if (type==0) {
 			addOrderLog(t.getOrderNo(), OrderLogProcess.XMDDPD.getCode(),remarks);
 			t.setManagerId(taskReceiverId);
 			t.setConsultantId(null);
 			//设置催款触发
-			TOrderNew b=tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
-			if(b.getApproval()==0)orderNewService.pushOrderDun(t.getOrderNo());
+			orderNewService.pushOrderDun(t.getOrderNo());
 			//未锁定客户就锁定客户
-			if (userMapper.checkLock(tn.getBuyerId())<1) {
-				userLockReleaseMapper.updateByAidAndUid(tn.getSalesmanId(),tn.getBuyerId());
-				userMapper.updateShareType(tn.getBuyerId(),tn.getSalesmanId());
-			}
-			//未锁定业务就锁定业务
-			if (userLockReleaseMapper.checkLock(tn.getSalesmanId(),tn.getBuyerId(),t.getCommodityId())<1) {
-				UserLockRelease ulr=new UserLockRelease();
-				ulr.setId(UUID.randomUUID().toString());
-				ulr.setBusinessProjectId(t.getCommodityId());
-				ulr.setType(1);
-				ulr.setUid(tn.getBuyerId());
-				ulr.setAid(tn.getSalesmanId());
-				ulr.setStatus(0);
-				ulr.setLockTime(date);
-				userLockReleaseMapper.insertSelective(ulr);
-			}
-				UserBusiness ub=new UserBusiness();
-				ub.setId(UUID.randomUUID().toString());
-				ub.setUid(tn.getBuyerId());
-				ub.setAid(tn.getSalesmanId());
-				ub.setFollowSituation(5);
-				ub.setCustomerStatus(4);
-				ub.setCreateTime(date);
-				ub.setUpdateTime(date);
-				ub.setRemarks("派单自动锁定客户");
-				ub.setBusinessProjectId(t.getCommodityId());
-				userBusinessMapper.insertSelective(ub);
-				
-				//如果是渠道客户更新渠道表
-				UserChannel uc=new UserChannel();
-				uc.setUid(tn.getBuyerId());
-				uc.setStatus(ChannelStatus.YQD.getCode());
-				uc.setSignTime(date);
-				userChannelMapper.updateByUid(uc);
-		}else if (specially==0) {
-			addOrderLog(t.getOrderNo(), OrderLogProcess.XMPD.getCode(),remarks);
+			pushUser(t, tn, date);
+		}else if(type==1) {
+			t.setManagerId(taskReceiverId);
+			t.setConsultantId(null);
+		}else if(type==2) {
+			addOrderLog(t.getOrderNo(), OrderLogProcess.XMJLPD.getCode(),remarks);
 			t.setConsultantId(taskReceiverId);
-		//咨询师推给咨询师经理
-		}else if(specially==2) { 
+		}else if(type==4) {
 			t.setConsultantId(null);
 		}
 		t.setReceiverName(a.getName());
@@ -229,13 +201,64 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		List<String> aids = new ArrayList<>();
 		aids.add(taskReceiverId);
 		orderNewService.pushGeneralSendNoticeAndEmail(aids, NoticeStatus.ORDER_TASK_TO.getCode(),t.getOrderNo(), TokenManager.getAdminId(),0);
-		
 		checkProjiectAllocation(t.getOrderNo());
 		return 1;
 	}
+
+
+	/**
+	 * 	推动客户、业务渠道的锁定
+	 * @param t
+	 * @param tn
+	 * @param date
+	 */
+	private void pushUser(TOrderTask t, TOrderNew tn, Date date) {
+		if (userMapper.checkLock(tn.getBuyerId())<1) {
+			userLockReleaseMapper.updateByAidAndUid(tn.getSalesmanId(),tn.getBuyerId());
+			userMapper.updateShareType(tn.getBuyerId(),tn.getSalesmanId());
+		}
+		//未锁定业务就锁定业务
+		if (userLockReleaseMapper.checkLock(tn.getSalesmanId(),tn.getBuyerId(),t.getCommodityId())<1) {
+			UserLockRelease ulr=new UserLockRelease();
+			ulr.setId(UUID.randomUUID().toString());
+			ulr.setBusinessProjectId(t.getCommodityId());
+			ulr.setType(1);
+			ulr.setUid(tn.getBuyerId());
+			ulr.setAid(tn.getSalesmanId());
+			ulr.setStatus(0);
+			ulr.setLockTime(date);
+			userLockReleaseMapper.insertSelective(ulr);
+		}
+			UserBusiness ub=new UserBusiness();
+			ub.setId(UUID.randomUUID().toString());
+			ub.setUid(tn.getBuyerId());
+			ub.setAid(tn.getSalesmanId());
+			ub.setFollowSituation(5);
+			ub.setCustomerStatus(4);
+			ub.setCreateTime(date);
+			ub.setUpdateTime(date);
+			ub.setRemarks("派单自动锁定客户");
+			ub.setBusinessProjectId(t.getCommodityId());
+			userBusinessMapper.insertSelective(ub);
+			
+			//如果是渠道客户更新渠道表
+			UserChannel uc=new UserChannel();
+			uc.setUid(tn.getBuyerId());
+			uc.setStatus(ChannelStatus.YQD.getCode());
+			uc.setSignTime(date);
+			userChannelMapper.updateByUid(uc);
+	}
 	
 	
 	
+	private void addtaskAttributionLog(Integer taskId, String taskReceiverId, String remarks, Integer type, Date date) {	
+		TaskAttributionLog log=new TaskAttributionLog(taskId,TokenManager.getAdminId(),taskReceiverId,remarks,type,date);
+		taskAttributionLogMapper.insertSelective(log);
+		
+	}
+
+
+
 	public TOrderNew checkDeleteSign(String orderNo) {
 		TOrderNew t=tOrderNewMapper.selectByPrimaryKey(orderNo);
 		if(t.getDeleteSign()==2||t.getDeleteSign()==3) throw new BusinessException(new Error(ErrorConstants.ORDER_ALREADY_REVOKE, t.getOrderNo(),""));
@@ -949,5 +972,12 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		Pagination<managerListBo> p = (Pagination<managerListBo>)findPage("managerSelectByPage", "managerSelectCount", params, pageNo, pageSize);
 		return p;
 	}
+
+
+	@Override
+	public List<taskAttributionLogBo> taskAttributionLog(Integer tid) {
+		
+		return taskAttributionLogMapper.selectByTid(tid);
+	}
 	
 }