Przeglądaj źródła

新增法务催款日志开发

anderx 4 lat temu
rodzic
commit
76cb67f030

+ 24 - 2
.idea/free-mybatis-generator-config.xml

@@ -142,6 +142,29 @@
             </Config>
           </value>
         </entry>
+        <entry key="t_order_legal_affairs">
+          <value>
+            <Config>
+              <option name="comment" value="true" />
+              <option name="daoMvnPath" value="src/main/java" />
+              <option name="daoName" value="TOrderLegalAffairsMapper" />
+              <option name="daoPackage" value="com.goafanti.common.dao" />
+              <option name="daoPostfix" value="Mapper" />
+              <option name="modelMvnPath" value="src/main/java" />
+              <option name="modelName" value="TOrderLegalAffairs" />
+              <option name="modelPackage" value="com.goafanti.common.model" />
+              <option name="name" value="t_order_legal_affairs" />
+              <option name="needToStringHashcodeEquals" value="true" />
+              <option name="overrideJava" value="true" />
+              <option name="overrideXML" value="true" />
+              <option name="primaryKey" value="id" />
+              <option name="projectFolder" value="$PROJECT_DIR$" />
+              <option name="tableName" value="t_order_legal_affairs" />
+              <option name="xmlMvnPath" value="src/main/java" />
+              <option name="xmlPackage" value="com.goafanti.common.mapper" />
+            </Config>
+          </value>
+        </entry>
         <entry key="t_order_mid">
           <value>
             <Config>
@@ -263,14 +286,13 @@
             <Config>
               <option name="comment" value="true" />
               <option name="daoPackage" value="com.goafanti.common.dao" />
-              <option name="daoPostfix" value="mapper" />
+              <option name="daoPostfix" value="Mapper" />
               <option name="modelPackage" value="com.goafanti.common.model" />
               <option name="name" value="initConfig" />
               <option name="needToStringHashcodeEquals" value="true" />
               <option name="overrideJava" value="true" />
               <option name="overrideXML" value="true" />
               <option name="projectFolder" value="$PROJECT_DIR$" />
-              <option name="xmlMvnPath" value="src/main/java" />
               <option name="xmlPackage" value="com.goafanti.common.mapper" />
             </Config>
           </value>

+ 1 - 1
src/main/java/com/goafanti/common/constant/AFTConstants.java

@@ -17,7 +17,7 @@ public class AFTConstants {
 	public static final String	SUPERADMIN							= "999999";
 	/**	特批决策者 */
 	public static final String	APPROVAL_DECISION					= "99999";
-	/**	特批决策者 */
+	/**	特批决策者审核 */
 	public static final String	APPROVAL_DECISION_AUDITOR			= "99989";
 	/**	总裁 */
 	public static final String	CED									= "99998";

+ 17 - 0
src/main/java/com/goafanti/common/dao/TOrderLegalAffairsMapper.java

@@ -0,0 +1,17 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.TOrderLegalAffairs;
+
+public interface TOrderLegalAffairsMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(TOrderLegalAffairs record);
+
+    int insertSelective(TOrderLegalAffairs record);
+
+    TOrderLegalAffairs selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(TOrderLegalAffairs record);
+
+    int updateByPrimaryKey(TOrderLegalAffairs record);
+}

+ 122 - 0
src/main/java/com/goafanti/common/mapper/TOrderLegalAffairsMapper.xml

@@ -0,0 +1,122 @@
+<?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.TOrderLegalAffairsMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderLegalAffairs">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
+    <result column="type" jdbcType="INTEGER" property="type" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+    <result column="attachment_url" jdbcType="VARCHAR" property="attachmentUrl" />
+    <result column="operation_time" jdbcType="DATE" property="operationTime" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, order_no, `type`, `status`, remarks, attachment_url, operation_time, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_order_legal_affairs
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from t_order_legal_affairs
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderLegalAffairs" useGeneratedKeys="true">
+    insert into t_order_legal_affairs (order_no, `type`, `status`, 
+      remarks, attachment_url, operation_time, 
+      create_time)
+    values (#{orderNo,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
+      #{remarks,jdbcType=VARCHAR}, #{attachmentUrl,jdbcType=VARCHAR}, #{operationTime,jdbcType=DATE}, 
+      #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderLegalAffairs" useGeneratedKeys="true">
+    insert into t_order_legal_affairs
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="orderNo != null">
+        order_no,
+      </if>
+      <if test="type != null">
+        `type`,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="remarks != null">
+        remarks,
+      </if>
+      <if test="attachmentUrl != null">
+        attachment_url,
+      </if>
+      <if test="operationTime != null">
+        operation_time,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="orderNo != null">
+        #{orderNo,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        #{type,jdbcType=INTEGER},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="remarks != null">
+        #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="attachmentUrl != null">
+        #{attachmentUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="operationTime != null">
+        #{operationTime,jdbcType=DATE},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderLegalAffairs">
+    update t_order_legal_affairs
+    <set>
+      <if test="orderNo != null">
+        order_no = #{orderNo,jdbcType=VARCHAR},
+      </if>
+      <if test="type != null">
+        `type` = #{type,jdbcType=INTEGER},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="remarks != null">
+        remarks = #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="attachmentUrl != null">
+        attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="operationTime != null">
+        operation_time = #{operationTime,jdbcType=DATE},
+      </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.TOrderLegalAffairs">
+    update t_order_legal_affairs
+    set order_no = #{orderNo,jdbcType=VARCHAR},
+      `type` = #{type,jdbcType=INTEGER},
+      `status` = #{status,jdbcType=INTEGER},
+      remarks = #{remarks,jdbcType=VARCHAR},
+      attachment_url = #{attachmentUrl,jdbcType=VARCHAR},
+      operation_time = #{operationTime,jdbcType=DATE},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 66 - 12
src/main/java/com/goafanti/common/mapper/TOrderMidMapper.xml

@@ -21,12 +21,14 @@
     <result column="province_name" jdbcType="VARCHAR" property="provinceName" />
     <result column="legal_affairs" jdbcType="INTEGER" property="legalAffairs" />
     <result column="dun_start_time" jdbcType="TIMESTAMP" property="dunStartTime" />
+    <result column="legal_affairs_type" jdbcType="INTEGER" property="legalAffairsType" />
+    <result column="operation_time" jdbcType="DATE" property="operationTime" />
   </resultMap>
   <sql id="Base_Column_List">
     id, order_no, salesman_id, finance_id, salesman_name, finance_name, final_receivables, 
     final_Receivables_time, invoice_amount, create_time, buyer_name, order_receivables, 
     order_arrears, payment_amount, cost_amount, dep_name, province_name, legal_affairs, 
-    dun_start_time
+    dun_start_time, legal_affairs_type, operation_time
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select 
@@ -45,14 +47,16 @@
       create_time, buyer_name, order_receivables, 
       order_arrears, payment_amount, cost_amount, 
       dep_name, province_name, legal_affairs, 
-      dun_start_time)
+      dun_start_time, legal_affairs_type, operation_time
+      )
     values (#{orderNo,jdbcType=VARCHAR}, #{salesmanId,jdbcType=VARCHAR}, #{financeId,jdbcType=VARCHAR}, 
       #{salesmanName,jdbcType=VARCHAR}, #{financeName,jdbcType=VARCHAR}, #{finalReceivables,jdbcType=DECIMAL}, 
       #{finalReceivablesTime,jdbcType=TIMESTAMP}, #{invoiceAmount,jdbcType=DECIMAL}, 
       #{createTime,jdbcType=TIMESTAMP}, #{buyerName,jdbcType=VARCHAR}, #{orderReceivables,jdbcType=DECIMAL}, 
       #{orderArrears,jdbcType=DECIMAL}, #{paymentAmount,jdbcType=DECIMAL}, #{costAmount,jdbcType=DECIMAL}, 
       #{depName,jdbcType=VARCHAR}, #{provinceName,jdbcType=VARCHAR}, #{legalAffairs,jdbcType=INTEGER}, 
-      #{dunStartTime,jdbcType=TIMESTAMP})
+      #{dunStartTime,jdbcType=TIMESTAMP}, #{legalAffairsType,jdbcType=INTEGER}, #{operationTime,jdbcType=DATE}
+      )
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.TOrderMid" useGeneratedKeys="true">
     insert into t_order_mid
@@ -111,6 +115,12 @@
       <if test="dunStartTime != null">
         dun_start_time,
       </if>
+      <if test="legalAffairsType != null">
+        legal_affairs_type,
+      </if>
+      <if test="operationTime != null">
+        operation_time,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="orderNo != null">
@@ -167,6 +177,12 @@
       <if test="dunStartTime != null">
         #{dunStartTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="legalAffairsType != null">
+        #{legalAffairsType,jdbcType=INTEGER},
+      </if>
+      <if test="operationTime != null">
+        #{operationTime,jdbcType=DATE},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderMid">
@@ -226,6 +242,12 @@
       <if test="dunStartTime != null">
         dun_start_time = #{dunStartTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="legalAffairsType != null">
+        legal_affairs_type = #{legalAffairsType,jdbcType=INTEGER},
+      </if>
+      <if test="operationTime != null">
+        operation_time = #{operationTime,jdbcType=DATE},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -248,7 +270,9 @@
       dep_name = #{depName,jdbcType=VARCHAR},
       province_name = #{provinceName,jdbcType=VARCHAR},
       legal_affairs = #{legalAffairs,jdbcType=INTEGER},
-      dun_start_time = #{dunStartTime,jdbcType=TIMESTAMP}
+      dun_start_time = #{dunStartTime,jdbcType=TIMESTAMP},
+      legal_affairs_type = #{legalAffairsType,jdbcType=INTEGER},
+      operation_time = #{operationTime,jdbcType=DATE}
     where id = #{id,jdbcType=INTEGER}
   </update>
   <select id="selectByOrderNo" resultMap="BaseResultMap">
@@ -309,7 +333,6 @@
   <update id="updateByOrderNo">
     update t_order_mid
     <set>
-
       <if test="salesmanId != null">
         salesman_id = #{salesmanId,jdbcType=VARCHAR},
       </if>
@@ -358,6 +381,15 @@
       <if test="legalAffairs != null">
         legal_affairs = #{legalAffairs,jdbcType=INTEGER},
       </if>
+      <if test="dunStartTime != null">
+        dun_start_time = #{dunStartTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="legalAffairsType != null">
+        legal_affairs_type = #{legalAffairsType,jdbcType=INTEGER},
+      </if>
+      <if test="operationTime != null">
+        operation_time = #{operationTime,jdbcType=DATE},
+      </if>
     </set>
     where order_no = #{orderNo,jdbcType=VARCHAR}
   </update>
@@ -367,17 +399,28 @@
     a.total_amount totalAmount ,a.settlement_amount  settlementAmount ,b.order_receivables orderReceivables,b.legal_affairs legalAffairs,
     b.order_arrears orderArrears,b.dun_start_time dunStartTime,date_format(b.dun_start_time,'%Y-%m-%d %H:%i:%S')dunStartTimes
     <if test="type==1 or type==2 or type==3">
-      ,c.operation_time operationTime,c.`type`
+      ,b.operation_time operationTime,b.`type`
     </if>
     from t_order_new a left join t_order_mid b on a.order_no =b.order_no
+    <if test="shiro == 2">
+      left join admin c on a.salesman_id =c.id
+    </if>
     <if test="type==1 or type==2 or type==3">
-      left join t_order_legal_affairs c on c.order_no =b.order_no
       where b.legal_affairs =1
     </if>
     <if test="type==0">
       where b.order_receivables >0
     </if>
-      <if test="userName != null">
+    <if test="shiro==1">
+      and a.order_type in
+      <foreach close=")" collection="deps" item="dep" open="(" separator=",">
+        #{dep}
+      </foreach>
+    </if>
+      <if test="shiro ==2">
+        and  c.superior_id = #{sid}
+      </if>
+    <if test="userName != null">
       and b.buyer_name like concat('%',#{userName},'%')
       </if>
       <if test="legalAffairs != null">
@@ -399,10 +442,10 @@
     </if>
     <if test="type==1 or type==2 or type==3">
       <if test="startTime != null and endTime != null">
-        and c.operation_time between #{startTime} and #{endTime}
+        and b.operation_time between #{startTime} and #{endTime}
       </if>
     </if>
-    order by b.dun_start_time desc
+    order by b.dun_start_time
     <if test="page_sql != null">
         ${page_sql}
     </if>
@@ -410,13 +453,24 @@
   <select id="legalAffairsOrderCount" resultType="integer">
     select count(*)
     from t_order_new a left join t_order_mid b on a.order_no =b.order_no
+    <if test="shiro == 2">
+      left join admin c on a.salesman_id =c.id
+    </if>
     <if test="type==1 or type==2 or type==3">
-      left join t_order_legal_affairs c on c.order_no =b.order_no
       where b.legal_affairs =1
     </if>
     <if test="type==0">
       where b.order_receivables >0
     </if>
+    <if test="shiro==1">
+      and a.order_type in
+      <foreach close=")" collection="deps" item="dep" open="(" separator=",">
+        #{dep}
+      </foreach>
+    </if>
+    <if test="shiro ==2">
+      and  c.superior_id = #{sid}
+    </if>
     <if test="userName != null">
       and b.buyer_name like concat('%',#{userName},'%')
     </if>
@@ -439,7 +493,7 @@
     </if>
     <if test="type==1 or type==2 or type==3">
       <if test="startTime != null and endTime != null">
-        and c.operation_time between #{startTime} and #{endTime}
+        and b.operation_time between #{startTime} and #{endTime}
       </if>
     </if>
   </select>

+ 172 - 0
src/main/java/com/goafanti/common/model/TOrderLegalAffairs.java

@@ -0,0 +1,172 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * t_order_legal_affairs
+ * @author 
+ */
+public class TOrderLegalAffairs implements Serializable {
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 订单编号
+     */
+    private String orderNo;
+
+    /**
+     * 法务状态 0法务催收中 1延期法务 2已完成法务
+     */
+    private Integer type;
+
+    /**
+     * 0否 1已回款 2已诉讼 3已坏账处理
+     */
+    private Integer status;
+
+    /**
+     * 催款备注
+     */
+    private String remarks;
+
+    /**
+     * 附件地址
+     */
+    private String attachmentUrl;
+
+    /**
+     * 催款日期
+     */
+    private Date operationTime;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public String getAttachmentUrl() {
+        return attachmentUrl;
+    }
+
+    public void setAttachmentUrl(String attachmentUrl) {
+        this.attachmentUrl = attachmentUrl;
+    }
+
+    public Date getOperationTime() {
+        return operationTime;
+    }
+
+    public void setOperationTime(Date operationTime) {
+        this.operationTime = operationTime;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        TOrderLegalAffairs other = (TOrderLegalAffairs) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getOrderNo() == null ? other.getOrderNo() == null : this.getOrderNo().equals(other.getOrderNo()))
+            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()))
+            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
+            && (this.getRemarks() == null ? other.getRemarks() == null : this.getRemarks().equals(other.getRemarks()))
+            && (this.getAttachmentUrl() == null ? other.getAttachmentUrl() == null : this.getAttachmentUrl().equals(other.getAttachmentUrl()))
+            && (this.getOperationTime() == null ? other.getOperationTime() == null : this.getOperationTime().equals(other.getOperationTime()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getOrderNo() == null) ? 0 : getOrderNo().hashCode());
+        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
+        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
+        result = prime * result + ((getRemarks() == null) ? 0 : getRemarks().hashCode());
+        result = prime * result + ((getAttachmentUrl() == null) ? 0 : getAttachmentUrl().hashCode());
+        result = prime * result + ((getOperationTime() == null) ? 0 : getOperationTime().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        return result;
+    }
+
+    @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(", orderNo=").append(orderNo);
+        sb.append(", type=").append(type);
+        sb.append(", status=").append(status);
+        sb.append(", remarks=").append(remarks);
+        sb.append(", attachmentUrl=").append(attachmentUrl);
+        sb.append(", operationTime=").append(operationTime);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 33 - 1
src/main/java/com/goafanti/common/model/TOrderMid.java

@@ -104,6 +104,16 @@ public class TOrderMid implements Serializable {
      */
     private Date dunStartTime;
 
+    /**
+     * 法务状态 0法务催收中 1延期法务 2已完成法务
+     */
+    private Integer legalAffairsType;
+
+    /**
+     * 催款日期
+     */
+    private Date operationTime;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -258,6 +268,22 @@ public class TOrderMid implements Serializable {
         this.dunStartTime = dunStartTime;
     }
 
+    public Integer getLegalAffairsType() {
+        return legalAffairsType;
+    }
+
+    public void setLegalAffairsType(Integer legalAffairsType) {
+        this.legalAffairsType = legalAffairsType;
+    }
+
+    public Date getOperationTime() {
+        return operationTime;
+    }
+
+    public void setOperationTime(Date operationTime) {
+        this.operationTime = operationTime;
+    }
+
     @Override
     public boolean equals(Object that) {
         if (this == that) {
@@ -288,7 +314,9 @@ public class TOrderMid implements Serializable {
             && (this.getDepName() == null ? other.getDepName() == null : this.getDepName().equals(other.getDepName()))
             && (this.getProvinceName() == null ? other.getProvinceName() == null : this.getProvinceName().equals(other.getProvinceName()))
             && (this.getLegalAffairs() == null ? other.getLegalAffairs() == null : this.getLegalAffairs().equals(other.getLegalAffairs()))
-            && (this.getDunStartTime() == null ? other.getDunStartTime() == null : this.getDunStartTime().equals(other.getDunStartTime()));
+            && (this.getDunStartTime() == null ? other.getDunStartTime() == null : this.getDunStartTime().equals(other.getDunStartTime()))
+            && (this.getLegalAffairsType() == null ? other.getLegalAffairsType() == null : this.getLegalAffairsType().equals(other.getLegalAffairsType()))
+            && (this.getOperationTime() == null ? other.getOperationTime() == null : this.getOperationTime().equals(other.getOperationTime()));
     }
 
     @Override
@@ -314,6 +342,8 @@ public class TOrderMid implements Serializable {
         result = prime * result + ((getProvinceName() == null) ? 0 : getProvinceName().hashCode());
         result = prime * result + ((getLegalAffairs() == null) ? 0 : getLegalAffairs().hashCode());
         result = prime * result + ((getDunStartTime() == null) ? 0 : getDunStartTime().hashCode());
+        result = prime * result + ((getLegalAffairsType() == null) ? 0 : getLegalAffairsType().hashCode());
+        result = prime * result + ((getOperationTime() == null) ? 0 : getOperationTime().hashCode());
         return result;
     }
 
@@ -342,6 +372,8 @@ public class TOrderMid implements Serializable {
         sb.append(", provinceName=").append(provinceName);
         sb.append(", legalAffairs=").append(legalAffairs);
         sb.append(", dunStartTime=").append(dunStartTime);
+        sb.append(", legalAffairsType=").append(legalAffairsType);
+        sb.append(", operationTime=").append(operationTime);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 93 - 0
src/main/java/com/goafanti/order/bo/InputOrderLegalAffairs.java

@@ -0,0 +1,93 @@
+package com.goafanti.order.bo;
+
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.model.TOrderLegalAffairs;
+
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+
+public class InputOrderLegalAffairs {
+
+    /**
+     * 订单编号
+     */
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR +"}")
+    private String orderNo;
+
+    /**
+     * 法务状态 0法务催收中 1延期法务 2已完成法务
+     */
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR +"}")
+    private Integer type;
+
+    /**
+     * 0否 1已回款 2已诉讼 3已坏账处理
+     */
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR +"}")
+    private Integer status;
+
+    /**
+     * 催款备注
+     */
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR +"}")
+    private String remarks;
+
+    /**
+     * 附件地址
+     */
+    private String attachmentUrl;
+
+    /**
+     * 催款日期
+     */
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR +"}")
+    private String date;
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public String getAttachmentUrl() {
+        return attachmentUrl;
+    }
+
+    public void setAttachmentUrl(String attachmentUrl) {
+        this.attachmentUrl = attachmentUrl;
+    }
+}

+ 1 - 1
src/main/java/com/goafanti/order/bo/InputOrderListBo.java

@@ -10,7 +10,7 @@ public class InputOrderListBo {
     private String startTime;
     private String endTime;
     /**
-     * 0 营销员 1法务催收 2法务延期 3已完成法务
+     * 0 订单催收 1法务催收 2法务延期 3已完成法务
      */
     private Integer type;
     private Integer pageSize;

+ 31 - 0
src/main/java/com/goafanti/order/bo/OutOrderLegalAffairsBo.java

@@ -0,0 +1,31 @@
+package com.goafanti.order.bo;
+
+import com.goafanti.common.utils.excel.Excel;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class OutOrderLegalAffairsBo extends OutOrderLegalAffairsListBo {
+
+    @Excel(name = "法务时间")
+    private Date operationTime;
+    @Excel(name = "法务类型",readConverterExp = "0=法务催收中,1=延期法务,2=已完成法务")
+    private Integer type;
+
+    public Date getOperationTime() {
+        return operationTime;
+    }
+
+    public void setOperationTime(Date operationTime) {
+        this.operationTime = operationTime;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+}

+ 19 - 2
src/main/java/com/goafanti/order/bo/OutOrderLegalAffairsListBo.java

@@ -28,11 +28,28 @@ public class OutOrderLegalAffairsListBo {
     private Date dunStartTime;
     @Excel(name = "催收启动日期")
     private String dunStartTimes;
-    @Excel(name = "移交法务",readConverterExp = "0=未移交,1=已移交")
+
     private Integer legalAffairs;
-    @Excel(name = "自动移交法务(天)")
     private Integer daysRemaining;
+    private Date operationTime;
+
+    private Integer type;
 
+    public Date getOperationTime() {
+        return operationTime;
+    }
+
+    public void setOperationTime(Date operationTime) {
+        this.operationTime = operationTime;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
 
     public Integer getLegalAffairs() {
         return legalAffairs;

+ 39 - 0
src/main/java/com/goafanti/order/bo/OutOrderLegalAffairsSalesmanBo.java

@@ -0,0 +1,39 @@
+package com.goafanti.order.bo;
+
+import com.goafanti.common.utils.excel.Excel;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class OutOrderLegalAffairsSalesmanBo  extends OutOrderLegalAffairsListBo {
+
+    @Excel(name = "移交法务",readConverterExp = "0=未移交,1=已移交")
+    private Integer legalAffairs;
+    @Excel(name = "自动移交法务(天)")
+    private Integer daysRemaining;
+
+
+    public Integer getLegalAffairs() {
+        return legalAffairs;
+    }
+
+    public void setLegalAffairs(Integer legalAffairs) {
+        this.legalAffairs = legalAffairs;
+    }
+
+    public Integer getDaysRemaining() {
+        return daysRemaining;
+    }
+
+    public void setDaysRemaining(Integer daysRemaining) {
+        this.daysRemaining = daysRemaining;
+    }
+
+    @Override
+    public String toString() {
+        return "OutOrderLegalAffairsSalesmanBo{" +
+                "legalAffairs=" + legalAffairs +
+                ", daysRemaining=" + daysRemaining +
+                '}';
+    }
+}

+ 52 - 6
src/main/java/com/goafanti/order/controller/LegalAffairsApiController.java

@@ -3,12 +3,13 @@ package com.goafanti.order.controller;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.enums.ActivityFields;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.common.utils.excel.NewExcelUtil;
-import com.goafanti.order.bo.InputDunOrder;
-import com.goafanti.order.bo.InputOrderListBo;
-import com.goafanti.order.bo.OutOrderLegalAffairsListBo;
+import com.goafanti.order.bo.*;
+import com.goafanti.order.enums.OrderLegalAffairsState;
 import com.goafanti.order.service.LegalAffairsService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.BindingResult;
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.List;
 
 @RestController
@@ -69,8 +71,29 @@ public class LegalAffairsApiController extends CertifyApiController {
      */
     @RequestMapping(value = "/orderList/Exprot",method = RequestMethod.GET)
     public Result orderListExprot(InputOrderListBo in){
-        List<OutOrderLegalAffairsListBo> list = legalAffairsService.getLegalAffairsOrder(in);
-        NewExcelUtil newExcelUtil=new NewExcelUtil<>(OutOrderLegalAffairsListBo.class);
+        List<OutOrderLegalAffairsListBo> use = legalAffairsService.getLegalAffairsOrder(in);
+        NewExcelUtil newExcelUtil;
+        List<Object> list=new ArrayList<>();
+        String tile= new String();
+        if (in.getType()==0){
+            for (OutOrderLegalAffairsListBo out : use) {
+                OutOrderLegalAffairsSalesmanBo bo = new OutOrderLegalAffairsSalesmanBo();
+                BeanUtils.copyProperties(out,bo);
+                list.add(bo);
+            }
+            newExcelUtil=new NewExcelUtil<>(OutOrderLegalAffairsSalesmanBo.class);
+            tile="订单催款列表";
+        }else {
+            for (OutOrderLegalAffairsListBo out : use) {
+                OutOrderLegalAffairsBo bo = new OutOrderLegalAffairsBo();
+                BeanUtils.copyProperties(out,bo);
+                list.add(bo);
+            }
+            newExcelUtil=new NewExcelUtil<>(OutOrderLegalAffairsBo.class);
+            if(in.getType()==1){tile="法务催款列表";}
+            else if(in.getType()==2){tile="延期法务列表";}
+            else if(in.getType()==3){tile="已完成法务列表";}
+        }
         StringBuffer sb=new StringBuffer("搜索条件=》");
         if (in.getUserName()!=null)sb=sb.append("客户名称:").append(in.getUserName()).append(",");
         if (in.getLegalAffairs()!=null)sb=sb.append("转交法务:").append(in.getLegalAffairs()==0?"未转交":"已转交").append(",");
@@ -80,7 +103,7 @@ public class LegalAffairsApiController extends CertifyApiController {
             sb=sb.append("催款启动时间:").append(in.getStartTime()).append("~").append(in.getEndTime()).append(",");
 
         }
-        return newExcelUtil.exportExcel(list,"订单催款列表",uploadPath,sb.substring(0,sb.length()-1));
+        return newExcelUtil.exportExcel(list,tile,uploadPath,sb.substring(0,sb.length()-1));
     }
     /**
      * 订单催款日志列表(法务)
@@ -113,4 +136,27 @@ public class LegalAffairsApiController extends CertifyApiController {
         return res.data(legalAffairsService.addDunOrder(in));
     }
 
+
+    /**
+     * 新增法务记录
+     * @param in
+     * @return
+     */
+    @RequestMapping(value = "/addLagalAffairsLog",method = RequestMethod.POST)
+    public Result addLagalAffairsLog(@Valid InputOrderLegalAffairs in,BindingResult bindingResult){
+        Result res =new Result();
+        if (bindingResult.hasErrors()) {
+            res.getError().add(buildErrorByMsg(bindingResult.getFieldError().getDefaultMessage(),
+                    OrderLegalAffairsState.getFieldDesc(bindingResult.getFieldError().getField())));
+            return res;
+        }
+
+        res.data(legalAffairsService.addLagalAffairsLog(in));
+        return res;
+
+    }
+
+
+
+
 }

+ 56 - 0
src/main/java/com/goafanti/order/enums/OrderLegalAffairsState.java

@@ -0,0 +1,56 @@
+package com.goafanti.order.enums;
+
+import com.goafanti.common.constant.ErrorConstants;
+
+import javax.validation.constraints.NotNull;
+import java.util.HashMap;
+import java.util.Map;
+
+public enum OrderLegalAffairsState {
+
+	ORDERNO("orderNo","法务分类"),
+	TYPE("type","法务分类"),
+	STATUS("status","法务状态"),
+	REMARKS("remarks","备注"),
+	DATE("date","时间"),
+	OTHER("", "未知参数");
+
+	private OrderLegalAffairsState(String code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<String, OrderLegalAffairsState> status = new HashMap<String, OrderLegalAffairsState>();
+
+	static {
+		for (OrderLegalAffairsState value : OrderLegalAffairsState.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+
+	public static OrderLegalAffairsState getField(String code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return OTHER;
+	}
+
+	public static String getFieldDesc(String code) {
+		return getField(code).getDesc();
+	}
+
+	public static boolean containsType(String code) {
+		return status.containsKey(code);
+	}
+
+	private String	code;
+	private String	desc;
+
+	public String getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+}

+ 3 - 4
src/main/java/com/goafanti/order/service/LegalAffairsService.java

@@ -1,9 +1,6 @@
 package com.goafanti.order.service;
 
-import com.goafanti.order.bo.InputDunOrder;
-import com.goafanti.order.bo.InputOrderListBo;
-import com.goafanti.order.bo.OutOrderLegalAffairsListBo;
-import com.goafanti.order.bo.TDunLogListBo;
+import com.goafanti.order.bo.*;
 
 import java.util.List;
 
@@ -23,4 +20,6 @@ public interface LegalAffairsService {
     List<TDunLogListBo> dunOrderList(String orderNo);
 
     int addDunOrder(InputDunOrder in);
+
+    int addLagalAffairsLog(InputOrderLegalAffairs in);
 }

+ 43 - 6
src/main/java/com/goafanti/order/service/impl/LegalAffairsServiceImpl.java

@@ -1,10 +1,9 @@
 package com.goafanti.order.service.impl;
 
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.TDunLogMapper;
-import com.goafanti.common.dao.TOrderMidMapper;
-import com.goafanti.common.dao.TOrderTaskMapper;
+import com.goafanti.common.dao.*;
 import com.goafanti.common.model.TDunLog;
+import com.goafanti.common.model.TOrderLegalAffairs;
 import com.goafanti.common.model.TOrderMid;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
@@ -29,14 +28,21 @@ public class LegalAffairsServiceImpl extends BaseMybatisDao<TOrderMidMapper> imp
     private TOrderTaskMapper    tOrderTaskMapper;
     @Autowired
     private TDunLogMapper tDunLogMapper;
+    @Autowired
+    private TOrderLegalAffairsMapper tOrderLegalAffairsMapper;
+    @Autowired
+    private AdminMapper adminMapper;
+
 
 
 
     @Override
-    public    int pushTransferLagalAffairs(String orderNo){
+    public  int pushTransferLagalAffairs(String orderNo){
         TOrderMid tm = new TOrderMid();
         tm.setOrderNo(orderNo);
         tm.setLegalAffairs(1);
+        tm.setLegalAffairsType(0);
+        tm.setOperationTime(new Date());
         return tOrderMidMapper.updateByOrderNo(tm);
     }
 
@@ -57,14 +63,28 @@ public class LegalAffairsServiceImpl extends BaseMybatisDao<TOrderMidMapper> imp
         if(in.getLegalAffairs()!=null) map.put("legalAffairs", in.getLegalAffairs());
         if(in.getAid()!=null) map.put("aid", in.getAid());
         if(in.getType()==0){
-            map.put("aid", TokenManager.getAdminId());
+            if (TokenManager.hasRole(AFTConstants.FINANCE)){
+                map.put("shiro",1);
+                List<String> deps=adminMapper.getFinanceDep(TokenManager.getAdminId());
+                map.put("deps",deps);
+            }else if(TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)){
+                map.put("shiro",2);
+                map.put("sid", TokenManager.getAdminId());
+            }else if(TokenManager.hasRole(AFTConstants.SUPERADMIN)||TokenManager.hasRole(AFTConstants.CED)||
+                    TokenManager.hasRole(AFTConstants.CED_ASSISTANT)||TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)||
+                    TokenManager.hasRole(AFTConstants.VICE_CEO)){
+                map.put("shiro",3);
+            }else {
+                map.put("shiro",0);
+                map.put("aid", TokenManager.getAdminId());
+            }
             map.put("type", in.getType());
         }else{
             if(in.getAid()!=null) map.put("aid", in.getAid());
             map.put("type", in.getType());
         }
         if(in.getDepId()!=null) map.put("depId", in.getDepId());
-        if(in.getUserName()!=null) map.put("user", in.getUserName());
+        if(in.getUserName()!=null) map.put("userName", in.getUserName());
         if(in.getStartTime()!=null)map.put("startTime", in.getStartTime());
         if(in.getEndTime()!=null)map.put("endTime", in.getEndTime()+" 23:59:59");
     }
@@ -125,4 +145,21 @@ public class LegalAffairsServiceImpl extends BaseMybatisDao<TOrderMidMapper> imp
         }
         return tDunLogMapper.insertSelective(log);
     }
+
+    @Override
+    public int addLagalAffairsLog(InputOrderLegalAffairs in) {
+        TOrderLegalAffairs la = new TOrderLegalAffairs();
+        la.setOrderNo(in.getOrderNo());
+        la.setRemarks(in.getRemarks());
+        la.setType(in.getType());
+        la.setStatus(in.getStatus());
+        la.setAttachmentUrl(in.getAttachmentUrl());
+        la.setOperationTime(DateUtils.StringToDate(in.getDate(),AFTConstants.YYYYMMDD));
+        TOrderMid tm = new TOrderMid();
+        tm.setOrderNo(in.getOrderNo());
+        tm.setLegalAffairsType(in.getType());
+        tm.setOperationTime(la.getOperationTime());
+        tOrderMidMapper.updateByOrderNo(tm);
+        return tOrderLegalAffairsMapper.insertSelective(la);
+    }
 }