Browse Source

财务专员校对营销员的单量
财务专员发放营销员的奖金
退单通知邮件

limin 7 years ago
parent
commit
c35c91618f

+ 81 - 0
src/main/java/com/goafanti/common/bo/EmailBo.java

@@ -0,0 +1,81 @@
+package com.goafanti.common.bo;
+
+public class EmailBo {
+	
+	//收件地址
+	//收件人
+	//部门
+	//发起人
+	//通知类型
+	//内容
+	//结束语
+	private String subject;
+	private String address;
+	private String addressee;
+	private String deptname;
+	private String sender;
+	private String content;
+	private String end = "详情请登录科德业务管理系统查看,谢谢!";
+	
+	public EmailBo() {
+	}
+	
+	public EmailBo(String subject, String address, String addressee,
+			String deptname, String sender,
+			String content) {
+		this.subject = subject;
+		this.address = address;
+		this.addressee = addressee;
+		this.deptname = deptname;
+		this.sender = sender;
+		this.content = content;
+	}
+
+
+
+
+	public String getSubject() {
+		return subject;
+	}
+
+	public void setSubject(String subject) {
+		this.subject = subject;
+	}
+
+	public String getAddress() {
+		return address;
+	}
+	public void setAddress(String address) {
+		this.address = address;
+	}
+	public String getAddressee() {
+		return addressee;
+	}
+	public void setAddressee(String addressee) {
+		this.addressee = addressee;
+	}
+	public String getDeptname() {
+		return deptname;
+	}
+	public void setDeptname(String deptname) {
+		this.deptname = deptname;
+	}
+	public String getSender() {
+		return sender;
+	}
+	public void setSender(String sender) {
+		this.sender = sender;
+	}
+	public String getContent() {
+		return content;
+	}
+	public void setContent(String content) {
+		this.content = content;
+	}
+	
+	public String format(String name){
+        return "<div>亲爱的" + name + ", 您收到一条由[" + this.deptname +"] 的 [" + this.sender + "] 发起的 [" + this.subject + "] 通知:</div>"
+        		+ "<div>" + this.content + "</div>"
+        		+ "<div>" + this.end + "</div>";
+    }
+}

+ 77 - 0
src/main/java/com/goafanti/common/dao/TOrderBonusMapper.java

@@ -0,0 +1,77 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.TOrderBonus;
+import com.goafanti.common.model.TOrderBonusExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface TOrderBonusMapper {
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	int countByExample(TOrderBonusExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	int deleteByExample(TOrderBonusExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	int deleteByPrimaryKey(String id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	int insert(TOrderBonus record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	int insertSelective(TOrderBonus record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	List<TOrderBonus> selectByExample(TOrderBonusExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	TOrderBonus selectByPrimaryKey(String id);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	int updateByExampleSelective(@Param("record") TOrderBonus record,
+			@Param("example") TOrderBonusExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	int updateByExample(@Param("record") TOrderBonus record,
+			@Param("example") TOrderBonusExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	int updateByPrimaryKeySelective(TOrderBonus record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	int updateByPrimaryKey(TOrderBonus record);
+}

+ 86 - 108
src/main/java/com/goafanti/common/dao/TOrderNewMapper.java

@@ -9,120 +9,98 @@ import org.apache.ibatis.annotations.Param;
 
 public interface TOrderNewMapper {
     /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    long countByExample(TOrderNewExample example);
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	int countByExample(TOrderNewExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	int deleteByExample(TOrderNewExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	int deleteByPrimaryKey(String orderNo);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	int insert(TOrderNew record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	int insertSelective(TOrderNew record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	List<TOrderNew> selectByExampleWithBLOBs(TOrderNewExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	List<TOrderNew> selectByExample(TOrderNewExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	TOrderNew selectByPrimaryKey(String orderNo);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	int updateByExampleSelective(@Param("record") TOrderNew record,
+			@Param("example") TOrderNewExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	int updateByExampleWithBLOBs(@Param("record") TOrderNew record,
+			@Param("example") TOrderNewExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	int updateByExample(@Param("record") TOrderNew record,
+			@Param("example") TOrderNewExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	int updateByPrimaryKeySelective(TOrderNew record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	int updateByPrimaryKeyWithBLOBs(TOrderNew record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_new
+	 * @mbggenerated  Fri Nov 23 15:27:45 CST 2018
+	 */
+	int updateByPrimaryKey(TOrderNew record);
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    int deleteByExample(TOrderNewExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    int deleteByPrimaryKey(String orderNo);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    int insert(TOrderNew record);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    int insertSelective(TOrderNew record);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    List<TOrderNew> selectByExampleWithBLOBs(TOrderNewExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    List<TOrderNew> selectByExample(TOrderNewExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    TOrderNew selectByPrimaryKey(String orderNo);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    int updateByExampleSelective(@Param("record") TOrderNew record, @Param("example") TOrderNewExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    int updateByExampleWithBLOBs(@Param("record") TOrderNew record, @Param("example") TOrderNewExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    int updateByExample(@Param("record") TOrderNew record, @Param("example") TOrderNewExample example);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    int updateByPrimaryKeySelective(TOrderNew record);
 
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    int updateByPrimaryKeyWithBLOBs(TOrderNew record);
-
-    /**
-     * This method was generated by MyBatis Generator.
-     * This method corresponds to the database table t_order_new
-     *
-     * @mbg.generated Mon Nov 19 10:12:37 CST 2018
-     */
-    int updateByPrimaryKey(TOrderNew record);
 
     TOrderNewBo getOrderNewDetail(String orderNo); 
     int getCountByIdAndStatus(TOrderNew orderNew);
     
     TOrderNewBo getSaleIdByOno(String ono);
+    TOrderNewBo agreeEmailData(Integer fid);
 
 }

+ 333 - 0
src/main/java/com/goafanti/common/mapper/TOrderBonusMapper.xml

@@ -0,0 +1,333 @@
+<?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.TOrderBonusMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderBonus">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    <id column="id" jdbcType="VARCHAR" property="id" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
+    <result column="bonus_subject" jdbcType="INTEGER" property="bonusSubject" />
+    <result column="grant_status" jdbcType="INTEGER" property="grantStatus" />
+    <result column="grant_target" jdbcType="VARCHAR" property="grantTarget" />
+    <result column="grant_by" jdbcType="VARCHAR" property="grantBy" />
+    <result column="grant_time" jdbcType="DATE" property="grantTime" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    id, create_time, order_no, bonus_subject, grant_status, grant_target, grant_by, grant_time
+  </sql>
+  <select id="selectByExample" parameterType="com.goafanti.common.model.TOrderBonusExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from t_order_bonus
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from t_order_bonus
+    where id = #{id,jdbcType=VARCHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    delete from t_order_bonus
+    where id = #{id,jdbcType=VARCHAR}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.goafanti.common.model.TOrderBonusExample">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    delete from t_order_bonus
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.TOrderBonus">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    insert into t_order_bonus (id, create_time, order_no, 
+      bonus_subject, grant_status, grant_target, 
+      grant_by, grant_time)
+    values (#{id,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{orderNo,jdbcType=VARCHAR}, 
+      #{bonusSubject,jdbcType=INTEGER}, #{grantStatus,jdbcType=INTEGER}, #{grantTarget,jdbcType=VARCHAR}, 
+      #{grantBy,jdbcType=VARCHAR}, #{grantTime,jdbcType=DATE})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderBonus">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    insert into t_order_bonus
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="orderNo != null">
+        order_no,
+      </if>
+      <if test="bonusSubject != null">
+        bonus_subject,
+      </if>
+      <if test="grantStatus != null">
+        grant_status,
+      </if>
+      <if test="grantTarget != null">
+        grant_target,
+      </if>
+      <if test="grantBy != null">
+        grant_by,
+      </if>
+      <if test="grantTime != null">
+        grant_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="orderNo != null">
+        #{orderNo,jdbcType=VARCHAR},
+      </if>
+      <if test="bonusSubject != null">
+        #{bonusSubject,jdbcType=INTEGER},
+      </if>
+      <if test="grantStatus != null">
+        #{grantStatus,jdbcType=INTEGER},
+      </if>
+      <if test="grantTarget != null">
+        #{grantTarget,jdbcType=VARCHAR},
+      </if>
+      <if test="grantBy != null">
+        #{grantBy,jdbcType=VARCHAR},
+      </if>
+      <if test="grantTime != null">
+        #{grantTime,jdbcType=DATE},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.goafanti.common.model.TOrderBonusExample" resultType="java.lang.Integer">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    select count(*) from t_order_bonus
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    update t_order_bonus
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=VARCHAR},
+      </if>
+      <if test="record.createTime != null">
+        create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.orderNo != null">
+        order_no = #{record.orderNo,jdbcType=VARCHAR},
+      </if>
+      <if test="record.bonusSubject != null">
+        bonus_subject = #{record.bonusSubject,jdbcType=INTEGER},
+      </if>
+      <if test="record.grantStatus != null">
+        grant_status = #{record.grantStatus,jdbcType=INTEGER},
+      </if>
+      <if test="record.grantTarget != null">
+        grant_target = #{record.grantTarget,jdbcType=VARCHAR},
+      </if>
+      <if test="record.grantBy != null">
+        grant_by = #{record.grantBy,jdbcType=VARCHAR},
+      </if>
+      <if test="record.grantTime != null">
+        grant_time = #{record.grantTime,jdbcType=DATE},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    update t_order_bonus
+    set id = #{record.id,jdbcType=VARCHAR},
+      create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      order_no = #{record.orderNo,jdbcType=VARCHAR},
+      bonus_subject = #{record.bonusSubject,jdbcType=INTEGER},
+      grant_status = #{record.grantStatus,jdbcType=INTEGER},
+      grant_target = #{record.grantTarget,jdbcType=VARCHAR},
+      grant_by = #{record.grantBy,jdbcType=VARCHAR},
+      grant_time = #{record.grantTime,jdbcType=DATE}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderBonus">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    update t_order_bonus
+    <set>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="orderNo != null">
+        order_no = #{orderNo,jdbcType=VARCHAR},
+      </if>
+      <if test="bonusSubject != null">
+        bonus_subject = #{bonusSubject,jdbcType=INTEGER},
+      </if>
+      <if test="grantStatus != null">
+        grant_status = #{grantStatus,jdbcType=INTEGER},
+      </if>
+      <if test="grantTarget != null">
+        grant_target = #{grantTarget,jdbcType=VARCHAR},
+      </if>
+      <if test="grantBy != null">
+        grant_by = #{grantBy,jdbcType=VARCHAR},
+      </if>
+      <if test="grantTime != null">
+        grant_time = #{grantTime,jdbcType=DATE},
+      </if>
+    </set>
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderBonus">
+    <!--
+      WARNING - @mbggenerated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Fri Nov 23 16:33:27 CST 2018.
+    -->
+    update t_order_bonus
+    set create_time = #{createTime,jdbcType=TIMESTAMP},
+      order_no = #{orderNo,jdbcType=VARCHAR},
+      bonus_subject = #{bonusSubject,jdbcType=INTEGER},
+      grant_status = #{grantStatus,jdbcType=INTEGER},
+      grant_target = #{grantTarget,jdbcType=VARCHAR},
+      grant_by = #{grantBy,jdbcType=VARCHAR},
+      grant_time = #{grantTime,jdbcType=DATE}
+    where id = #{id,jdbcType=VARCHAR}
+  </update>
+</mapper>

+ 100 - 65
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -3,9 +3,9 @@
 <mapper namespace="com.goafanti.common.dao.TOrderNewMapper">
   <resultMap id="BaseResultMap" type="com.goafanti.common.model.TOrderNew">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     <id column="order_no" jdbcType="VARCHAR" property="orderNo" />
     <result column="order_type" jdbcType="INTEGER" property="orderType" />
@@ -16,6 +16,7 @@
     <result column="first_amount" jdbcType="DECIMAL" property="firstAmount" />
     <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
     <result column="settlement_amount" jdbcType="DECIMAL" property="settlementAmount" />
+    <result column="refund_amount" jdbcType="DECIMAL" property="refundAmount" />
     <result column="order_status" jdbcType="INTEGER" property="orderStatus" />
     <result column="liquidation_status" jdbcType="INTEGER" property="liquidationStatus" />
     <result column="process_status" jdbcType="INTEGER" property="processStatus" />
@@ -39,17 +40,17 @@
   </resultMap>
   <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.goafanti.common.model.TOrderNew">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     <result column="contract_picture_url" jdbcType="LONGVARCHAR" property="contractPictureUrl" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     <where>
       <foreach collection="oredCriteria" item="criteria" separator="or">
@@ -81,9 +82,9 @@
   </sql>
   <sql id="Update_By_Example_Where_Clause">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     <where>
       <foreach collection="example.oredCriteria" item="criteria" separator="or">
@@ -115,29 +116,29 @@
   </sql>
   <sql id="Base_Column_List">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     order_no, order_type, creater, create_time, update_time, buyer_id, first_amount, 
-    total_amount, settlement_amount, order_status, liquidation_status, process_status, 
-    project_status, approval, order_remarks, delete_sign, salesman_id, finance_id, technician_id, 
-    sign_time, settlement_time, contract_no, contract_type, contacts, contact_mobile, 
-    legal_person, legal_person_tel, proof_count, proof_aid
+    total_amount, settlement_amount, refund_amount, order_status, liquidation_status, 
+    process_status, project_status, approval, order_remarks, delete_sign, salesman_id, 
+    finance_id, technician_id, sign_time, settlement_time, contract_no, contract_type, 
+    contacts, contact_mobile, legal_person, legal_person_tel, proof_count, proof_aid
   </sql>
   <sql id="Blob_Column_List">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     contract_picture_url
   </sql>
   <select id="selectByExampleWithBLOBs" parameterType="com.goafanti.common.model.TOrderNewExample" resultMap="ResultMapWithBLOBs">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     select
     <if test="distinct">
@@ -156,9 +157,9 @@
   </select>
   <select id="selectByExample" parameterType="com.goafanti.common.model.TOrderNewExample" resultMap="BaseResultMap">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     select
     <if test="distinct">
@@ -175,9 +176,9 @@
   </select>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     select 
     <include refid="Base_Column_List" />
@@ -188,18 +189,18 @@
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     delete from t_order_new
     where order_no = #{orderNo,jdbcType=VARCHAR}
   </delete>
   <delete id="deleteByExample" parameterType="com.goafanti.common.model.TOrderNewExample">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     delete from t_order_new
     <if test="_parameter != null">
@@ -208,38 +209,38 @@
   </delete>
   <insert id="insert" parameterType="com.goafanti.common.model.TOrderNew">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     insert into t_order_new (order_no, order_type, creater, 
       create_time, update_time, buyer_id, 
       first_amount, total_amount, settlement_amount, 
-      order_status, liquidation_status, process_status, 
-      project_status, approval, order_remarks, 
-      delete_sign, salesman_id, finance_id, 
-      technician_id, sign_time, settlement_time, 
-      contract_no, contract_type, contacts, 
-      contact_mobile, legal_person, legal_person_tel, 
-      proof_count, proof_aid, contract_picture_url
-      )
+      refund_amount, order_status, liquidation_status, 
+      process_status, project_status, approval, 
+      order_remarks, delete_sign, salesman_id, 
+      finance_id, technician_id, sign_time, 
+      settlement_time, contract_no, contract_type, 
+      contacts, contact_mobile, legal_person, 
+      legal_person_tel, proof_count, proof_aid, 
+      contract_picture_url)
     values (#{orderNo,jdbcType=VARCHAR}, #{orderType,jdbcType=INTEGER}, #{creater,jdbcType=VARCHAR}, 
       #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{buyerId,jdbcType=VARCHAR}, 
       #{firstAmount,jdbcType=DECIMAL}, #{totalAmount,jdbcType=DECIMAL}, #{settlementAmount,jdbcType=DECIMAL}, 
-      #{orderStatus,jdbcType=INTEGER}, #{liquidationStatus,jdbcType=INTEGER}, #{processStatus,jdbcType=INTEGER}, 
-      #{projectStatus,jdbcType=INTEGER}, #{approval,jdbcType=INTEGER}, #{orderRemarks,jdbcType=VARCHAR}, 
-      #{deleteSign,jdbcType=INTEGER}, #{salesmanId,jdbcType=VARCHAR}, #{financeId,jdbcType=VARCHAR}, 
-      #{technicianId,jdbcType=VARCHAR}, #{signTime,jdbcType=DATE}, #{settlementTime,jdbcType=DATE}, 
-      #{contractNo,jdbcType=VARCHAR}, #{contractType,jdbcType=VARCHAR}, #{contacts,jdbcType=VARCHAR}, 
-      #{contactMobile,jdbcType=VARCHAR}, #{legalPerson,jdbcType=VARCHAR}, #{legalPersonTel,jdbcType=VARCHAR}, 
-      #{proofCount,jdbcType=REAL}, #{proofAid,jdbcType=VARCHAR}, #{contractPictureUrl,jdbcType=LONGVARCHAR}
-      )
+      #{refundAmount,jdbcType=DECIMAL}, #{orderStatus,jdbcType=INTEGER}, #{liquidationStatus,jdbcType=INTEGER}, 
+      #{processStatus,jdbcType=INTEGER}, #{projectStatus,jdbcType=INTEGER}, #{approval,jdbcType=INTEGER}, 
+      #{orderRemarks,jdbcType=VARCHAR}, #{deleteSign,jdbcType=INTEGER}, #{salesmanId,jdbcType=VARCHAR}, 
+      #{financeId,jdbcType=VARCHAR}, #{technicianId,jdbcType=VARCHAR}, #{signTime,jdbcType=DATE}, 
+      #{settlementTime,jdbcType=DATE}, #{contractNo,jdbcType=VARCHAR}, #{contractType,jdbcType=VARCHAR}, 
+      #{contacts,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR}, #{legalPerson,jdbcType=VARCHAR}, 
+      #{legalPersonTel,jdbcType=VARCHAR}, #{proofCount,jdbcType=REAL}, #{proofAid,jdbcType=VARCHAR}, 
+      #{contractPictureUrl,jdbcType=LONGVARCHAR})
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderNew">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     insert into t_order_new
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -270,6 +271,9 @@
       <if test="settlementAmount != null">
         settlement_amount,
       </if>
+      <if test="refundAmount != null">
+        refund_amount,
+      </if>
       <if test="orderStatus != null">
         order_status,
       </if>
@@ -362,6 +366,9 @@
       <if test="settlementAmount != null">
         #{settlementAmount,jdbcType=DECIMAL},
       </if>
+      <if test="refundAmount != null">
+        #{refundAmount,jdbcType=DECIMAL},
+      </if>
       <if test="orderStatus != null">
         #{orderStatus,jdbcType=INTEGER},
       </if>
@@ -427,11 +434,11 @@
       </if>
     </trim>
   </insert>
-  <select id="countByExample" parameterType="com.goafanti.common.model.TOrderNewExample" resultType="java.lang.Long">
+  <select id="countByExample" parameterType="com.goafanti.common.model.TOrderNewExample" resultType="java.lang.Integer">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     select count(*) from t_order_new
     <if test="_parameter != null">
@@ -440,9 +447,9 @@
   </select>
   <update id="updateByExampleSelective" parameterType="map">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     update t_order_new
     <set>
@@ -473,6 +480,9 @@
       <if test="record.settlementAmount != null">
         settlement_amount = #{record.settlementAmount,jdbcType=DECIMAL},
       </if>
+      <if test="record.refundAmount != null">
+        refund_amount = #{record.refundAmount,jdbcType=DECIMAL},
+      </if>
       <if test="record.orderStatus != null">
         order_status = #{record.orderStatus,jdbcType=INTEGER},
       </if>
@@ -543,9 +553,9 @@
   </update>
   <update id="updateByExampleWithBLOBs" parameterType="map">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     update t_order_new
     set order_no = #{record.orderNo,jdbcType=VARCHAR},
@@ -557,6 +567,7 @@
       first_amount = #{record.firstAmount,jdbcType=DECIMAL},
       total_amount = #{record.totalAmount,jdbcType=DECIMAL},
       settlement_amount = #{record.settlementAmount,jdbcType=DECIMAL},
+      refund_amount = #{record.refundAmount,jdbcType=DECIMAL},
       order_status = #{record.orderStatus,jdbcType=INTEGER},
       liquidation_status = #{record.liquidationStatus,jdbcType=INTEGER},
       process_status = #{record.processStatus,jdbcType=INTEGER},
@@ -584,9 +595,9 @@
   </update>
   <update id="updateByExample" parameterType="map">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     update t_order_new
     set order_no = #{record.orderNo,jdbcType=VARCHAR},
@@ -598,6 +609,7 @@
       first_amount = #{record.firstAmount,jdbcType=DECIMAL},
       total_amount = #{record.totalAmount,jdbcType=DECIMAL},
       settlement_amount = #{record.settlementAmount,jdbcType=DECIMAL},
+      refund_amount = #{record.refundAmount,jdbcType=DECIMAL},
       order_status = #{record.orderStatus,jdbcType=INTEGER},
       liquidation_status = #{record.liquidationStatus,jdbcType=INTEGER},
       process_status = #{record.processStatus,jdbcType=INTEGER},
@@ -624,9 +636,9 @@
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.TOrderNew">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     update t_order_new
     <set>
@@ -654,6 +666,9 @@
       <if test="settlementAmount != null">
         settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
       </if>
+      <if test="refundAmount != null">
+        refund_amount = #{refundAmount,jdbcType=DECIMAL},
+      </if>
       <if test="orderStatus != null">
         order_status = #{orderStatus,jdbcType=INTEGER},
       </if>
@@ -722,9 +737,9 @@
   </update>
   <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.goafanti.common.model.TOrderNew">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     update t_order_new
     set order_type = #{orderType,jdbcType=INTEGER},
@@ -735,6 +750,7 @@
       first_amount = #{firstAmount,jdbcType=DECIMAL},
       total_amount = #{totalAmount,jdbcType=DECIMAL},
       settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
+      refund_amount = #{refundAmount,jdbcType=DECIMAL},
       order_status = #{orderStatus,jdbcType=INTEGER},
       liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
       process_status = #{processStatus,jdbcType=INTEGER},
@@ -760,9 +776,9 @@
   </update>
   <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrderNew">
     <!--
-      WARNING - @mbg.generated
+      WARNING - @mbggenerated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Nov 19 10:12:37 CST 2018.
+      This element was generated on Fri Nov 23 15:27:45 CST 2018.
     -->
     update t_order_new
     set order_type = #{orderType,jdbcType=INTEGER},
@@ -773,6 +789,7 @@
       first_amount = #{firstAmount,jdbcType=DECIMAL},
       total_amount = #{totalAmount,jdbcType=DECIMAL},
       settlement_amount = #{settlementAmount,jdbcType=DECIMAL},
+      refund_amount = #{refundAmount,jdbcType=DECIMAL},
       order_status = #{orderStatus,jdbcType=INTEGER},
       liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
       process_status = #{processStatus,jdbcType=INTEGER},
@@ -796,7 +813,7 @@
     where order_no = #{orderNo,jdbcType=VARCHAR}
   </update>
   
-  <!-- 查看所有待财务管理员分配的订单数据 -->
+   <!-- 查看所有待财务管理员分配的订单数据 -->
   <select id="getAllUnassignedListOrder" parameterType="Map" resultType="com.goafanti.order.bo.OrderListBo">
   	select o.order_no as orderNo, o.order_type orderType, o.create_time as createTime, o.process_status as processStatus,
   	o.sign_time as signTime, u.nickname as buyerName,o.total_amount signTotalAmount, o.approval , a.name sellerName
@@ -945,8 +962,11 @@
   		and process_status >= 3
   		and (approval = 0 or approval = 2)
 	  	and o.finance_id = #{o.financeId,jdbcType=VARCHAR}
+  		<if test='o.orderStatus != null and o.orderStatus != ""'>
+	  	and o.order_status = #{o.orderStatus,jdbcType=INTEGER}
+	  	</if>
   		<if test='o.liquidationStatus != null and o.liquidationStatus != ""'>
-	  	and o.liquidation_status = #{o.liquidationStatus,jdbcType=VARCHAR}
+	  	and o.liquidation_status = #{o.liquidationStatus,jdbcType=INTEGER}
 	  	</if>
   		<if test='o.liquidationStatus == null or o.liquidationStatus == ""'>
 	  	and o.liquidation_status &lt; 2
@@ -979,6 +999,9 @@
   		and process_status >= 3
   		and (approval = 0 or approval = 2)
 	  	and o.finance_id = #{o.financeId,jdbcType=VARCHAR}
+	  	<if test='o.orderStatus != null and o.orderStatus != ""'>
+	  	and o.order_status = #{o.orderStatus,jdbcType=INTEGER}
+	  	</if>
 	  	<if test='o.liquidationStatus != null and o.liquidationStatus != ""'>
 	  	and o.liquidation_status = #{o.liquidationStatus,jdbcType=VARCHAR}
 	  	</if>
@@ -999,7 +1022,7 @@
 	  	</if>
   </select>
   <!-- 通过订单编号获得订单的负责人(营销员) -->
-  <select id="getSaleIdByOno" parameterType="com.goafanti.order.bo.TOrderNewBo" resultType="java.lang.String">
+  <select id="getSaleIdByOno" resultType="com.goafanti.order.bo.TOrderNewBo" parameterType="java.lang.String">
   	select salesman_id as salesmanId, a.name as salesmanName, a.email ,u.nickname as userName
   	from t_order_new o
   		left join admin a on o.salesman_id = a.id 
@@ -1194,4 +1217,16 @@
   	and a.create_time between #{starTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
   	</if>
   </select>
-</mapper>
+  
+  <!-- 财务同意退款邮件通知需要的数据  -->
+  <select id="agreeEmailData" parameterType="java.lang.Integer" resultType="com.goafanti.order.bo.TOrderNewBo">
+  	select u.nickname as userName, r.order_no as orderNo, o.order_status as orderStaus, o.salesman_id as salesmanId
+  		concat(a.email,"," , ifnull(t.email,"")) as email , concat(a.name,"," , ifnull(t.name,"")) as salesmanName
+  		from t_order_refund r
+  		left join t_order_new o on r.order_no = o.order_no
+  		left join admin a on a.id = o.salesman_id
+  		left join admin t on t.id = o.technician_id
+  		left join `user` u on u.id = o.buyer_id
+  		where r.id = #{id,jdbcType=INTEGER}
+  </select>
+</mapper>

+ 191 - 0
src/main/java/com/goafanti/common/model/TOrderBonus.java

@@ -0,0 +1,191 @@
+package com.goafanti.common.model;
+
+import java.util.Date;
+
+public class TOrderBonus {
+
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order_bonus.id
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	private String id;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order_bonus.create_time
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	private Date createTime;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order_bonus.order_no
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	private String orderNo;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order_bonus.bonus_subject
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	private Integer bonusSubject;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order_bonus.grant_status
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	private Integer grantStatus;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order_bonus.grant_target
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	private String grantTarget;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order_bonus.grant_by
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	private String grantBy;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order_bonus.grant_time
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	private Date grantTime;
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order_bonus.id
+	 * @return  the value of t_order_bonus.id
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public String getId() {
+		return id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order_bonus.id
+	 * @param id  the value for t_order_bonus.id
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public void setId(String id) {
+		this.id = id;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order_bonus.create_time
+	 * @return  the value of t_order_bonus.create_time
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order_bonus.create_time
+	 * @param createTime  the value for t_order_bonus.create_time
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order_bonus.order_no
+	 * @return  the value of t_order_bonus.order_no
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public String getOrderNo() {
+		return orderNo;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order_bonus.order_no
+	 * @param orderNo  the value for t_order_bonus.order_no
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public void setOrderNo(String orderNo) {
+		this.orderNo = orderNo;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order_bonus.bonus_subject
+	 * @return  the value of t_order_bonus.bonus_subject
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public Integer getBonusSubject() {
+		return bonusSubject;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order_bonus.bonus_subject
+	 * @param bonusSubject  the value for t_order_bonus.bonus_subject
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public void setBonusSubject(Integer bonusSubject) {
+		this.bonusSubject = bonusSubject;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order_bonus.grant_status
+	 * @return  the value of t_order_bonus.grant_status
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public Integer getGrantStatus() {
+		return grantStatus;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order_bonus.grant_status
+	 * @param grantStatus  the value for t_order_bonus.grant_status
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public void setGrantStatus(Integer grantStatus) {
+		this.grantStatus = grantStatus;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order_bonus.grant_target
+	 * @return  the value of t_order_bonus.grant_target
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public String getGrantTarget() {
+		return grantTarget;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order_bonus.grant_target
+	 * @param grantTarget  the value for t_order_bonus.grant_target
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public void setGrantTarget(String grantTarget) {
+		this.grantTarget = grantTarget;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order_bonus.grant_by
+	 * @return  the value of t_order_bonus.grant_by
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public String getGrantBy() {
+		return grantBy;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order_bonus.grant_by
+	 * @param grantBy  the value for t_order_bonus.grant_by
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public void setGrantBy(String grantBy) {
+		this.grantBy = grantBy;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order_bonus.grant_time
+	 * @return  the value of t_order_bonus.grant_time
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public Date getGrantTime() {
+		return grantTime;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order_bonus.grant_time
+	 * @param grantTime  the value for t_order_bonus.grant_time
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public void setGrantTime(Date grantTime) {
+		this.grantTime = grantTime;
+	}
+}

+ 829 - 0
src/main/java/com/goafanti/common/model/TOrderBonusExample.java

@@ -0,0 +1,829 @@
+package com.goafanti.common.model;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Iterator;
+
+public class TOrderBonusExample {
+    /**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	protected String orderByClause;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	protected boolean distinct;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	protected List<Criteria> oredCriteria;
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public TOrderBonusExample() {
+		oredCriteria = new ArrayList<Criteria>();
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public void setOrderByClause(String orderByClause) {
+		this.orderByClause = orderByClause;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public String getOrderByClause() {
+		return orderByClause;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public void setDistinct(boolean distinct) {
+		this.distinct = distinct;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public boolean isDistinct() {
+		return distinct;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public List<Criteria> getOredCriteria() {
+		return oredCriteria;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public void or(Criteria criteria) {
+		oredCriteria.add(criteria);
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public Criteria or() {
+		Criteria criteria = createCriteriaInternal();
+		oredCriteria.add(criteria);
+		return criteria;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public Criteria createCriteria() {
+		Criteria criteria = createCriteriaInternal();
+		if (oredCriteria.size() == 0) {
+			oredCriteria.add(criteria);
+		}
+		return criteria;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	protected Criteria createCriteriaInternal() {
+		Criteria criteria = new Criteria();
+		return criteria;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public void clear() {
+		oredCriteria.clear();
+		orderByClause = null;
+		distinct = false;
+	}
+
+	/**
+	 * This class was generated by MyBatis Generator. This class corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	protected abstract static class GeneratedCriteria {
+		protected List<Criterion> criteria;
+
+		protected GeneratedCriteria() {
+			super();
+			criteria = new ArrayList<Criterion>();
+		}
+
+		public boolean isValid() {
+			return criteria.size() > 0;
+		}
+
+		public List<Criterion> getAllCriteria() {
+			return criteria;
+		}
+
+		public List<Criterion> getCriteria() {
+			return criteria;
+		}
+
+		protected void addCriterion(String condition) {
+			if (condition == null) {
+				throw new RuntimeException("Value for condition cannot be null");
+			}
+			criteria.add(new Criterion(condition));
+		}
+
+		protected void addCriterion(String condition, Object value,
+				String property) {
+			if (value == null) {
+				throw new RuntimeException("Value for " + property
+						+ " cannot be null");
+			}
+			criteria.add(new Criterion(condition, value));
+		}
+
+		protected void addCriterion(String condition, Object value1,
+				Object value2, String property) {
+			if (value1 == null || value2 == null) {
+				throw new RuntimeException("Between values for " + property
+						+ " cannot be null");
+			}
+			criteria.add(new Criterion(condition, value1, value2));
+		}
+
+		protected void addCriterionForJDBCDate(String condition, Date value,
+				String property) {
+			if (value == null) {
+				throw new RuntimeException("Value for " + property
+						+ " cannot be null");
+			}
+			addCriterion(condition, new java.sql.Date(value.getTime()),
+					property);
+		}
+
+		protected void addCriterionForJDBCDate(String condition,
+				List<Date> values, String property) {
+			if (values == null || values.size() == 0) {
+				throw new RuntimeException("Value list for " + property
+						+ " cannot be null or empty");
+			}
+			List<java.sql.Date> dateList = new ArrayList<java.sql.Date>();
+			Iterator<Date> iter = values.iterator();
+			while (iter.hasNext()) {
+				dateList.add(new java.sql.Date(iter.next().getTime()));
+			}
+			addCriterion(condition, dateList, property);
+		}
+
+		protected void addCriterionForJDBCDate(String condition, Date value1,
+				Date value2, String property) {
+			if (value1 == null || value2 == null) {
+				throw new RuntimeException("Between values for " + property
+						+ " cannot be null");
+			}
+			addCriterion(condition, new java.sql.Date(value1.getTime()),
+					new java.sql.Date(value2.getTime()), property);
+		}
+
+		public Criteria andIdIsNull() {
+			addCriterion("id is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdIsNotNull() {
+			addCriterion("id is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdEqualTo(String value) {
+			addCriterion("id =", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdNotEqualTo(String value) {
+			addCriterion("id <>", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdGreaterThan(String value) {
+			addCriterion("id >", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdGreaterThanOrEqualTo(String value) {
+			addCriterion("id >=", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdLessThan(String value) {
+			addCriterion("id <", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdLessThanOrEqualTo(String value) {
+			addCriterion("id <=", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdLike(String value) {
+			addCriterion("id like", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdNotLike(String value) {
+			addCriterion("id not like", value, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdIn(List<String> values) {
+			addCriterion("id in", values, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdNotIn(List<String> values) {
+			addCriterion("id not in", values, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdBetween(String value1, String value2) {
+			addCriterion("id between", value1, value2, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andIdNotBetween(String value1, String value2) {
+			addCriterion("id not between", value1, value2, "id");
+			return (Criteria) this;
+		}
+
+		public Criteria andCreateTimeIsNull() {
+			addCriterion("create_time is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andCreateTimeIsNotNull() {
+			addCriterion("create_time is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andCreateTimeEqualTo(Date value) {
+			addCriterion("create_time =", value, "createTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andCreateTimeNotEqualTo(Date value) {
+			addCriterion("create_time <>", value, "createTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andCreateTimeGreaterThan(Date value) {
+			addCriterion("create_time >", value, "createTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
+			addCriterion("create_time >=", value, "createTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andCreateTimeLessThan(Date value) {
+			addCriterion("create_time <", value, "createTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
+			addCriterion("create_time <=", value, "createTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andCreateTimeIn(List<Date> values) {
+			addCriterion("create_time in", values, "createTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andCreateTimeNotIn(List<Date> values) {
+			addCriterion("create_time not in", values, "createTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andCreateTimeBetween(Date value1, Date value2) {
+			addCriterion("create_time between", value1, value2, "createTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
+			addCriterion("create_time not between", value1, value2,
+					"createTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoIsNull() {
+			addCriterion("order_no is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoIsNotNull() {
+			addCriterion("order_no is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoEqualTo(String value) {
+			addCriterion("order_no =", value, "orderNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoNotEqualTo(String value) {
+			addCriterion("order_no <>", value, "orderNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoGreaterThan(String value) {
+			addCriterion("order_no >", value, "orderNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoGreaterThanOrEqualTo(String value) {
+			addCriterion("order_no >=", value, "orderNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoLessThan(String value) {
+			addCriterion("order_no <", value, "orderNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoLessThanOrEqualTo(String value) {
+			addCriterion("order_no <=", value, "orderNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoLike(String value) {
+			addCriterion("order_no like", value, "orderNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoNotLike(String value) {
+			addCriterion("order_no not like", value, "orderNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoIn(List<String> values) {
+			addCriterion("order_no in", values, "orderNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoNotIn(List<String> values) {
+			addCriterion("order_no not in", values, "orderNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoBetween(String value1, String value2) {
+			addCriterion("order_no between", value1, value2, "orderNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andOrderNoNotBetween(String value1, String value2) {
+			addCriterion("order_no not between", value1, value2, "orderNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andBonusSubjectIsNull() {
+			addCriterion("bonus_subject is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andBonusSubjectIsNotNull() {
+			addCriterion("bonus_subject is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andBonusSubjectEqualTo(Integer value) {
+			addCriterion("bonus_subject =", value, "bonusSubject");
+			return (Criteria) this;
+		}
+
+		public Criteria andBonusSubjectNotEqualTo(Integer value) {
+			addCriterion("bonus_subject <>", value, "bonusSubject");
+			return (Criteria) this;
+		}
+
+		public Criteria andBonusSubjectGreaterThan(Integer value) {
+			addCriterion("bonus_subject >", value, "bonusSubject");
+			return (Criteria) this;
+		}
+
+		public Criteria andBonusSubjectGreaterThanOrEqualTo(Integer value) {
+			addCriterion("bonus_subject >=", value, "bonusSubject");
+			return (Criteria) this;
+		}
+
+		public Criteria andBonusSubjectLessThan(Integer value) {
+			addCriterion("bonus_subject <", value, "bonusSubject");
+			return (Criteria) this;
+		}
+
+		public Criteria andBonusSubjectLessThanOrEqualTo(Integer value) {
+			addCriterion("bonus_subject <=", value, "bonusSubject");
+			return (Criteria) this;
+		}
+
+		public Criteria andBonusSubjectIn(List<Integer> values) {
+			addCriterion("bonus_subject in", values, "bonusSubject");
+			return (Criteria) this;
+		}
+
+		public Criteria andBonusSubjectNotIn(List<Integer> values) {
+			addCriterion("bonus_subject not in", values, "bonusSubject");
+			return (Criteria) this;
+		}
+
+		public Criteria andBonusSubjectBetween(Integer value1, Integer value2) {
+			addCriterion("bonus_subject between", value1, value2,
+					"bonusSubject");
+			return (Criteria) this;
+		}
+
+		public Criteria andBonusSubjectNotBetween(Integer value1, Integer value2) {
+			addCriterion("bonus_subject not between", value1, value2,
+					"bonusSubject");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantStatusIsNull() {
+			addCriterion("grant_status is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantStatusIsNotNull() {
+			addCriterion("grant_status is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantStatusEqualTo(Integer value) {
+			addCriterion("grant_status =", value, "grantStatus");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantStatusNotEqualTo(Integer value) {
+			addCriterion("grant_status <>", value, "grantStatus");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantStatusGreaterThan(Integer value) {
+			addCriterion("grant_status >", value, "grantStatus");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantStatusGreaterThanOrEqualTo(Integer value) {
+			addCriterion("grant_status >=", value, "grantStatus");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantStatusLessThan(Integer value) {
+			addCriterion("grant_status <", value, "grantStatus");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantStatusLessThanOrEqualTo(Integer value) {
+			addCriterion("grant_status <=", value, "grantStatus");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantStatusIn(List<Integer> values) {
+			addCriterion("grant_status in", values, "grantStatus");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantStatusNotIn(List<Integer> values) {
+			addCriterion("grant_status not in", values, "grantStatus");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantStatusBetween(Integer value1, Integer value2) {
+			addCriterion("grant_status between", value1, value2, "grantStatus");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantStatusNotBetween(Integer value1, Integer value2) {
+			addCriterion("grant_status not between", value1, value2,
+					"grantStatus");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetIsNull() {
+			addCriterion("grant_target is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetIsNotNull() {
+			addCriterion("grant_target is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetEqualTo(String value) {
+			addCriterion("grant_target =", value, "grantTarget");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetNotEqualTo(String value) {
+			addCriterion("grant_target <>", value, "grantTarget");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetGreaterThan(String value) {
+			addCriterion("grant_target >", value, "grantTarget");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetGreaterThanOrEqualTo(String value) {
+			addCriterion("grant_target >=", value, "grantTarget");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetLessThan(String value) {
+			addCriterion("grant_target <", value, "grantTarget");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetLessThanOrEqualTo(String value) {
+			addCriterion("grant_target <=", value, "grantTarget");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetLike(String value) {
+			addCriterion("grant_target like", value, "grantTarget");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetNotLike(String value) {
+			addCriterion("grant_target not like", value, "grantTarget");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetIn(List<String> values) {
+			addCriterion("grant_target in", values, "grantTarget");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetNotIn(List<String> values) {
+			addCriterion("grant_target not in", values, "grantTarget");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetBetween(String value1, String value2) {
+			addCriterion("grant_target between", value1, value2, "grantTarget");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTargetNotBetween(String value1, String value2) {
+			addCriterion("grant_target not between", value1, value2,
+					"grantTarget");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByIsNull() {
+			addCriterion("grant_by is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByIsNotNull() {
+			addCriterion("grant_by is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByEqualTo(String value) {
+			addCriterion("grant_by =", value, "grantBy");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByNotEqualTo(String value) {
+			addCriterion("grant_by <>", value, "grantBy");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByGreaterThan(String value) {
+			addCriterion("grant_by >", value, "grantBy");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByGreaterThanOrEqualTo(String value) {
+			addCriterion("grant_by >=", value, "grantBy");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByLessThan(String value) {
+			addCriterion("grant_by <", value, "grantBy");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByLessThanOrEqualTo(String value) {
+			addCriterion("grant_by <=", value, "grantBy");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByLike(String value) {
+			addCriterion("grant_by like", value, "grantBy");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByNotLike(String value) {
+			addCriterion("grant_by not like", value, "grantBy");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByIn(List<String> values) {
+			addCriterion("grant_by in", values, "grantBy");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByNotIn(List<String> values) {
+			addCriterion("grant_by not in", values, "grantBy");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByBetween(String value1, String value2) {
+			addCriterion("grant_by between", value1, value2, "grantBy");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantByNotBetween(String value1, String value2) {
+			addCriterion("grant_by not between", value1, value2, "grantBy");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTimeIsNull() {
+			addCriterion("grant_time is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTimeIsNotNull() {
+			addCriterion("grant_time is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTimeEqualTo(Date value) {
+			addCriterionForJDBCDate("grant_time =", value, "grantTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTimeNotEqualTo(Date value) {
+			addCriterionForJDBCDate("grant_time <>", value, "grantTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTimeGreaterThan(Date value) {
+			addCriterionForJDBCDate("grant_time >", value, "grantTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTimeGreaterThanOrEqualTo(Date value) {
+			addCriterionForJDBCDate("grant_time >=", value, "grantTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTimeLessThan(Date value) {
+			addCriterionForJDBCDate("grant_time <", value, "grantTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTimeLessThanOrEqualTo(Date value) {
+			addCriterionForJDBCDate("grant_time <=", value, "grantTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTimeIn(List<Date> values) {
+			addCriterionForJDBCDate("grant_time in", values, "grantTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTimeNotIn(List<Date> values) {
+			addCriterionForJDBCDate("grant_time not in", values, "grantTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTimeBetween(Date value1, Date value2) {
+			addCriterionForJDBCDate("grant_time between", value1, value2,
+					"grantTime");
+			return (Criteria) this;
+		}
+
+		public Criteria andGrantTimeNotBetween(Date value1, Date value2) {
+			addCriterionForJDBCDate("grant_time not between", value1, value2,
+					"grantTime");
+			return (Criteria) this;
+		}
+	}
+
+	/**
+	 * This class was generated by MyBatis Generator. This class corresponds to the database table t_order_bonus
+	 * @mbggenerated  Fri Nov 23 16:33:27 CST 2018
+	 */
+	public static class Criterion {
+		private String condition;
+		private Object value;
+		private Object secondValue;
+		private boolean noValue;
+		private boolean singleValue;
+		private boolean betweenValue;
+		private boolean listValue;
+		private String typeHandler;
+
+		public String getCondition() {
+			return condition;
+		}
+
+		public Object getValue() {
+			return value;
+		}
+
+		public Object getSecondValue() {
+			return secondValue;
+		}
+
+		public boolean isNoValue() {
+			return noValue;
+		}
+
+		public boolean isSingleValue() {
+			return singleValue;
+		}
+
+		public boolean isBetweenValue() {
+			return betweenValue;
+		}
+
+		public boolean isListValue() {
+			return listValue;
+		}
+
+		public String getTypeHandler() {
+			return typeHandler;
+		}
+
+		protected Criterion(String condition) {
+			super();
+			this.condition = condition;
+			this.typeHandler = null;
+			this.noValue = true;
+		}
+
+		protected Criterion(String condition, Object value, String typeHandler) {
+			super();
+			this.condition = condition;
+			this.value = value;
+			this.typeHandler = typeHandler;
+			if (value instanceof List<?>) {
+				this.listValue = true;
+			} else {
+				this.singleValue = true;
+			}
+		}
+
+		protected Criterion(String condition, Object value) {
+			this(condition, value, null);
+		}
+
+		protected Criterion(String condition, Object value, Object secondValue,
+				String typeHandler) {
+			super();
+			this.condition = condition;
+			this.value = value;
+			this.secondValue = secondValue;
+			this.typeHandler = typeHandler;
+			this.betweenValue = true;
+		}
+
+		protected Criterion(String condition, Object value, Object secondValue) {
+			this(condition, value, secondValue, null);
+		}
+	}
+
+	/**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table t_order_bonus
+     *
+     * @mbggenerated do_not_delete_during_merge Fri Nov 23 09:44:11 CST 2018
+     */
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+}

File diff suppressed because it is too large
+ 742 - 987
src/main/java/com/goafanti/common/model/TOrderNew.java


File diff suppressed because it is too large
+ 2288 - 2200
src/main/java/com/goafanti/common/model/TOrderNewExample.java


+ 0 - 2
src/main/java/com/goafanti/common/utils/ExportExcelUtil.java

@@ -2,10 +2,8 @@ package com.goafanti.common.utils;
 
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;

+ 96 - 0
src/main/java/com/goafanti/common/utils/SendEmailUtil.java

@@ -0,0 +1,96 @@
+package com.goafanti.common.utils;
+
+import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.Properties;
+
+import javax.mail.Authenticator;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.PasswordAuthentication;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import javax.mail.internet.MimeUtility;
+
+import com.goafanti.common.bo.EmailBo;
+import com.goafanti.order.enums.OrderNewState;
+
+public class SendEmailUtil {
+	public static final String HOST = "smtp.163.com";
+	public static final String PORT = "465";
+	public static final String AUTH_USER_NICKNAME = "湖南科德信息咨询有限公司";
+	public static final String FROM = "13077305639@163.com";// 发件人的email
+	public static final String PWD = "kede2018";// 发件人密码
+	public static final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
+
+	private static Session getSession() {
+		Properties props = new Properties();
+
+		// 这一套是465端口
+		props.setProperty("mail.smtp.host", HOST);// 设置服务器地址
+		props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);// 设置协议
+		props.setProperty("mail.smtp.socketFactory.fallback", "false");// 注意是字符串的true,不是boolean类型的true
+		props.setProperty("mail.smtp.port", PORT);// 设置端口
+		props.setProperty("mail.smtp.socketFactory.port", PORT);
+		props.put("mail.smtp.auth", "true");// 注意是字符串的true,不是boolean类型的true
+
+		Authenticator authenticator = new Authenticator() {
+			@Override
+			protected PasswordAuthentication getPasswordAuthentication() {
+				return new PasswordAuthentication(FROM, PWD);
+			}
+
+		};
+		Session session = Session.getDefaultInstance(props, authenticator);
+
+		return session;
+	}
+
+	/**
+	 * 如果要给多个人发,请EmailBo 的 address , addressee用逗号隔开 注意要一一对应且个数相等
+	 * @param emailBo
+	 * @throws MessagingException
+	 * @throws UnsupportedEncodingException
+	 */
+	public static void send(EmailBo emailBo)
+			throws MessagingException, UnsupportedEncodingException {
+		Session session = getSession();
+		// Instantiate a message
+		Message msg = new MimeMessage(session);
+
+		// Set message attributes
+		msg.setFrom(new InternetAddress(MimeUtility.encodeText(AUTH_USER_NICKNAME) +"<" +  FROM + ">"));
+
+//		msg.setFrom(new InternetAddress(FROM));
+		String[] adds =  emailBo.getAddress().split(",");
+		String[] ees =  emailBo.getAddressee().split(",");
+		for (int i = 0; i < adds.length; i++) {
+			InternetAddress internetAddress = new InternetAddress(adds[i]);
+			msg.setRecipient(Message.RecipientType.TO, internetAddress);
+			msg.setSubject(emailBo.getSubject());
+			msg.setSentDate(new Date());
+			msg.setContent(emailBo.format(ees[i]), "text/html;charset=utf-8");
+			// Send the message
+			Transport.send(msg);
+		}
+	}
+
+	public static void main(String[] args) throws MessagingException, UnsupportedEncodingException {
+		System.out.println(OrderNewState.getStatus(0));
+		System.out.println(OrderNewState.getStatus(1));
+		System.out.println(OrderNewState.getStatus(2));
+		System.out.println(OrderNewState.getStatus(3));
+		System.out.println(OrderNewState.YBH);
+		System.out.println(OrderNewState.YJX);
+		System.out.println(OrderNewState.getValueByCode(0));
+		BigDecimal b = new BigDecimal("1.2");
+		System.out.println(b.add(new BigDecimal(0.0000)).toString());
+		System.out.println(b.add(new BigDecimal("0")).toString());
+//		String content = "<div>客户名称: 张雯</div><div>订单编号: 0001</div>";
+//		EmailBo bo = new EmailBo("奖金信息", "13077305639@163.com,3298921364@qq.com", "limim,李敏", "财务部", "财务专员彭晓丽", content);
+//		send(bo);
+	}
+}

+ 4 - 9
src/main/java/com/goafanti/order/controller/FundManagerOrderApiController.java

@@ -1,10 +1,7 @@
 package com.goafanti.order.controller;
 
-import java.io.BufferedOutputStream;
-import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
@@ -22,7 +19,6 @@ import com.goafanti.common.controller.CertifyApiController;
 import com.goafanti.common.model.TOrderBack;
 import com.goafanti.common.model.TOrderBillNew;
 import com.goafanti.common.model.TOrderRefund;
-import com.goafanti.common.utils.ExportExcelUtil;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.order.bo.OrderListBo;
 import com.goafanti.order.bo.OrderRefundBo;
@@ -31,7 +27,7 @@ import com.goafanti.order.service.OrderBillService;
 import com.goafanti.order.service.OrderRefundService;
 
 @RestController
-@RequestMapping(value = "/open/api/admin/financial")
+@RequestMapping(value = "/api/admin/financial")
 public class FundManagerOrderApiController extends CertifyApiController {
 	@Resource
 	private FundManageOrderService fundManageOrderServiceImpl;
@@ -289,9 +285,8 @@ public class FundManagerOrderApiController extends CertifyApiController {
 			 f.delete();
 		 }*/
 		 String fileName = "部门流水" + new SimpleDateFormat("yyyy-MM-dd HH:mm").format(new Date()) + ".xls";
-		 OutputStream out=response.getOutputStream();
-		 response.addHeader("Content-Disposition", "attachment;filename="  
-                 + new String(fileName.getBytes(),"iso-8859-1"));  
+		 OutputStream out = response.getOutputStream();
+		 response.addHeader("Content-Disposition", "attachment;filename="  + new String(fileName.getBytes(),"iso-8859-1"));  
          response.setContentType("application/octet-stream;charset=utf-8");  
 		try {
 			// 返回数据流
@@ -304,5 +299,5 @@ public class FundManagerOrderApiController extends CertifyApiController {
 		}
 		return res;
 	 }
-	
+	 
 }

+ 68 - 0
src/main/java/com/goafanti/order/controller/OrderBonusStatisticsApiController.java

@@ -0,0 +1,68 @@
+package com.goafanti.order.controller;
+
+import java.math.BigDecimal;
+
+import javax.annotation.Resource;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.goafanti.common.bo.Result;
+import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.common.model.TOrderNew;
+import com.goafanti.order.bo.TOrderNewBo;
+import com.goafanti.order.service.FundManageOrderService;
+import com.goafanti.order.service.OrderBonusService;
+
+@RestController
+@RequestMapping(value = "/open/api/admin/bonus")
+public class OrderBonusStatisticsApiController extends CertifyApiController {
+	@Resource
+	private FundManageOrderService fundManageOrderServiceImpl;
+	@Resource
+	private OrderBonusService orderBonusServiceImpl;
+	
+	 /**
+	  * 财务专员校对单量
+	  * @param orderNew
+	  * @return
+	  */
+	 @RequestMapping(value="/proofreading", method = RequestMethod.POST)
+	 public Result proofreading(TOrderNew orderNew){
+		 Result res = new Result();
+		 res.setData(fundManageOrderServiceImpl.updateProofreading(orderNew));
+		 return res;
+	 }
+	 
+	 /**
+	  * 营销员奖金统计
+	  * @param orderNewBo
+	  * @return
+	  */
+	 @RequestMapping(value="/saleBonusStatistics", method = RequestMethod.GET)
+	 public Result saleBonusStatistics(TOrderNewBo orderNewBo){
+		 Result res = new Result();
+		 System.out.println(orderNewBo.getFirstAmount().add(new BigDecimal("-3")));
+		 //res.setData(fundManageOrderServiceImpl.updateProofreading(orderNew));
+		 return res;
+	 }
+	 
+	 /**
+	  * 财务专员发放奖金
+	  * @param id
+	  * @return
+	  */
+	 @RequestMapping(value="/bonusPayment", method = RequestMethod.POST)
+	 public Result bonusPayment(String id,String orderNo){
+		 Result res = new Result();
+		 Integer i = orderBonusServiceImpl.updateBounsPaymnetStatus(id, orderNo);
+		 if(i>0){
+				res.setData("发放成功!");
+			}else{
+				res.getError().add(buildError("", "没有校对单量,不能发放"));
+			}
+		 return res;
+	 }
+	 
+}

+ 10 - 0
src/main/java/com/goafanti/order/enums/OrderNewState.java

@@ -37,6 +37,16 @@ public enum OrderNewState {
 		}
 		return DQD;
 	}
+	
+	public static String getValueByCode(Integer code){
+        for(OrderNewState orderNewState:OrderNewState.values()){
+            if(code.equals(orderNewState.getCode())){
+                return orderNewState.getDesc();
+            }
+        }
+        return  null;
+    }
+	
 	public static boolean containsType(Integer code) {
 		return status.containsKey(code);
 	}

+ 8 - 0
src/main/java/com/goafanti/order/service/FundManageOrderService.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.goafanti.common.model.TOrderBack;
 import com.goafanti.common.model.TOrderBillNew;
+import com.goafanti.common.model.TOrderNew;
 import com.goafanti.common.model.TOrderRefund;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.order.bo.OrderListBo;
@@ -77,4 +78,11 @@ public interface FundManageOrderService {
 	 */
 	List<TOrderBillNew> selectOneOrderAllRefundFlow(String orderNo);
 	
+	/**
+	 * 财务专员校对
+	 * @param orderNew
+	 * @return
+	 */
+	Integer updateProofreading(TOrderNew orderNew);
+	
 }

+ 19 - 0
src/main/java/com/goafanti/order/service/OrderBonusService.java

@@ -0,0 +1,19 @@
+package com.goafanti.order.service;
+
+import com.goafanti.common.model.TOrderBonus;
+
+public interface OrderBonusService {
+	/**
+	 * 新增奖金信息
+	 * @param bonus
+	 * @return
+	 */
+	Integer addOrderBouns(TOrderBonus bonus);
+	
+	/**
+	 * 更改发放奖金状态
+	 * @param id
+	 * @return
+	 */
+	Integer updateBounsPaymnetStatus(String id,String orderNo);
+}

+ 71 - 15
src/main/java/com/goafanti/order/service/impl/FundManagerOrderServiceImpl.java

@@ -5,6 +5,7 @@ import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 import javax.mail.MessagingException;
 
@@ -16,10 +17,12 @@ import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.dao.AdminMapper;
 import com.goafanti.common.dao.TOrderBackMapper;
 import com.goafanti.common.dao.TOrderBillNewMapper;
+import com.goafanti.common.dao.TOrderBonusMapper;
 import com.goafanti.common.dao.TOrderNewMapper;
 import com.goafanti.common.dao.TOrderRefundMapper;
 import com.goafanti.common.model.TOrderBack;
 import com.goafanti.common.model.TOrderBillNew;
+import com.goafanti.common.model.TOrderBonus;
 import com.goafanti.common.model.TOrderNew;
 import com.goafanti.common.model.TOrderRefund;
 import com.goafanti.common.utils.SendEmailUtil;
@@ -30,6 +33,7 @@ import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.order.bo.OrderListBo;
 import com.goafanti.order.bo.TOrderNewBo;
+import com.goafanti.order.enums.OrderNewState;
 import com.goafanti.order.service.FundManageOrderService;
 
 @Service
@@ -46,6 +50,8 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 	@Autowired
 	private TOrderRefundMapper refundMapper;
 	@Autowired
+	private TOrderBonusMapper bonusMapper;
+	@Autowired
 	JDBCIdGenerator	idGenerator;
 
 	@SuppressWarnings("unchecked")
@@ -158,22 +164,28 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 			return -2;
 		}
 		BigDecimal bd = bill.add(billNew.getTransactionAmount().abs());
-		int lstaus = 0;
-		
-		//如果订单流水总额大于总金额 return -1
-		//如果订单流水等于于总金额 lstaus 2
-		//如果订单流水小于总金额大于首付 lstaus 1
-		//如果订单流水小于首付 lstaus 0
+		//奖金信息
+		TOrderBonus bonus = new TOrderBonus();
+		bonus.setId(UUID.randomUUID().toString());
+		bonus.setOrderNo(billNew.getOrderNo());
+		bonus.setGrantBy(TokenManager.getAdminId());
+		bonus.setGrantTarget(billNew.getSaleId());
+		int lstaus = 0;//如果订单流水小于首付 lstaus 0
 		
 		// 0 相等
 		// -1 小于 
 		// 1 大于
-		if(bd.compareTo(o.getTotalAmount()) == 1){
+		if(bd.compareTo(o.getTotalAmount()) == 1){//如果订单流水总额大于总金额 return -1
 			return -1;//超过不能添加
-		}else if(bd.compareTo(o.getTotalAmount()) == 0){
+		}else if(bd.compareTo(o.getTotalAmount()) == 0){//付完款//如果订单流水等于于总金额 lstaus 2
 			lstaus = 2;
-		}else if(bd.compareTo(o.getTotalAmount()) == -1 && bd.compareTo(o.getFirstAmount()) == 1){
-			lstaus = 1;
+			bonus.setBonusSubject(12);
+		}else if(bd.compareTo(o.getTotalAmount()) == -1){//如果订单流水小于总金额
+			if(bd.compareTo(o.getFirstAmount()) == 0){//首付完成
+				bonus.setBonusSubject(11);
+			}else if(bd.compareTo(o.getFirstAmount()) == 1){//大于首付 lstaus 1
+				lstaus = 1;
+			}
 		}
 		//否则新增流水信息
 		billNew.setBillNo(idGenerator.generateId().toString());
@@ -184,13 +196,18 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		//如果已经首付并且流程状态是没有派给咨询师的修改流程状态为4
 		TOrderNew orderNew = new TOrderNew();
 		orderNew.setOrderNo(billNew.getOrderNo());
-		orderNew.setSettlementAmount(bd);
+		//这里的已收金额是以前收的所有金额加上本次收的金额
+		orderNew.setSettlementAmount(billNew.getTransactionAmount().add(o.getSettlementAmount()));
 		orderNew.setLiquidationStatus(lstaus);
 		if(lstaus == 1 && o.getProcessStatus() == 3){
 			orderNew.setProcessStatus(4);
 		}
 		if(result > 0){
 			result = tOrderNewMapper.updateByPrimaryKeySelective(orderNew);
+			//如果达到奖金发放要求新增奖金信息
+			if(null != bonus.getBonusSubject()){
+				bonusMapper.insertSelective(bonus);
+			}
 		}
 		
 		return result;
@@ -203,6 +220,35 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		if(d.getRefundStatus() != 0){
 			return -1;
 		}
+		//如果审核通过给咨询师和营销员发起退单通知
+		if(refund.getRefundStatus() == 1){
+			TOrderNewBo o = tOrderNewMapper.agreeEmailData(refund.getId());
+			//新增奖金信息表数据
+			TOrderBonus bonus = new TOrderBonus();
+			bonus.setId(UUID.randomUUID().toString());
+			bonus.setOrderNo(o.getOrderNo());
+			bonus.setGrantBy(TokenManager.getAdminId());
+			bonus.setGrantTarget(o.getSalesmanId());
+			bonus.setBonusSubject(16);
+			bonusMapper.insertSelective(bonus);
+			
+			//退单邮件发送需要的数据
+			AdminListBo a = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
+			
+			String content = "<div>退单编号: "+ refund.getId() +"</div><div>客户名称: " + o.getUserName() + "</div>";
+			 content += "<div>订单编号: "+ o.getOrderNo() +"</div><div>订单状态: " + OrderNewState.getValueByCode(o.getOrderStatus()) + "</div>";
+			
+			EmailBo emailBo = new EmailBo("同意退单", o.getEmail(), o.getSalesmanName(), a.getDepartmentId(), a.getName(), content);
+			try {
+				SendEmailUtil.send(emailBo);
+			} catch (UnsupportedEncodingException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (MessagingException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
 		
 		//修改退单审核状态
 		return refundMapper.updateRefundById(refund);
@@ -210,7 +256,7 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 
 	@Override
 	public Integer addRefundFlow(TOrderBillNew billNew) {
-		// 查看收款总金额
+		// 查看收款总金额流水
 		BigDecimal bd = billNewMapper.getAmountByOid(billNew.getOrderNo());
 		billNew.setTransactionAmount(billNew.getTransactionAmount().abs());//绝对值
 		int lstaus = 3;
@@ -223,7 +269,7 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 			lstaus = 4;
 		}
 		
-		//新增款流水
+		//新增退款流水
 		billNew.setBillNo(idGenerator.generateId().toString());
 		billNew.setCreater(TokenManager.getAdminId());
 		billNew.setTransactionAmount(billNew.getTransactionAmount().negate());// 取负数
@@ -232,10 +278,13 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		//修改订单数据结算状态和结算金额
 		TOrderNew orderNew = new TOrderNew();
 		orderNew.setOrderNo(billNew.getOrderNo());
-		orderNew.setSettlementAmount(bd.add(billNew.getTransactionAmount()));
+		TOrderNew o = tOrderNewMapper.selectByPrimaryKey(billNew.getOrderNo());
+		//这里修改退款金额数据之前退的金额加上本次退的金额
+		orderNew.setRefundAmount(billNew.getTransactionAmount().add(o.getRefundAmount()));
+		
 		orderNew.setLiquidationStatus(lstaus);
 		if(lstaus == 4){//如果款项全部退完就更改订单状态,这里不一定待商榷
-			orderNew.setProcessStatus(6);
+			//orderNew.setProcessStatus(6);
 		}
 		if(result > 0){
 			result = tOrderNewMapper.updateByPrimaryKeySelective(orderNew);
@@ -253,5 +302,12 @@ public class FundManagerOrderServiceImpl extends BaseMybatisDao<TOrderNewMapper>
 		return billNewMapper.getOneOrderAllRefundFlow(orderNo);
 	}
 
+	@Override
+	public Integer updateProofreading(TOrderNew orderNew) {
+		// 创建人
+		orderNew.setProofAid(TokenManager.getAdminId());
+		return tOrderNewMapper.updateByPrimaryKeySelective(orderNew);
+	}
+
 	
 }

+ 0 - 1
src/main/java/com/goafanti/order/service/impl/OrderBillServiceImpl.java

@@ -1,6 +1,5 @@
 package com.goafanti.order.service.impl;
 
-import java.io.File;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;

+ 45 - 0
src/main/java/com/goafanti/order/service/impl/OrderBonusServiceImpl.java

@@ -0,0 +1,45 @@
+package com.goafanti.order.service.impl;
+
+import java.util.Date;
+import java.util.UUID;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.goafanti.common.dao.TOrderBonusMapper;
+import com.goafanti.common.dao.TOrderNewMapper;
+import com.goafanti.common.model.TOrderBonus;
+import com.goafanti.common.model.TOrderNew;
+import com.goafanti.common.utils.StringUtils;
+import com.goafanti.core.mybatis.BaseMybatisDao;
+import com.goafanti.order.service.OrderBonusService;
+
+@Service
+public class OrderBonusServiceImpl extends BaseMybatisDao<TOrderBonusMapper> implements OrderBonusService {
+	
+	@Autowired
+	private TOrderBonusMapper bonusMapper;
+	@Autowired
+	private TOrderNewMapper orderNewMapper;
+	
+	@Override
+	public Integer addOrderBouns(TOrderBonus bonus) {
+		// 生成id
+		bonus.setId(UUID.randomUUID().toString());
+		return bonusMapper.insertSelective(bonus);
+	}
+
+	@Override
+	public Integer updateBounsPaymnetStatus(String id,String orderNo) {
+		//先确定订单有没有校对信息
+		TOrderNew o = orderNewMapper.selectByPrimaryKey(orderNo);
+		if(null == o || StringUtils.isBlank(o.getProofAid())){//不存在或者没有校对
+			return -1;
+		}
+		TOrderBonus bonus = new TOrderBonus();
+		bonus.setId(id);
+		bonus.setGrantStatus(1);
+		//bonus.setGrantTime(new Date());发放时间预留
+		return bonusMapper.updateByPrimaryKeySelective(bonus);
+	}
+}