Browse Source

订单管理

wanghui 8 years ago
parent
commit
dea54e8856

+ 1 - 1
GeneratorConfig.xml

@@ -10,6 +10,6 @@
     <javaModelGenerator targetPackage="com.goafanti.common.model" targetProject="AFT" />
     <sqlMapGenerator targetPackage="com.goafanti.common.mapper" targetProject="AFT" />
     <javaClientGenerator targetPackage="com.goafanti.common.dao" targetProject="AFT" type="XMLMAPPER" />
-    <table schema="aft" tableName="t_order_detail"/>
+    <table schema="aft" tableName="t_order"/>
   </context>
 </generatorConfiguration>

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

@@ -14,18 +14,20 @@ public class AFTConstants {
 	public static final String	INITIALPASSWORD						= "123456";				// 初始密码
 
 	public static final String	SUPERADMIN							= "999999";				// 超级管理员
+	
+	public static final String  APPROVAL_DECISION					= "99999";				//特批决策者
 
-	public static final String	AREAADMIN							= "99999";				// 地区管理员
+	public static final String	AREAADMIN							= "";				// 地区管理员
 
-	public static final String	AUDITORADMIN						= "9999";				// 审核员
+	public static final String	AUDITORADMIN						= "";				// 审核员
 
-	public static final String	MANAGERADMIN						= "4";					// 客户经理
+	public static final String	MANAGERADMIN						= "";					// 客户经理
 
-	public static final String	SALESMANAGERADMIN					= "5";					// 营销经理
+	public static final String	SALESMANAGERADMIN					= "";					// 营销经理
 
-	public static final String	SALESMANADMIN						= "6";					// 营销员
+	public static final String	SALESMANADMIN						= "";					// 营销员
 
-	public static final String	TECHBROKER							= "7";					// 技术经纪人
+	public static final String	TECHBROKER							= "";					// 技术经纪人
 
 	public static final String	PATENTINFO							= "专利申请管理";
 

+ 2 - 0
src/main/java/com/goafanti/common/constant/ErrorConstants.java

@@ -125,4 +125,6 @@ public class ErrorConstants {
 	public static final String ORDER_ALREADY_FREEZE                 = "ORDER_ALREADY_FREEZE";
 	
 	public static final String ORDER_ALREADY_REVOKE					= "ORDER_ALREADY_REVOKE";
+	
+	public static final String ORDER_NOT_EXIST						= "ORDER_NOT_EXIST";
 }

+ 20 - 0
src/main/java/com/goafanti/common/dao/OrganizationManagementMapper.java

@@ -6,6 +6,7 @@ import com.goafanti.organization.bo.OrganizationListOut;
 import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.common.model.OrganizationManagement;
 import com.goafanti.common.model.OrganizationManagementExample;
+
 import org.apache.ibatis.annotations.Param;
 
 public interface OrganizationManagementMapper {
@@ -111,4 +112,23 @@ public interface OrganizationManagementMapper {
 	String selectDepNoById(String id);
 	
 	int selectUserById(String id);
+	
+	/**
+	 * 查询下级集合
+	 * @param superIds
+	 * @return
+	 */
+	List<OrganizationManagement> selectSubDeps(@Param("superIds")String superIds);
+	/**
+	 * 查询当前集合
+	 * @param adminId
+	 * @return
+	 */
+	List<OrganizationManagement> selectCurrentDeps(@Param("aid")String aid);
+	
+	/**
+	 * 查询所有部门
+	 * @return
+	 */
+	List<OrganizationManagement> selectAllDeps();
 }

+ 30 - 11
src/main/java/com/goafanti/common/dao/TOrderMapper.java

@@ -13,67 +13,85 @@ public interface TOrderMapper {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	long countByExample(TOrderExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	int deleteByExample(TOrderExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	int deleteByPrimaryKey(String orderNo);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	int insert(TOrder record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	int insertSelective(TOrder record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
+	 */
+	List<TOrder> selectByExampleWithBLOBs(TOrderExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	List<TOrder> selectByExample(TOrderExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	TOrder selectByPrimaryKey(String orderNo);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	int updateByExampleSelective(@Param("record") TOrder record, @Param("example") TOrderExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
+	 */
+	int updateByExampleWithBLOBs(@Param("record") TOrder record, @Param("example") TOrderExample example);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	int updateByExample(@Param("record") TOrder record, @Param("example") TOrderExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	int updateByPrimaryKeySelective(TOrder record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
+	 */
+	int updateByPrimaryKeyWithBLOBs(TOrder record);
+
+	/**
+	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	int updateByPrimaryKey(TOrder record);
 
@@ -98,4 +116,5 @@ public interface TOrderMapper {
 	 * @return
 	 */
 	ServiceOrderDetailBo selectServiceOrderDetail(String orderNo);
+
 }

+ 14 - 0
src/main/java/com/goafanti/common/mapper/OrganizationManagementMapper.xml

@@ -569,4 +569,18 @@
 		where
 		department_id=#{id,jdbcType=VARCHAR}
 	</select>
+	<!-- 查询当前层级 -->
+	<select id="selectCurrentDeps" parameterType="java.lang.String" resultMap="BaseResultMap">
+		select id,name,dep_no from department_management where manager_id = #{aid,jdbcType=VARCHAR}
+			union all
+		select id,name,dep_no from department_management where id = (select department_id from admin where id = #{aid,jdbcType=VARCHAR})
+	</select>
+	<!-- 查询下一层级  -->
+	<select id="selectSubDeps"  parameterType="java.lang.String" resultMap="BaseResultMap">
+		select id,name,dep_no from department_management where super_id in #{superIds,jdbcType=VARCHAR} 
+	</select>
+	<!-- 查询所有 -->
+	<select id="selectAllDeps" resultMap="BaseResultMap">
+		select id,name,dep_no from department_management
+	</select>
 </mapper>

+ 265 - 28
src/main/java/com/goafanti/common/mapper/TOrderMapper.xml

@@ -5,7 +5,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     <id column="order_no" jdbcType="VARCHAR" property="orderNo" />
     <result column="order_type" jdbcType="INTEGER" property="orderType" />
@@ -41,11 +41,19 @@
     <result column="set_up_time" jdbcType="TIMESTAMP" property="setUpTime" />
     <result column="settlement_time" jdbcType="TIMESTAMP" property="settlementTime" />
   </resultMap>
+  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.goafanti.common.model.TOrder">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
+    -->
+    <result column="contract_picture_url" jdbcType="LONGVARCHAR" property="contractPictureUrl" />
+  </resultMap>
   <sql id="Example_Where_Clause">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     <where>
       <foreach collection="oredCriteria" item="criteria" separator="or">
@@ -79,7 +87,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     <where>
       <foreach collection="example.oredCriteria" item="criteria" separator="or">
@@ -113,7 +121,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     order_no, order_type, creater, create_time, update_time, buyer_id, seller_id, first_payment, 
     order_amount, brokerage_amount, sign_first_payment, actually_first_payment, sign_total_amount, 
@@ -122,11 +130,40 @@
     order_channel, approval, order_remarks, delete_sign, salesman_id, finance_id, technician_id, 
     confirm_time, sign_time, set_up_time, settlement_time
   </sql>
+  <sql id="Blob_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
+    -->
+    contract_picture_url
+  </sql>
+  <select id="selectByExampleWithBLOBs" parameterType="com.goafanti.common.model.TOrderExample" resultMap="ResultMapWithBLOBs">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    ,
+    <include refid="Blob_Column_List" />
+    from t_order
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
   <select id="selectByExample" parameterType="com.goafanti.common.model.TOrderExample" resultMap="BaseResultMap">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     select
     <if test="distinct">
@@ -141,14 +178,16 @@
       order by ${orderByClause}
     </if>
   </select>
-  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     select 
     <include refid="Base_Column_List" />
+    ,
+    <include refid="Blob_Column_List" />
     from t_order
     where order_no = #{orderNo,jdbcType=VARCHAR}
   </select>
@@ -156,7 +195,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     delete from t_order
     where order_no = #{orderNo,jdbcType=VARCHAR}
@@ -165,7 +204,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     delete from t_order
     <if test="_parameter != null">
@@ -176,7 +215,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     insert into t_order (order_no, order_type, creater, 
       create_time, update_time, buyer_id, 
@@ -189,7 +228,8 @@
       approval, order_remarks, delete_sign, 
       salesman_id, finance_id, technician_id, 
       confirm_time, sign_time, set_up_time, 
-      settlement_time)
+      settlement_time, contract_picture_url
+      )
     values (#{orderNo,jdbcType=VARCHAR}, #{orderType,jdbcType=INTEGER}, #{creater,jdbcType=VARCHAR}, 
       #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{buyerId,jdbcType=VARCHAR}, 
       #{sellerId,jdbcType=VARCHAR}, #{firstPayment,jdbcType=DECIMAL}, #{orderAmount,jdbcType=DECIMAL}, 
@@ -201,13 +241,14 @@
       #{approval,jdbcType=INTEGER}, #{orderRemarks,jdbcType=VARCHAR}, #{deleteSign,jdbcType=INTEGER}, 
       #{salesmanId,jdbcType=VARCHAR}, #{financeId,jdbcType=VARCHAR}, #{technicianId,jdbcType=VARCHAR}, 
       #{confirmTime,jdbcType=TIMESTAMP}, #{signTime,jdbcType=TIMESTAMP}, #{setUpTime,jdbcType=TIMESTAMP}, 
-      #{settlementTime,jdbcType=TIMESTAMP})
+      #{settlementTime,jdbcType=TIMESTAMP}, #{contractPictureUrl,jdbcType=LONGVARCHAR}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrder">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     insert into t_order
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -310,6 +351,9 @@
       <if test="settlementTime != null">
         settlement_time,
       </if>
+      <if test="contractPictureUrl != null">
+        contract_picture_url,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="orderNo != null">
@@ -411,13 +455,16 @@
       <if test="settlementTime != null">
         #{settlementTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="contractPictureUrl != null">
+        #{contractPictureUrl,jdbcType=LONGVARCHAR},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.goafanti.common.model.TOrderExample" resultType="java.lang.Long">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     select count(*) from t_order
     <if test="_parameter != null">
@@ -428,7 +475,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     update t_order
     <set>
@@ -531,16 +578,64 @@
       <if test="record.settlementTime != null">
         settlement_time = #{record.settlementTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="record.contractPictureUrl != null">
+        contract_picture_url = #{record.contractPictureUrl,jdbcType=LONGVARCHAR},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
   </update>
+  <update id="updateByExampleWithBLOBs" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
+    -->
+    update t_order
+    set order_no = #{record.orderNo,jdbcType=VARCHAR},
+      order_type = #{record.orderType,jdbcType=INTEGER},
+      creater = #{record.creater,jdbcType=VARCHAR},
+      create_time = #{record.createTime,jdbcType=TIMESTAMP},
+      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
+      buyer_id = #{record.buyerId,jdbcType=VARCHAR},
+      seller_id = #{record.sellerId,jdbcType=VARCHAR},
+      first_payment = #{record.firstPayment,jdbcType=DECIMAL},
+      order_amount = #{record.orderAmount,jdbcType=DECIMAL},
+      brokerage_amount = #{record.brokerageAmount,jdbcType=DECIMAL},
+      sign_first_payment = #{record.signFirstPayment,jdbcType=DECIMAL},
+      actually_first_payment = #{record.actuallyFirstPayment,jdbcType=DECIMAL},
+      sign_total_amount = #{record.signTotalAmount,jdbcType=DECIMAL},
+      actually_total_amount = #{record.actuallyTotalAmount,jdbcType=DECIMAL},
+      sign_brokerage_amount = #{record.signBrokerageAmount,jdbcType=DECIMAL},
+      actually_brokerage_amount = #{record.actuallyBrokerageAmount,jdbcType=DECIMAL},
+      sign_withdraw_amount = #{record.signWithdrawAmount,jdbcType=DECIMAL},
+      actually_withdraw_amount = #{record.actuallyWithdrawAmount,jdbcType=DECIMAL},
+      order_stage = #{record.orderStage,jdbcType=INTEGER},
+      project_stage = #{record.projectStage,jdbcType=INTEGER},
+      order_status = #{record.orderStatus,jdbcType=INTEGER},
+      liquidation_status = #{record.liquidationStatus,jdbcType=INTEGER},
+      order_channel = #{record.orderChannel,jdbcType=INTEGER},
+      approval = #{record.approval,jdbcType=INTEGER},
+      order_remarks = #{record.orderRemarks,jdbcType=VARCHAR},
+      delete_sign = #{record.deleteSign,jdbcType=INTEGER},
+      salesman_id = #{record.salesmanId,jdbcType=VARCHAR},
+      finance_id = #{record.financeId,jdbcType=VARCHAR},
+      technician_id = #{record.technicianId,jdbcType=VARCHAR},
+      confirm_time = #{record.confirmTime,jdbcType=TIMESTAMP},
+      sign_time = #{record.signTime,jdbcType=TIMESTAMP},
+      set_up_time = #{record.setUpTime,jdbcType=TIMESTAMP},
+      settlement_time = #{record.settlementTime,jdbcType=TIMESTAMP},
+      contract_picture_url = #{record.contractPictureUrl,jdbcType=LONGVARCHAR}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
   <update id="updateByExample" parameterType="map">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     update t_order
     set order_no = #{record.orderNo,jdbcType=VARCHAR},
@@ -584,7 +679,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     update t_order
     <set>
@@ -684,14 +779,59 @@
       <if test="settlementTime != null">
         settlement_time = #{settlementTime,jdbcType=TIMESTAMP},
       </if>
+      <if test="contractPictureUrl != null">
+        contract_picture_url = #{contractPictureUrl,jdbcType=LONGVARCHAR},
+      </if>
     </set>
     where order_no = #{orderNo,jdbcType=VARCHAR}
   </update>
+  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.goafanti.common.model.TOrder">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
+    -->
+    update t_order
+    set order_type = #{orderType,jdbcType=INTEGER},
+      creater = #{creater,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      update_time = #{updateTime,jdbcType=TIMESTAMP},
+      buyer_id = #{buyerId,jdbcType=VARCHAR},
+      seller_id = #{sellerId,jdbcType=VARCHAR},
+      first_payment = #{firstPayment,jdbcType=DECIMAL},
+      order_amount = #{orderAmount,jdbcType=DECIMAL},
+      brokerage_amount = #{brokerageAmount,jdbcType=DECIMAL},
+      sign_first_payment = #{signFirstPayment,jdbcType=DECIMAL},
+      actually_first_payment = #{actuallyFirstPayment,jdbcType=DECIMAL},
+      sign_total_amount = #{signTotalAmount,jdbcType=DECIMAL},
+      actually_total_amount = #{actuallyTotalAmount,jdbcType=DECIMAL},
+      sign_brokerage_amount = #{signBrokerageAmount,jdbcType=DECIMAL},
+      actually_brokerage_amount = #{actuallyBrokerageAmount,jdbcType=DECIMAL},
+      sign_withdraw_amount = #{signWithdrawAmount,jdbcType=DECIMAL},
+      actually_withdraw_amount = #{actuallyWithdrawAmount,jdbcType=DECIMAL},
+      order_stage = #{orderStage,jdbcType=INTEGER},
+      project_stage = #{projectStage,jdbcType=INTEGER},
+      order_status = #{orderStatus,jdbcType=INTEGER},
+      liquidation_status = #{liquidationStatus,jdbcType=INTEGER},
+      order_channel = #{orderChannel,jdbcType=INTEGER},
+      approval = #{approval,jdbcType=INTEGER},
+      order_remarks = #{orderRemarks,jdbcType=VARCHAR},
+      delete_sign = #{deleteSign,jdbcType=INTEGER},
+      salesman_id = #{salesmanId,jdbcType=VARCHAR},
+      finance_id = #{financeId,jdbcType=VARCHAR},
+      technician_id = #{technicianId,jdbcType=VARCHAR},
+      confirm_time = #{confirmTime,jdbcType=TIMESTAMP},
+      sign_time = #{signTime,jdbcType=TIMESTAMP},
+      set_up_time = #{setUpTime,jdbcType=TIMESTAMP},
+      settlement_time = #{settlementTime,jdbcType=TIMESTAMP},
+      contract_picture_url = #{contractPictureUrl,jdbcType=LONGVARCHAR}
+    where order_no = #{orderNo,jdbcType=VARCHAR}
+  </update>
   <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.TOrder">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Sat Jan 20 15:11:27 CST 2018.
+      This element was generated on Mon Jan 22 19:15:05 CST 2018.
     -->
     update t_order
     set order_type = #{orderType,jdbcType=INTEGER},
@@ -843,7 +983,7 @@
 			a.order_no as orderNo,
 			a.order_type as orderType,
 			date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
-			a.order_amount as orderAmount,
+			a.sign_total_amount as signTotalAmount,
 			a.order_status as orderStatus,
 			a.order_stage as orderStage,
 			a.liquidation_status as liquidationStatus,
@@ -852,13 +992,15 @@
 			b.nickname as buyerName,
 			c.name as salesmanName,
 			d.name as financeName,
-			e.name as technicianName
+			e.name as technicianName,
+			f.departmentName
 		from
 			t_order a left join user b on
 			a.buyer_id = b.id left join admin c on
 			a.salesman_id = c.id left join admin d on
 			a.finance_id = d.id left join admin e on
-			a.technician_id = e.id
+			a.technician_id = e.id left join department_management f on 
+			d.department_id = f.id
 		where a.type = 0
 		<if test="salesmanId != null">
 			and a.salesman_id = #{a.salesmanId,jdbcType=VARCHAR}
@@ -881,18 +1023,35 @@
 		<if test="orderStatus != null">
 			and a.order_status = #{orderStatus,jdbcType=INTEGER}
 		</if>
-		<if test="orderStage != null">
-			and a.order_stage = #{orderStage,jdbcType=INTEGER}
+		<if test="projectStage != null">
+			and a.project_stage = #{projectStage,jdbcType=INTEGER}
 		</if>
 		<if test="liquidationStatus != null">
 			and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
 		</if>
+		<if test="orderChannel != null">
+			and a.orderChannel = #{orderChannel,jdbcType=INTEGER}
+		</if>
 		<if test="approval != null">
 			and a.approval = #{approval,jdbcType=INTEGER}
 		</if>
-		<if test="orderChannel != null">
-			and.orderChannel =#{orderChannel,jdbcType=INTEGER}
+		<!-- 特殊处理字段 开始 -->
+		<if test="intention == 1">
+			and a.order_stage = 0
+		</if>
+		<if test="formal == 1">
+			and a.order_stage != 0
 		</if>
+		<if test="approvalHistory == 0">
+			and a.approval = 1
+		</if>
+		<if test="approvalHistory == 1">
+			and a.approval != 0
+		</if>
+		<if test="depIds != null and depIds != ''">
+			and f.id in #{depIds,jdbcType=VARCHAR}
+		</if>
+		<!-- 特殊处理字段结束 -->
 		<if test="page_sql != null">
 			${page_sql}
 		</if>
@@ -905,7 +1064,8 @@
 			a.buyer_id = b.id left join admin c on
 			a.salesman_id = c.id left join admin d on
 			a.finance_id = d.id left join admin e on
-			a.technician_id = e.id
+			a.technician_id = e.id left join department_management f on 
+			d.department_id = f.id
 		where a.type = 0
 		<if test="salesmanId != null">
 			and a.salesman_id = #{a.salesmanId,jdbcType=VARCHAR}
@@ -940,12 +1100,29 @@
 		<if test="liquidationStatus != null">
 			and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
 		</if>
+		<if test="orderChannel != null">
+			and.orderChannel =#{orderChannel,jdbcType=INTEGER}
+		</if>
 		<if test="approval != null">
 			and a.approval = #{approval,jdbcType=INTEGER}
 		</if>
-		<if test="orderChannel != null">
-			and.orderChannel =#{orderChannel,jdbcType=INTEGER}
+		<!-- 特殊处理字段 开始 -->
+		<if test="intention == 1">
+			and a.order_stage = 0
+		</if>
+		<if test="formal == 1">
+			and a.order_stage != 0
+		</if>
+		<if test="approvalHistory == 0">
+			and a.approval = 1
+		</if>
+		<if test="approvalHistory == 1">
+			and a.approval != 0
 		</if>
+		<if test="depIds != null and depIds != ''">
+			and f.id in #{depIds,jdbcType=VARCHAR}
+		</if>
+		<!-- 特殊处理字段结束 -->
   </select>
   
   <select id="selectServiceOrderDetail" parameterType="java.lang.String" resultType="com.goafanti.order.bo.ServiceOrderDetailBo">
@@ -963,6 +1140,7 @@
 			a.approval,
 			a.order_remarks as orderRemarks,
 			a.order_channel as orderChannel,
+			a.contract_picture_url as contractPictureUrl,
 			b.nickname as buyerName,
 			c.name as salesmanName,
 			d.name as financeName,
@@ -975,4 +1153,63 @@
 			a.technician_id = e.id
 		where a.order_no = #{orderNo,jdbcType=STRING}
   </select>
+  
+  <select id="selectPublicOrderByPage" resultType="com.goafanti.order.bo.OrderListBo">
+  		select
+			a.order_no as orderNo,
+			a.order_type as orderType,
+			date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
+			a.order_amount as orderAmount,
+			a.sign_total_amount as signTotalAmount,
+			a.order_status as orderStatus,
+			a.order_stage as orderStage,
+			a.liquidation_status as liquidationStatus,
+			a.order_channel as orderChannel,
+			b.nickname as buyerName
+		from
+			t_order a left join user b on
+			a.buyer_id = b.id 
+		where a.salesman_id is null
+		<if test="startDate != null">
+			and a.create_time &gt; #{a.startDate,jdbcType=TIMESTAMP}
+		</if>
+		<if test="endDate != null">
+			and a.create_time &lt; #{a.endDate,jdbcType=TIMESTAMP}
+		</if>
+		<if test="buyerName != null and buyerName != ''">
+			and b.nickname = #{buyerName,jdbcType=VARCHAR}
+		</if>
+		<if test="orderStatus != null">
+			and a.order_status = #{orderStatus,jdbcType=INTEGER}
+		</if>
+		<if test="orderChannel != null">
+			and a.orderChannel = #{orderChannel,jdbcType=INTEGER}
+		</if>
+		<if test="page_sql != null">
+			${page_sql}
+		</if>
+  </select>
+  <select id="selectPublicOrderCount" resultType="java.lang.Integer">
+  		select
+			count(0)
+		from
+			t_order a left join user b on
+			a.buyer_id = b.id 
+		where a.salesman_id is null
+		<if test="startDate != null">
+			and a.create_time &gt; #{a.startDate,jdbcType=TIMESTAMP}
+		</if>
+		<if test="endDate != null">
+			and a.create_time &lt; #{a.endDate,jdbcType=TIMESTAMP}
+		</if>
+		<if test="buyerName != null and buyerName != ''">
+			and b.nickname = #{buyerName,jdbcType=VARCHAR}
+		</if>
+		<if test="orderStatus != null">
+			and a.order_status = #{orderStatus,jdbcType=INTEGER}
+		</if>
+		<if test="orderChannel != null">
+			and a.orderChannel = #{orderChannel,jdbcType=INTEGER}
+		</if>
+  </select>
 </mapper>

+ 122 - 99
src/main/java/com/goafanti/common/model/TOrder.java

@@ -7,174 +7,179 @@ public class TOrder {
 
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.order_no
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private String orderNo;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.order_type
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Integer orderType;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.creater
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private String creater;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.create_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Date createTime;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.update_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Date updateTime;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.buyer_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private String buyerId;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.seller_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private String sellerId;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.first_payment
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private BigDecimal firstPayment;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.order_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private BigDecimal orderAmount;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.brokerage_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private BigDecimal brokerageAmount;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.sign_first_payment
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private BigDecimal signFirstPayment;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.actually_first_payment
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private BigDecimal actuallyFirstPayment;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.sign_total_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private BigDecimal signTotalAmount;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.actually_total_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private BigDecimal actuallyTotalAmount;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.sign_brokerage_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private BigDecimal signBrokerageAmount;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.actually_brokerage_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private BigDecimal actuallyBrokerageAmount;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.sign_withdraw_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private BigDecimal signWithdrawAmount;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.actually_withdraw_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private BigDecimal actuallyWithdrawAmount;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.order_stage
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Integer orderStage;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.project_stage
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Integer projectStage;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.order_status
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Integer orderStatus;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.liquidation_status
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Integer liquidationStatus;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.order_channel
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Integer orderChannel;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.approval
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Integer approval;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.order_remarks
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private String orderRemarks;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.delete_sign
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Integer deleteSign;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.salesman_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private String salesmanId;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.finance_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private String financeId;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.technician_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private String technicianId;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.confirm_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Date confirmTime;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.sign_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Date signTime;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.set_up_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Date setUpTime;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.settlement_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	private Date settlementTime;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column t_order.contract_picture_url
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
+	 */
+	private String contractPictureUrl;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.order_no
 	 * @return  the value of t_order.order_no
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public String getOrderNo() {
 		return orderNo;
@@ -183,7 +188,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.order_no
 	 * @param orderNo  the value for t_order.order_no
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setOrderNo(String orderNo) {
 		this.orderNo = orderNo;
@@ -192,7 +197,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.order_type
 	 * @return  the value of t_order.order_type
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Integer getOrderType() {
 		return orderType;
@@ -201,7 +206,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.order_type
 	 * @param orderType  the value for t_order.order_type
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setOrderType(Integer orderType) {
 		this.orderType = orderType;
@@ -210,7 +215,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.creater
 	 * @return  the value of t_order.creater
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public String getCreater() {
 		return creater;
@@ -219,7 +224,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.creater
 	 * @param creater  the value for t_order.creater
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setCreater(String creater) {
 		this.creater = creater;
@@ -228,7 +233,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.create_time
 	 * @return  the value of t_order.create_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Date getCreateTime() {
 		return createTime;
@@ -237,7 +242,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.create_time
 	 * @param createTime  the value for t_order.create_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setCreateTime(Date createTime) {
 		this.createTime = createTime;
@@ -246,7 +251,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.update_time
 	 * @return  the value of t_order.update_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Date getUpdateTime() {
 		return updateTime;
@@ -255,7 +260,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.update_time
 	 * @param updateTime  the value for t_order.update_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setUpdateTime(Date updateTime) {
 		this.updateTime = updateTime;
@@ -264,7 +269,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.buyer_id
 	 * @return  the value of t_order.buyer_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public String getBuyerId() {
 		return buyerId;
@@ -273,7 +278,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.buyer_id
 	 * @param buyerId  the value for t_order.buyer_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setBuyerId(String buyerId) {
 		this.buyerId = buyerId;
@@ -282,7 +287,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.seller_id
 	 * @return  the value of t_order.seller_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public String getSellerId() {
 		return sellerId;
@@ -291,7 +296,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.seller_id
 	 * @param sellerId  the value for t_order.seller_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setSellerId(String sellerId) {
 		this.sellerId = sellerId;
@@ -300,7 +305,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.first_payment
 	 * @return  the value of t_order.first_payment
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public BigDecimal getFirstPayment() {
 		return firstPayment;
@@ -309,7 +314,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.first_payment
 	 * @param firstPayment  the value for t_order.first_payment
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setFirstPayment(BigDecimal firstPayment) {
 		this.firstPayment = firstPayment;
@@ -318,7 +323,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.order_amount
 	 * @return  the value of t_order.order_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public BigDecimal getOrderAmount() {
 		return orderAmount;
@@ -327,7 +332,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.order_amount
 	 * @param orderAmount  the value for t_order.order_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setOrderAmount(BigDecimal orderAmount) {
 		this.orderAmount = orderAmount;
@@ -336,7 +341,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.brokerage_amount
 	 * @return  the value of t_order.brokerage_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public BigDecimal getBrokerageAmount() {
 		return brokerageAmount;
@@ -345,7 +350,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.brokerage_amount
 	 * @param brokerageAmount  the value for t_order.brokerage_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setBrokerageAmount(BigDecimal brokerageAmount) {
 		this.brokerageAmount = brokerageAmount;
@@ -354,7 +359,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.sign_first_payment
 	 * @return  the value of t_order.sign_first_payment
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public BigDecimal getSignFirstPayment() {
 		return signFirstPayment;
@@ -363,7 +368,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.sign_first_payment
 	 * @param signFirstPayment  the value for t_order.sign_first_payment
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setSignFirstPayment(BigDecimal signFirstPayment) {
 		this.signFirstPayment = signFirstPayment;
@@ -372,7 +377,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.actually_first_payment
 	 * @return  the value of t_order.actually_first_payment
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public BigDecimal getActuallyFirstPayment() {
 		return actuallyFirstPayment;
@@ -381,7 +386,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.actually_first_payment
 	 * @param actuallyFirstPayment  the value for t_order.actually_first_payment
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setActuallyFirstPayment(BigDecimal actuallyFirstPayment) {
 		this.actuallyFirstPayment = actuallyFirstPayment;
@@ -390,7 +395,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.sign_total_amount
 	 * @return  the value of t_order.sign_total_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public BigDecimal getSignTotalAmount() {
 		return signTotalAmount;
@@ -399,7 +404,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.sign_total_amount
 	 * @param signTotalAmount  the value for t_order.sign_total_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setSignTotalAmount(BigDecimal signTotalAmount) {
 		this.signTotalAmount = signTotalAmount;
@@ -408,7 +413,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.actually_total_amount
 	 * @return  the value of t_order.actually_total_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public BigDecimal getActuallyTotalAmount() {
 		return actuallyTotalAmount;
@@ -417,7 +422,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.actually_total_amount
 	 * @param actuallyTotalAmount  the value for t_order.actually_total_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setActuallyTotalAmount(BigDecimal actuallyTotalAmount) {
 		this.actuallyTotalAmount = actuallyTotalAmount;
@@ -426,7 +431,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.sign_brokerage_amount
 	 * @return  the value of t_order.sign_brokerage_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public BigDecimal getSignBrokerageAmount() {
 		return signBrokerageAmount;
@@ -435,7 +440,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.sign_brokerage_amount
 	 * @param signBrokerageAmount  the value for t_order.sign_brokerage_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setSignBrokerageAmount(BigDecimal signBrokerageAmount) {
 		this.signBrokerageAmount = signBrokerageAmount;
@@ -444,7 +449,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.actually_brokerage_amount
 	 * @return  the value of t_order.actually_brokerage_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public BigDecimal getActuallyBrokerageAmount() {
 		return actuallyBrokerageAmount;
@@ -453,7 +458,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.actually_brokerage_amount
 	 * @param actuallyBrokerageAmount  the value for t_order.actually_brokerage_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setActuallyBrokerageAmount(BigDecimal actuallyBrokerageAmount) {
 		this.actuallyBrokerageAmount = actuallyBrokerageAmount;
@@ -462,7 +467,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.sign_withdraw_amount
 	 * @return  the value of t_order.sign_withdraw_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public BigDecimal getSignWithdrawAmount() {
 		return signWithdrawAmount;
@@ -471,7 +476,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.sign_withdraw_amount
 	 * @param signWithdrawAmount  the value for t_order.sign_withdraw_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setSignWithdrawAmount(BigDecimal signWithdrawAmount) {
 		this.signWithdrawAmount = signWithdrawAmount;
@@ -480,7 +485,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.actually_withdraw_amount
 	 * @return  the value of t_order.actually_withdraw_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public BigDecimal getActuallyWithdrawAmount() {
 		return actuallyWithdrawAmount;
@@ -489,7 +494,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.actually_withdraw_amount
 	 * @param actuallyWithdrawAmount  the value for t_order.actually_withdraw_amount
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setActuallyWithdrawAmount(BigDecimal actuallyWithdrawAmount) {
 		this.actuallyWithdrawAmount = actuallyWithdrawAmount;
@@ -498,7 +503,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.order_stage
 	 * @return  the value of t_order.order_stage
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Integer getOrderStage() {
 		return orderStage;
@@ -507,7 +512,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.order_stage
 	 * @param orderStage  the value for t_order.order_stage
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setOrderStage(Integer orderStage) {
 		this.orderStage = orderStage;
@@ -516,7 +521,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.project_stage
 	 * @return  the value of t_order.project_stage
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Integer getProjectStage() {
 		return projectStage;
@@ -525,7 +530,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.project_stage
 	 * @param projectStage  the value for t_order.project_stage
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setProjectStage(Integer projectStage) {
 		this.projectStage = projectStage;
@@ -534,7 +539,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.order_status
 	 * @return  the value of t_order.order_status
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Integer getOrderStatus() {
 		return orderStatus;
@@ -543,7 +548,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.order_status
 	 * @param orderStatus  the value for t_order.order_status
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setOrderStatus(Integer orderStatus) {
 		this.orderStatus = orderStatus;
@@ -552,7 +557,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.liquidation_status
 	 * @return  the value of t_order.liquidation_status
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Integer getLiquidationStatus() {
 		return liquidationStatus;
@@ -561,7 +566,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.liquidation_status
 	 * @param liquidationStatus  the value for t_order.liquidation_status
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setLiquidationStatus(Integer liquidationStatus) {
 		this.liquidationStatus = liquidationStatus;
@@ -570,7 +575,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.order_channel
 	 * @return  the value of t_order.order_channel
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Integer getOrderChannel() {
 		return orderChannel;
@@ -579,7 +584,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.order_channel
 	 * @param orderChannel  the value for t_order.order_channel
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setOrderChannel(Integer orderChannel) {
 		this.orderChannel = orderChannel;
@@ -588,7 +593,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.approval
 	 * @return  the value of t_order.approval
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Integer getApproval() {
 		return approval;
@@ -597,7 +602,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.approval
 	 * @param approval  the value for t_order.approval
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setApproval(Integer approval) {
 		this.approval = approval;
@@ -606,7 +611,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.order_remarks
 	 * @return  the value of t_order.order_remarks
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public String getOrderRemarks() {
 		return orderRemarks;
@@ -615,7 +620,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.order_remarks
 	 * @param orderRemarks  the value for t_order.order_remarks
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setOrderRemarks(String orderRemarks) {
 		this.orderRemarks = orderRemarks;
@@ -624,7 +629,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.delete_sign
 	 * @return  the value of t_order.delete_sign
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Integer getDeleteSign() {
 		return deleteSign;
@@ -633,7 +638,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.delete_sign
 	 * @param deleteSign  the value for t_order.delete_sign
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setDeleteSign(Integer deleteSign) {
 		this.deleteSign = deleteSign;
@@ -642,7 +647,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.salesman_id
 	 * @return  the value of t_order.salesman_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public String getSalesmanId() {
 		return salesmanId;
@@ -651,7 +656,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.salesman_id
 	 * @param salesmanId  the value for t_order.salesman_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setSalesmanId(String salesmanId) {
 		this.salesmanId = salesmanId;
@@ -660,7 +665,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.finance_id
 	 * @return  the value of t_order.finance_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public String getFinanceId() {
 		return financeId;
@@ -669,7 +674,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.finance_id
 	 * @param financeId  the value for t_order.finance_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setFinanceId(String financeId) {
 		this.financeId = financeId;
@@ -678,7 +683,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.technician_id
 	 * @return  the value of t_order.technician_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public String getTechnicianId() {
 		return technicianId;
@@ -687,7 +692,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.technician_id
 	 * @param technicianId  the value for t_order.technician_id
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setTechnicianId(String technicianId) {
 		this.technicianId = technicianId;
@@ -696,7 +701,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.confirm_time
 	 * @return  the value of t_order.confirm_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Date getConfirmTime() {
 		return confirmTime;
@@ -705,7 +710,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.confirm_time
 	 * @param confirmTime  the value for t_order.confirm_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setConfirmTime(Date confirmTime) {
 		this.confirmTime = confirmTime;
@@ -714,7 +719,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.sign_time
 	 * @return  the value of t_order.sign_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Date getSignTime() {
 		return signTime;
@@ -723,7 +728,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.sign_time
 	 * @param signTime  the value for t_order.sign_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setSignTime(Date signTime) {
 		this.signTime = signTime;
@@ -732,7 +737,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.set_up_time
 	 * @return  the value of t_order.set_up_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Date getSetUpTime() {
 		return setUpTime;
@@ -741,7 +746,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.set_up_time
 	 * @param setUpTime  the value for t_order.set_up_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setSetUpTime(Date setUpTime) {
 		this.setUpTime = setUpTime;
@@ -750,7 +755,7 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.settlement_time
 	 * @return  the value of t_order.settlement_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Date getSettlementTime() {
 		return settlementTime;
@@ -759,9 +764,27 @@ public class TOrder {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.settlement_time
 	 * @param settlementTime  the value for t_order.settlement_time
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setSettlementTime(Date settlementTime) {
 		this.settlementTime = settlementTime;
 	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column t_order.contract_picture_url
+	 * @return  the value of t_order.contract_picture_url
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
+	 */
+	public String getContractPictureUrl() {
+		return contractPictureUrl;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column t_order.contract_picture_url
+	 * @param contractPictureUrl  the value for t_order.contract_picture_url
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
+	 */
+	public void setContractPictureUrl(String contractPictureUrl) {
+		this.contractPictureUrl = contractPictureUrl;
+	}
 }

+ 16 - 16
src/main/java/com/goafanti/common/model/TOrderExample.java

@@ -8,23 +8,23 @@ import java.util.List;
 public class TOrderExample {
     /**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	protected String orderByClause;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	protected boolean distinct;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	protected List<Criteria> oredCriteria;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public TOrderExample() {
 		oredCriteria = new ArrayList<Criteria>();
@@ -32,7 +32,7 @@ public class TOrderExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setOrderByClause(String orderByClause) {
 		this.orderByClause = orderByClause;
@@ -40,7 +40,7 @@ public class TOrderExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public String getOrderByClause() {
 		return orderByClause;
@@ -48,7 +48,7 @@ public class TOrderExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void setDistinct(boolean distinct) {
 		this.distinct = distinct;
@@ -56,7 +56,7 @@ public class TOrderExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public boolean isDistinct() {
 		return distinct;
@@ -64,7 +64,7 @@ public class TOrderExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public List<Criteria> getOredCriteria() {
 		return oredCriteria;
@@ -72,7 +72,7 @@ public class TOrderExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void or(Criteria criteria) {
 		oredCriteria.add(criteria);
@@ -80,7 +80,7 @@ public class TOrderExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Criteria or() {
 		Criteria criteria = createCriteriaInternal();
@@ -90,7 +90,7 @@ public class TOrderExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public Criteria createCriteria() {
 		Criteria criteria = createCriteriaInternal();
@@ -102,7 +102,7 @@ public class TOrderExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	protected Criteria createCriteriaInternal() {
 		Criteria criteria = new Criteria();
@@ -111,7 +111,7 @@ public class TOrderExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public void clear() {
 		oredCriteria.clear();
@@ -121,7 +121,7 @@ public class TOrderExample {
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	protected abstract static class GeneratedCriteria {
 		protected List<Criterion> criteria;
@@ -2227,7 +2227,7 @@ public class TOrderExample {
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table t_order
-	 * @mbg.generated  Sat Jan 20 15:11:27 CST 2018
+	 * @mbg.generated  Mon Jan 22 19:15:05 CST 2018
 	 */
 	public static class Criterion {
 		private String condition;

+ 18 - 10
src/main/java/com/goafanti/order/bo/OrderListBo.java

@@ -11,9 +11,9 @@ public class OrderListBo {
 	/** 订单创建时间 **/
 	private String createTime;
 	/** 合同首付金额 **/
-	private String expertFirstPayment;
+	private String signFirstPayment;
 	/** 合同订单金额 **/
-	private String expertTotalAmount;
+	private String signTotalAmount;
 	/** 买方姓名 **/
 	private String buyerName;
 	/** 卖方姓名 **/
@@ -34,6 +34,8 @@ public class OrderListBo {
 	private String technicianName;
 	/** 关联部门名称 **/
 	private String departmentName;
+	/** 项目状态 **/
+	private Integer projectStage;
 	public String getOrderNo() {
 		return orderNo;
 	}
@@ -46,17 +48,17 @@ public class OrderListBo {
 	public void setCreateTime(String createTime) {
 		this.createTime = createTime;
 	}
-	public String getExpertFirstPayment() {
-		return expertFirstPayment;
+	public String getSignFirstPayment() {
+		return signFirstPayment;
 	}
-	public void setExpertFirstPayment(String expertFirstPayment) {
-		this.expertFirstPayment = expertFirstPayment;
+	public void setSignFirstPayment(String signFirstPayment) {
+		this.signFirstPayment = signFirstPayment;
 	}
-	public String getExpertTotalAmount() {
-		return expertTotalAmount;
+	public String getSignTotalAmount() {
+		return signTotalAmount;
 	}
-	public void setExpertTotalAmount(String expertTotalAmount) {
-		this.expertTotalAmount = expertTotalAmount;
+	public void setSignTotalAmount(String signTotalAmount) {
+		this.signTotalAmount = signTotalAmount;
 	}
 	public String getBuyerName() {
 		return buyerName;
@@ -118,4 +120,10 @@ public class OrderListBo {
 	public void setDepartmentName(String departmentName) {
 		this.departmentName = departmentName;
 	}
+	public Integer getProjectStage() {
+		return projectStage;
+	}
+	public void setProjectStage(Integer projectStage) {
+		this.projectStage = projectStage;
+	}
 }

+ 8 - 0
src/main/java/com/goafanti/order/bo/ServiceOrderDetailBo.java

@@ -13,6 +13,8 @@ public class ServiceOrderDetailBo extends OrderListBo{
 	private String orderAmount;
 	/** 订单留言 **/
 	private String orderRemarks;
+	/** 图片地址 **/
+	private String contractPictureUrl;
 	/** 可操作内容 **/
 	private OperatorActive operatorActive;
 	public String getSignTime() {
@@ -51,6 +53,12 @@ public class ServiceOrderDetailBo extends OrderListBo{
 	public void setOrderRemarks(String orderRemarks) {
 		this.orderRemarks = orderRemarks;
 	}
+	public String getContractPictureUrl() {
+		return contractPictureUrl;
+	}
+	public void setContractPictureUrl(String contractPictureUrl) {
+		this.contractPictureUrl = contractPictureUrl;
+	}
 	public OperatorActive getOperatorActive() {
 		return operatorActive;
 	}

+ 91 - 6
src/main/java/com/goafanti/order/controller/AdminOrderApiController.java

@@ -1,6 +1,7 @@
 package com.goafanti.order.controller;
 
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -11,6 +12,7 @@ import com.goafanti.business.service.BusinessProjectService;
 import com.goafanti.common.bo.Result;
 import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.CertifyApiController;
+import com.goafanti.order.bo.OrderListBo;
 import com.goafanti.order.service.OrderService;
 
 @RestController
@@ -21,16 +23,14 @@ public class AdminOrderApiController extends CertifyApiController {
 	@Resource
 	private BusinessProjectService businessProjectServiceImpl;
 	/**
-	 * 服务订单
+	 * 我的服务订单
 	 * @return
 	 */
 	@RequestMapping(value="/listServiceOrder" ,method = RequestMethod.POST)
-	public Result listServiceOrder(String buyerName, String startDate, String endDate,
-			String confirm, String orderStatus, String liquidationStatus, String projectStage, String approval,
-			String orderChannel,Integer pageNo, Integer pageSize,Integer currentViewer){
+	public Result listServiceOrder(OrderListBo bo,String startDate,String endDate,Integer intention,Integer formal,
+			Integer pageNo, Integer pageSize){
 		Result res = new Result();
-		res.setData(orderServiceImpl.selectServiceOrderList(buyerName, startDate, endDate, confirm, orderStatus, liquidationStatus, projectStage, 
-				approval, orderChannel, pageNo, pageSize,currentViewer));
+		res.setData(orderServiceImpl.selectServiceOrder(bo, startDate, endDate, intention, formal, pageNo, pageSize));
 		return res;
 	}
 	
@@ -228,4 +228,89 @@ public class AdminOrderApiController extends CertifyApiController {
 		orderServiceImpl.deleteOrderCommodity(detailId);
 		return res;
 	}
+	
+	/**
+	 * 查询分管部门
+	 * @return
+	 */
+	public Result selectMyDaeps(){
+		Result res = new Result();
+			res.setData(orderServiceImpl.selectMyDaeps());
+		return res;
+	}
+	
+	/**
+	 * 部门服务订单
+	 * @return
+	 */
+	@RequestMapping(value="/listDepServiceOrder" ,method = RequestMethod.POST)
+	public Result listDepServiceOrder(OrderListBo bo,String startDate,String endDate,Integer intention,Integer formal,
+			String depIds,Integer pageNo, Integer pageSize){
+		Result res = new Result();
+		res.setData(orderServiceImpl.selectDepServiceOrder(bo, startDate, endDate, intention, formal, depIds, pageNo, pageSize));
+		return res;
+	}
+	
+	/**
+	 * 部门服务订单
+	 * @return
+	 */
+	@RequestMapping(value="/listApprovalServiceOrder" ,method = RequestMethod.POST)
+	public Result listApprovalServiceOrder(OrderListBo bo,String startDate,String endDate,
+			String depIds,Integer approvalHistory,Integer pageNo, Integer pageSize){
+		Result res = new Result();
+		res.setData(orderServiceImpl.selectApprovalServiceOrder(bo, startDate, endDate, depIds, approvalHistory, pageNo, pageSize));
+		return res;
+	}
+	
+	/**
+	 * 创建订单
+	 * @param uid
+	 * @param orderType
+	 * @return
+	 */
+	public Result createServiceOrder(String uid,Integer orderType){
+		Result res = new Result();
+		if(StringUtils.isBlank(uid)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","客户编号"));
+			return res;
+		}
+		if(orderType == null){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","订单类型"));
+			return res;
+		}
+		orderServiceImpl.createServiceOrder(uid,orderType);
+		return res;
+	}
+	
+
+	/** 图片上传 **/
+	@RequestMapping(value = "/uploadOrderImg", method = RequestMethod.POST)
+	public Result uploadCustomerImg(HttpServletRequest req,String sign){
+		Result res = new Result();
+		res.setData(handleFile(res, "/order_file/", false, req, sign));
+		return res;
+	}
+	
+	/** 查询公共订单 **/
+	public Result listPublicOrder(Integer pageNo, Integer pageSize){
+		Result res = new Result();
+		orderServiceImpl.listPublicOrder(pageNo,pageSize);
+		return res;
+	}
+	
+	/** 分配订单到营销员 **/
+	public Result updateAppointSalesman(String orderNo,String salesmanId){
+		Result res = new Result();
+		if(StringUtils.isBlank(orderNo)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","订单编号"));
+			return res;
+		}
+		if(StringUtils.isBlank(salesmanId)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","指定人员编号"));
+			return res;
+		}
+		orderServiceImpl.updateAppointSalesman(orderNo, salesmanId);
+		return res;
+	}
 }

+ 71 - 10
src/main/java/com/goafanti/order/service/OrderService.java

@@ -2,7 +2,9 @@ package com.goafanti.order.service;
 
 import java.math.BigDecimal;
 import java.text.ParseException;
+import java.util.List;
 
+import com.goafanti.common.model.OrganizationManagement;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.order.bo.BillListBo;
 import com.goafanti.order.bo.OrderListBo;
@@ -96,20 +98,21 @@ public interface OrderService {
 	
 	/**
 	 * 
-	 * @param buyerName 订单客户
+	 * @param bo
 	 * @param startDate 开始时间
 	 * @param endDate 结束时间
-	 * @param confirm 是否确认
-	 * @param orderStatus 订单状态
-	 * @param liquidationStatus 清算状态
-	 * @param projectStage 项目进度
-	 * @param approval 是否特批
-	 * @param orderChannel 订单渠道
+	 * @param intention 是否包含意向
+	 * @param formal 是否包含正式
+	 * @param depId 部门id
+	 * @param history 是否包含历史
+	 * @param pageNo 
+	 * @param pageSize
 	 * @return
 	 */
-	Pagination<OrderListBo> selectServiceOrderList(String buyerName,String startDate,String endDate,String confirm,
-			String orderStatus,String liquidationStatus,String projectStage,String approval,String orderChannel,
-			Integer pageNo, Integer pageSize,Integer currentViewer);
+	Pagination<OrderListBo> selectServiceOrder(OrderListBo bo,String startDate,String endDate,Integer intention,Integer formal,
+			Integer pageNo, Integer pageSize);
+	
+
 	
 	/**
 	 * 服务订单详情
@@ -187,4 +190,62 @@ public interface OrderService {
 	 * @return
 	 */
 	int deleteOrderCommodity(String detailId);
+	
+	/**
+	 * 查询分管部门
+	 * @return
+	 */
+	List<OrganizationManagement> selectMyDaeps();
+	
+	/**
+	 * 
+	 * @param bo
+	 * @param startDate 开始时间
+	 * @param endDate 结束时间
+	 * @param intention 是否包含意向
+	 * @param formal 是否包含正式
+	 * @param depIds 部门id
+	 * @param history 是否包含历史
+	 * @param pageNo 
+	 * @param pageSize
+	 * @return
+	 */
+	Pagination<OrderListBo> selectDepServiceOrder(OrderListBo bo,String startDate,String endDate,Integer intention,Integer formal,
+			String depIds,Integer pageNo, Integer pageSize);
+	
+	/**
+	 * 
+	 * @param bo
+	 * @param startDate 开始时间
+	 * @param endDate 结束时间
+	 * @param depIds 部门id
+	 * @param history 是否包含历史
+	 * @param pageNo 
+	 * @param pageSize
+	 * @return
+	 */
+	Pagination<OrderListBo> selectApprovalServiceOrder(OrderListBo bo,String startDate,String endDate,
+			String depIds,Integer approvalHistory,Integer pageNo, Integer pageSize);
+
+	/**
+	 * 创建订单
+	 * @param uid
+	 * @param orderType
+	 * @return
+	 */
+	int createServiceOrder(String uid, Integer orderType);
+
+	/**
+	 * 查询公共订单
+	 * @return
+	 */
+	Pagination<OrderListBo> listPublicOrder(Integer pageNo, Integer pageSize);
+	
+	/**
+	 * 指定的营销员
+	 * @param orderNo
+	 * @param salesmanId
+	 * @return
+	 */
+	int updateAppointSalesman(String orderNo,String salesmanId);
 }

+ 254 - 156
src/main/java/com/goafanti/order/service/impl/OrderServiceImpl.java

@@ -19,17 +19,18 @@ import org.springframework.transaction.annotation.Transactional;
 import com.goafanti.common.bo.Error;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.dao.OrganizationManagementMapper;
 import com.goafanti.common.dao.TOrderBillMapper;
 import com.goafanti.common.dao.TOrderDetailMapper;
 import com.goafanti.common.dao.TOrderMapper;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.Admin;
+import com.goafanti.common.model.OrganizationManagement;
 import com.goafanti.common.model.TOrder;
 import com.goafanti.common.model.TOrderBill;
 import com.goafanti.common.model.TOrderDetail;
 import com.goafanti.common.model.User;
 import com.goafanti.common.utils.DateUtils;
-import com.goafanti.common.utils.DecimalCalculate;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.JDBCIdGenerator;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -67,6 +68,8 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	private JDBCIdGenerator	idGenerator;
 	@Autowired
 	private TOrderBillMapper tOrderBillMapper;
+	@Autowired
+	private OrganizationManagementMapper organizationManagementMapper;
 	
 	private final BigDecimal DEFAULT_FIRST_PAYMENT = new BigDecimal(0);// 默认首付价格
 	private final BigDecimal DEFAULT_COMMODITY_PRICE = new BigDecimal(0);// 默认单价
@@ -113,9 +116,9 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 				: new BigDecimal(Double.valueOf(bo.getCommodityPrice()));
 		BigDecimal commodityFirstPayment = StringUtils.isBlank(bo.getCommodityFirstPayment()) ? DEFAULT_FIRST_PAYMENT 
 				: new BigDecimal(Double.valueOf(bo.getCommodityFirstPayment()));
-		BigDecimal discountPrice = new BigDecimal(DecimalCalculate.mul(commodityPrice.doubleValue(),DEFAULT_COMMODITY_DISCOUNT));
-		BigDecimal discountFirstPayment = new BigDecimal(DecimalCalculate.mul(commodityFirstPayment.doubleValue(),DEFAULT_COMMODITY_DISCOUNT));
-		BigDecimal orderAmount = new BigDecimal(DecimalCalculate.mul(discountPrice.doubleValue(),Double.valueOf(String.valueOf(commodityQuantity))));
+		BigDecimal discountPrice = commodityPrice.multiply(new BigDecimal(DEFAULT_COMMODITY_DISCOUNT));
+		BigDecimal discountFirstPayment = commodityFirstPayment.multiply(new BigDecimal(DEFAULT_COMMODITY_DISCOUNT));
+		BigDecimal orderAmount = discountPrice.multiply(new BigDecimal(commodityQuantity));
 		TOrder tOrder = new TOrder();
 		tOrder.setOrderNo(orderNo);	
 		tOrder.setCreater(DEFAULT_CREATER);
@@ -127,7 +130,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 			tOrder.setBuyerId(TokenManager.getUserId());
 			tOrder.setSellerId(StringUtils.isBlank(bo.getSellerId()) ? DEFAULT_PLATFORM_ID : bo.getSellerId());
 		}
-		tOrder.setBrokerageAmount(new BigDecimal(DecimalCalculate.mul(discountPrice.doubleValue(), DEFAULT_BROKERAGE_PROPORTION)));
+		tOrder.setBrokerageAmount(discountPrice.multiply(new BigDecimal(DEFAULT_BROKERAGE_PROPORTION)));
 		tOrder.setFirstPayment(DEFAULT_FIRST_PAYMENT);
 		tOrder.setOrderAmount(orderAmount);
 		tOrder.setOrderRemarks(remarks);
@@ -190,21 +193,15 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 					|| tOrder.getOrderStage() != OrderStage.FOLLOWING.getCode()){
 				throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT,""));
 			}
-			int boundary = DecimalCalculate.compareTo(
-					DecimalCalculate.add(tOrder.getActuallyFirstPayment().doubleValue(),changeAmount.doubleValue()),
-					tOrder.getFirstPayment().doubleValue());
+			int boundary = tOrder.getActuallyFirstPayment().add(changeAmount).compareTo(tOrder.getFirstPayment());
 			if(boundary == 1){
 				throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT,"支付首付款"));
 			}else if(boundary == -1){ //首付待付清
-				tOrder.setActuallyTotalAmount(
-						new BigDecimal(DecimalCalculate.add(tOrder.getActuallyTotalAmount().doubleValue(), changeAmount.doubleValue())));
-				tOrder.setActuallyFirstPayment(
-						new BigDecimal(DecimalCalculate.add(tOrder.getActuallyFirstPayment().doubleValue(), changeAmount.doubleValue())));
+				tOrder.setActuallyTotalAmount(tOrder.getActuallyTotalAmount().add(changeAmount));
+				tOrder.setActuallyFirstPayment(tOrder.getActuallyFirstPayment().add(changeAmount));
 			}else if(boundary == 0){ //首付已结清
-				tOrder.setActuallyTotalAmount(
-						new BigDecimal(DecimalCalculate.add(tOrder.getActuallyTotalAmount().doubleValue(), changeAmount.doubleValue())));
-				tOrder.setActuallyFirstPayment(
-						new BigDecimal(DecimalCalculate.add(tOrder.getActuallyFirstPayment().doubleValue(),changeAmount.doubleValue())));
+				tOrder.setActuallyTotalAmount(tOrder.getActuallyTotalAmount().add(changeAmount));
+				tOrder.setActuallyFirstPayment(tOrder.getActuallyFirstPayment().add(changeAmount));
 				tOrder.setLiquidationStatus(LiquidationState.WAIT_PAY_LAST_BALANCE.getCode());
 			}
 		}else if(orderAction == OrderAction.CONFIRM_PAY_FOR_LAST){ //支付尾款 (审核流水)
@@ -213,18 +210,14 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 					|| tOrder.getOrderStage() != OrderStage.FOLLOWING.getCode()){
 				throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT,"支付尾款"));
 			}
-			int boundary = DecimalCalculate.compareTo(
-					DecimalCalculate.add(tOrder.getActuallyTotalAmount().doubleValue(),changeAmount.doubleValue()),
-					tOrder.getOrderAmount().doubleValue());
+			int boundary = tOrder.getActuallyTotalAmount().add(changeAmount).compareTo(tOrder.getOrderAmount());
 			if(boundary == 1){
 				throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT,"支付尾款"));
 			}else if(boundary == -1){
-				tOrder.setActuallyTotalAmount(
-						new BigDecimal(DecimalCalculate.add(tOrder.getActuallyTotalAmount().doubleValue(), changeAmount.doubleValue())));
+				tOrder.setActuallyTotalAmount(tOrder.getActuallyTotalAmount().add(changeAmount));
 			}else if(boundary == 0){
 				tOrder.setOrderStatus(OrderState.ALREADY_SIGN.getCode());
-				tOrder.setActuallyTotalAmount(
-						new BigDecimal(DecimalCalculate.add(tOrder.getActuallyTotalAmount().doubleValue(), changeAmount.doubleValue())));
+				tOrder.setActuallyTotalAmount(tOrder.getActuallyTotalAmount().add(changeAmount));
 				tOrder.setLiquidationStatus(LiquidationState.ALREADY_PAY.getCode());
 			}
 		}else if(orderAction == OrderAction.APPLY_FOR_WITHDRAW){ //提现申请 
@@ -241,8 +234,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 				throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT,"确认提现"));
 			}
 			tOrder.setLiquidationStatus(LiquidationState.ALREADY_WITHDRAW.getCode());
-			tOrder.setActuallyWithdrawAmount(new BigDecimal(DecimalCalculate.add(tOrder.getActuallyWithdrawAmount().doubleValue(),
-					changeAmount.doubleValue())));
+			tOrder.setActuallyWithdrawAmount(tOrder.getActuallyWithdrawAmount().add(changeAmount));
 		}else if(orderAction == OrderAction.APPLY_FOR_CANCEL){ //取消订单
 			boolean flag = true;
 			if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_CONFIRM.getCode()
@@ -636,6 +628,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
 		addFundRecord(orderNo, TokenManager.getUserToken().getNickname(), DEFAULT_PLATFORM_ID, TokenManager.getUserId(), remarks, 
 				TransactionSubject.SUPPLY_PAY,PayChannel.UNIONPAY, fundAmount, TransactionMode.OFFLINE, AuditState.WAIT_AUDIT);
+		tOrder.setUpdateTime(new Date());
 		tOrderMapper.updateByPrimaryKeySelective(tOrder);
 		return 1;
 	}
@@ -645,6 +638,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
 		addFundRecord(orderNo, TokenManager.getUserToken().getNickname(), DEFAULT_PLATFORM_ID, TokenManager.getUserId(), remarks, 
 				TransactionSubject.SUPPLY_PAY,PayChannel.UNIONPAY, fundAmount, TransactionMode.OFFLINE, AuditState.WAIT_AUDIT);
+		tOrder.setUpdateTime(new Date());
 		tOrderMapper.updateByPrimaryKeySelective(tOrder);
 		return 1;
 	}
@@ -748,11 +742,11 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	@Transactional
 	public int updateApplyForWithdraw(String orderNo,String remarks) {
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
-		BigDecimal transactionAmount = new BigDecimal(DecimalCalculate.sub(tOrder.getActuallyTotalAmount().doubleValue(), 
-				tOrder.getActuallyBrokerageAmount().doubleValue())); 
+		BigDecimal transactionAmount = tOrder.getActuallyTotalAmount().subtract(tOrder.getActuallyBrokerageAmount());
 		addFundRecord(orderNo, TokenManager.getUserToken().getNickname(), TokenManager.getUserId(), DEFAULT_PLATFORM_ID, remarks,
 				TransactionSubject.SUPPLY_COLLECT, PayChannel.UNIONPAY,transactionAmount,TransactionMode.OFFLINE, AuditState.WAIT_AUDIT);
 		setOrderState(OrderAction.APPLY_FOR_WITHDRAW, new BigDecimal(0), tOrder, false);
+		tOrder.setUpdateTime(new Date());
 		tOrderMapper.updateByPrimaryKeySelective(tOrder);
 		return 1;
 	}
@@ -764,11 +758,11 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
 		setOrderState(OrderAction.APPLY_FOR_CANCEL, new BigDecimal(0), tOrder, false);
 		if(true){ //退款
-			BigDecimal transactionAmount = new BigDecimal(DecimalCalculate.sub(tOrder.getActuallyTotalAmount().doubleValue(), 
-					tOrder.getActuallyBrokerageAmount().doubleValue())); 
+			BigDecimal transactionAmount = tOrder.getActuallyTotalAmount().subtract(tOrder.getActuallyBrokerageAmount()); 
 			addFundRecord(orderNo, "平台方", DEFAULT_PLATFORM_ID,TokenManager.getUserId(), "买家取消订单",
 					TransactionSubject.REFUND, PayChannel.UNIONPAY,transactionAmount,TransactionMode.OFFLINE, AuditState.WAIT_AUDIT);
 		}
+		tOrder.setUpdateTime(new Date());
 		tOrderMapper.updateByPrimaryKeySelective(tOrder);
 		return 1;
 	}
@@ -804,36 +798,31 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	 */
 	@SuppressWarnings("unchecked")
 	@Override
-	public Pagination<OrderListBo> selectServiceOrderList(String buyerName, String startDate, String endDate,
-			String confirm, String orderStatus, String liquidationStatus, String projectStage, String approval,
-			String orderChannel,Integer pageNo, Integer pageSize,Integer currentViewer) {
-		Map<String,Object> params = disposeParams(buyerName, startDate,endDate,confirm,orderStatus,
-				liquidationStatus,projectStage,approval,orderChannel,currentViewer);
+	public Pagination<OrderListBo> selectServiceOrder(OrderListBo bo,String startDate,String endDate,Integer intention,Integer formal,
+			Integer pageNo, Integer pageSize) {
+		Map<String,Object> params = disposeParams(bo,startDate,endDate);
+		params.put("salesmanId", TokenManager.getAdminId());
+		if((1 == intention && 0 == formal) || ( 0 == intention && 1 == formal)){
+			params.put("intention", intention);
+			params.put("formal", formal);
+		}else if(0 == intention && 0 == formal){
+			return new Pagination<OrderListBo>();
+		}
 		Pagination<OrderListBo> data = (Pagination<OrderListBo>)findPage("selectServiceOrderByPage","selectServiceOrderCount", 
 				params, pageNo, pageSize);
 		return data;
 	}
 	
-	private Map<String,Object> disposeParams(String buyerName, String startDate, String endDate,
-			String confirm, String orderStatus, String liquidationStatus, String projectStage, String approval,
-			String orderChannel,Integer currentViewer){
+	private Map<String,Object> disposeParams(OrderListBo bo,String startDate,String endDate){
 		Map<String,Object> params = new HashMap<>();
-		if(StringUtils.isNotBlank(buyerName)) params.put("buyerName", buyerName);
+		if(StringUtils.isNotBlank(bo.getBuyerName())) params.put("buyerName", bo.getBuyerName());
 		if(StringUtils.isNotBlank(startDate)) params.put("startDate", startDate +" 00:00:00");
 		if(StringUtils.isNotBlank(endDate)) params.put("endDate", endDate + "23:59:59");
-		if(StringUtils.isNotBlank(confirm)) params.put("confirm", confirm);
-		if(StringUtils.isNotBlank(orderStatus)) params.put("orderStatus", orderStatus);
-		if(StringUtils.isNotBlank(liquidationStatus)) params.put("liquidationStatus", liquidationStatus);
-		if(StringUtils.isNotBlank(projectStage)) params.put("projectStage", projectStage);
-		if(StringUtils.isNotBlank(approval)) params.put("approval", approval);
-		if(StringUtils.isNotBlank(orderChannel)) params.put("orderChannel", orderChannel);
-		if(currentViewer == 0){ //营销员
-			params.put("salesmanId", TokenManager.getAdminId());
-		}else if(currentViewer == 1){ //财务
-			params.put("financeId", TokenManager.getAdminId());
-		}else if(currentViewer == 2){ //技术员
-			params.put("technicianId", TokenManager.getAdminId());
-		}
+		if(bo.getOrderStatus() != null) params.put("orderStatus", bo.getOrderStatus());
+		if(bo.getLiquidationStatus() != null) params.put("liquidationStatus", bo.getLiquidationStatus());
+		if(bo.getProjectStage() != null) params.put("projectStage", bo.getProjectStage());
+		if(bo.getOrderChannel() != null) params.put("orderChannel", bo.getOrderChannel());
+		
 		return params;
 	}
 
@@ -846,27 +835,26 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	public int updateServiceOrder(String orderNo, String firstPayment, String orderAmount, String signFirstPayment,
 			String signTotalAmount,  String orderRemarks) {
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
-		if(tOrder != null){
-			checkOrder(tOrder);
-			boolean flag = false;
-			if(DecimalCalculate.compareTo(Double.valueOf(firstPayment), tOrder.getFirstPayment().doubleValue()) != 0)
-				flag = true;
-			if(DecimalCalculate.compareTo(Double.valueOf(orderAmount), tOrder.getOrderAmount().doubleValue()) != 0)
-				flag = true;
-			if(DecimalCalculate.compareTo(Double.valueOf(signFirstPayment), tOrder.getSignFirstPayment().doubleValue()) != 0)
-				flag = true;
-			if(DecimalCalculate.compareTo(Double.valueOf(signTotalAmount), tOrder.getSignTotalAmount().doubleValue()) != 0)
-				flag = true;
-			if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode() || flag){
-				 throw new BusinessException(new Error(ErrorConstants.ORDER_CAN_NOT_MODIFY, orderNo,""));
-			}
-			tOrder.setFirstPayment(new BigDecimal(firstPayment));
-			tOrder.setOrderAmount(new BigDecimal(orderAmount));
-			tOrder.setSignFirstPayment(new BigDecimal(signFirstPayment));
-			tOrder.setSignTotalAmount(new BigDecimal(signTotalAmount));
-			tOrder.setOrderRemarks(orderRemarks);
-			tOrderMapper.updateByPrimaryKeySelective(tOrder);
+		checkOrder(tOrder);
+		boolean flag = false;
+		if (new BigDecimal(firstPayment).compareTo(tOrder.getFirstPayment()) != 0)
+			flag = true;
+		if (new BigDecimal(orderAmount).compareTo(tOrder.getOrderAmount()) != 0)
+			flag = true;
+		if (new BigDecimal(signFirstPayment).compareTo(tOrder.getSignFirstPayment()) != 0)
+			flag = true;
+		if (new BigDecimal(signTotalAmount).compareTo(tOrder.getSignTotalAmount()) != 0)
+			flag = true;
+		if (tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode() || flag) {
+			throw new BusinessException(new Error(ErrorConstants.ORDER_CAN_NOT_MODIFY, orderNo, ""));
 		}
+		tOrder.setFirstPayment(new BigDecimal(firstPayment));
+		tOrder.setOrderAmount(new BigDecimal(orderAmount));
+		tOrder.setSignFirstPayment(new BigDecimal(signFirstPayment));
+		tOrder.setSignTotalAmount(new BigDecimal(signTotalAmount));
+		tOrder.setOrderRemarks(orderRemarks);
+		tOrder.setUpdateTime(new Date());
+		tOrderMapper.updateByPrimaryKeySelective(tOrder);
 		return 1;
 	}
 
@@ -874,22 +862,21 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	public int updateSignServiceOrder(String orderNo, String signFirstPayment, String signTotalAmount,String approval,
 			String orderRemarks) {
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
-		if(tOrder != null){
-			checkOrder(tOrder);
-			if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()  //等待签单 + 跟单中
-					|| tOrder.getOrderStage() != OrderStage.FOLLOWING.getCode()){
-				 throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT, orderNo,""));
-			}else{
-				if(tOrder.getLiquidationStatus() != LiquidationState.ALREADY_PAY.getCode()  //已经付款 或 特批
-						&& Integer.valueOf(approval) != ApprovalState.WAIT_AUDIT.getCode())
-					 throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT, orderNo,""));
-				tOrder.setSignFirstPayment(new BigDecimal(signFirstPayment));
-				tOrder.setSignTotalAmount(new BigDecimal(signTotalAmount));
-				tOrder.setOrderStage(OrderStage.SIGNED.getCode());
-				tOrder.setOrderStatus(OrderState.ALREADY_SIGN.getCode());
-				tOrder.setApproval(Integer.valueOf(approval));
-				tOrderMapper.updateByPrimaryKeySelective(tOrder);
-			}
+		checkOrder(tOrder);
+		if (tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode() // 等待签单- 跟单中
+				|| tOrder.getOrderStage() != OrderStage.FOLLOWING.getCode()) {
+			throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT, orderNo, ""));
+		} else {
+			if (tOrder.getLiquidationStatus() != LiquidationState.ALREADY_PAY.getCode() // 已经付款 or 特批
+					&& Integer.valueOf(approval) != ApprovalState.WAIT_AUDIT.getCode())
+				throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT, orderNo, ""));
+			tOrder.setSignFirstPayment(new BigDecimal(signFirstPayment));
+			tOrder.setSignTotalAmount(new BigDecimal(signTotalAmount));
+			tOrder.setOrderStage(OrderStage.SIGNED.getCode());
+			tOrder.setOrderStatus(OrderState.ALREADY_SIGN.getCode());
+			tOrder.setApproval(Integer.valueOf(approval));
+			tOrder.setUpdateTime(new Date());
+			tOrderMapper.updateByPrimaryKeySelective(tOrder);
 		}
 		return 1;
 	}
@@ -909,11 +896,14 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		}else{
 			throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT,"作废"));
 		}
+		tOrder.setUpdateTime(new Date());
 		tOrderMapper.updateByPrimaryKeySelective(tOrder);
 		return 1;
 	}
 	
 	public void checkOrder(TOrder tOrder){
+		if(tOrder == null) 
+			 throw new BusinessException(new Error(ErrorConstants.ORDER_NOT_EXIST, tOrder.getOrderNo(),""));
 		if(tOrder.getDeleteSign() == ActiveState.ABOLISH.getCode())
 			 throw new BusinessException(new Error(ErrorConstants.ORDER_ALREADY_FREEZE, tOrder.getOrderNo(),""));
 		if(tOrder.getDeleteSign() == ActiveState.LOCKING.getCode())
@@ -925,7 +915,6 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	public int addOrderCommodity(String orderNo, String commodityId,String commodityName, String commodityMode, Integer commodityQuantity,Integer commodityType,
 			String commodityPrice, String discountPrice,String commodityFirstPayment,String discountFirstPayment, String remarks) {
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
-		if(tOrder != null){
 			checkOrder(tOrder);
 			if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()  //等待签单 + 跟单中
 					|| tOrder.getOrderStage() != OrderStage.FOLLOWING.getCode()){
@@ -944,18 +933,20 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 				detail.setDiscountFirstPayment(new BigDecimal(discountFirstPayment));
 				detail.setRemarks(remarks);
 				tOrderDetailMapper.insert(detail);
-				
-				BigDecimal totalAmountChange = new BigDecimal(DecimalCalculate.mul(Double.valueOf(commodityPrice), Double.valueOf(commodityQuantity)));
-				BigDecimal firstPaymentChange = new BigDecimal(DecimalCalculate.mul(Double.valueOf(commodityFirstPayment), Double.valueOf(commodityQuantity)));
-				BigDecimal signTotalAmountChange = new BigDecimal(DecimalCalculate.mul(Double.valueOf(discountPrice), Double.valueOf(commodityQuantity)));
-				BigDecimal signFirstPaymentChange = new BigDecimal(DecimalCalculate.mul(Double.valueOf(discountFirstPayment), Double.valueOf(commodityQuantity)));
-				tOrder.setOrderAmount(new BigDecimal(DecimalCalculate.add(tOrder.getOrderAmount().doubleValue(), totalAmountChange.doubleValue())));
-				tOrder.setFirstPayment(new BigDecimal(DecimalCalculate.add(tOrder.getFirstPayment().doubleValue(), firstPaymentChange.doubleValue())));
-				tOrder.setSignTotalAmount(new BigDecimal(DecimalCalculate.add(tOrder.getSignTotalAmount().doubleValue(), signTotalAmountChange.doubleValue())));
-				tOrder.setSignFirstPayment(new BigDecimal(DecimalCalculate.add(tOrder.getSignFirstPayment().doubleValue(), signFirstPaymentChange.doubleValue())));
+				//订单市场价总额
+				BigDecimal totalAmountChange = new BigDecimal(commodityPrice).multiply(new BigDecimal(commodityQuantity));
+				//订单市场价首付金额
+				BigDecimal firstPaymentChange = new BigDecimal(commodityFirstPayment).multiply(new BigDecimal(commodityQuantity));
+				//订单签单总额
+				BigDecimal signTotalAmountChange = new BigDecimal(discountPrice).multiply(new BigDecimal(commodityQuantity));
+				//订单签单首付金额
+				BigDecimal signFirstPaymentChange = new BigDecimal(discountFirstPayment).multiply(new BigDecimal(commodityQuantity));
+				tOrder.setOrderAmount(tOrder.getOrderAmount().add(totalAmountChange));
+				tOrder.setFirstPayment(tOrder.getFirstPayment().add(firstPaymentChange));
+				tOrder.setSignTotalAmount(tOrder.getSignTotalAmount().add(signTotalAmountChange));
+				tOrder.setSignFirstPayment(tOrder.getSignFirstPayment().add(signFirstPaymentChange));
 				tOrderMapper.updateByPrimaryKeySelective(tOrder);
 			}
-		}
 		return 1;
 	}
 
@@ -966,47 +957,45 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		TOrderDetail oldDetail = tOrderDetailMapper.selectByPrimaryKey(detailId);
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(oldDetail.getOrderNo());
 		checkOrder(tOrder);
-		if(tOrder != null){
-			checkOrder(tOrder);
-			if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()  //等待签单 + 跟单中
-					|| tOrder.getOrderStage() != OrderStage.FOLLOWING.getCode()){
-				 throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT, oldDetail.getOrderNo(),""));
-			}else{
-				TOrderDetail detail = new TOrderDetail();
-				detail.setId(detailId);
-				detail.setOrderNo(oldDetail.getOrderNo());
-				detail.setCommodityId(commodityId);
-				detail.setCommodityQuantity(commodityQuantity);
-				detail.setCommodityType(commodityType);
-				detail.setCommodityMode(StringUtils.isBlank(commodityMode)?DEFAULT_COMMODITY_MODE:commodityMode);
-				detail.setCommodityPrice(new BigDecimal(commodityPrice));
-				detail.setDiscountPrice(new BigDecimal(discountPrice));
-				detail.setCommodityFirstPayment(new BigDecimal(commodityFirstPayment));
-				detail.setDiscountFirstPayment(new BigDecimal(discountFirstPayment));
-				detail.setRemarks(remarks);
-				tOrderDetailMapper.insert(detail);
-				//订单市场价总额
-				BigDecimal totalAmountChange = new BigDecimal(DecimalCalculate.mul(Double.valueOf(commodityPrice), Double.valueOf(commodityQuantity)));
-				totalAmountChange = new BigDecimal(DecimalCalculate.sub(totalAmountChange.doubleValue(), 
-						DecimalCalculate.mul(oldDetail.getCommodityPrice().doubleValue(), Double.valueOf(detail.getCommodityQuantity()))));
-				tOrder.setOrderAmount(new BigDecimal(DecimalCalculate.add(tOrder.getOrderAmount().doubleValue(), totalAmountChange.doubleValue())));
-				//订单市场价首付金额
-				BigDecimal firstPaymentChange = new BigDecimal(DecimalCalculate.mul(Double.valueOf(commodityFirstPayment), Double.valueOf(commodityQuantity)));
-				firstPaymentChange = new BigDecimal(DecimalCalculate.sub(firstPaymentChange.doubleValue(),
-						DecimalCalculate.mul(oldDetail.getCommodityFirstPayment().doubleValue(), Double.valueOf(detail.getCommodityQuantity()))));
-				tOrder.setFirstPayment(new BigDecimal(DecimalCalculate.add(tOrder.getFirstPayment().doubleValue(), firstPaymentChange.doubleValue())));
-				//订单签单总额
-				BigDecimal signTotalAmountChange = new BigDecimal(DecimalCalculate.mul(Double.valueOf(discountPrice), Double.valueOf(commodityQuantity)));
-				signTotalAmountChange =  new BigDecimal(DecimalCalculate.sub(signTotalAmountChange.doubleValue(),
-						DecimalCalculate.mul(oldDetail.getDiscountPrice().doubleValue(), Double.valueOf(detail.getCommodityQuantity()))));
-				tOrder.setSignTotalAmount(new BigDecimal(DecimalCalculate.add(tOrder.getSignTotalAmount().doubleValue(), signTotalAmountChange.doubleValue())));
-				//订单签单首付金额
-				BigDecimal signFirstPaymentChange = new BigDecimal(DecimalCalculate.mul(Double.valueOf(discountFirstPayment), Double.valueOf(commodityQuantity)));
-				signFirstPaymentChange =  new BigDecimal(DecimalCalculate.sub(signFirstPaymentChange.doubleValue(),
-						DecimalCalculate.mul(oldDetail.getDiscountFirstPayment().doubleValue(), Double.valueOf(detail.getCommodityQuantity()))));
-				tOrder.setSignFirstPayment(new BigDecimal(DecimalCalculate.add(tOrder.getSignFirstPayment().doubleValue(), signFirstPaymentChange.doubleValue())));
-				tOrderMapper.updateByPrimaryKeySelective(tOrder);
-			}
+		if (tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode() // 等待签单 - 跟单中
+				|| tOrder.getOrderStage() != OrderStage.FOLLOWING.getCode()) {
+			throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT, oldDetail.getOrderNo(), ""));
+		} else {
+			TOrderDetail detail = new TOrderDetail();
+			detail.setId(detailId);
+			detail.setOrderNo(oldDetail.getOrderNo());
+			detail.setCommodityId(commodityId);
+			detail.setCommodityQuantity(commodityQuantity);
+			detail.setCommodityType(commodityType);
+			detail.setCommodityMode(StringUtils.isBlank(commodityMode) ? DEFAULT_COMMODITY_MODE : commodityMode);
+			detail.setCommodityPrice(new BigDecimal(commodityPrice));
+			detail.setDiscountPrice(new BigDecimal(discountPrice));
+			detail.setCommodityFirstPayment(new BigDecimal(commodityFirstPayment));
+			detail.setDiscountFirstPayment(new BigDecimal(discountFirstPayment));
+			detail.setRemarks(remarks);
+			tOrderDetailMapper.insert(detail);
+			new BigDecimal(discountFirstPayment).multiply(new BigDecimal(commodityQuantity)).subtract(
+					oldDetail.getDiscountFirstPayment().multiply(new BigDecimal(oldDetail.getCommodityQuantity())));
+			// 订单市场价总额
+			BigDecimal totalAmountChange = new BigDecimal(commodityPrice).multiply(new BigDecimal(commodityQuantity))
+					.subtract(oldDetail.getCommodityPrice().multiply(new BigDecimal(oldDetail.getCommodityQuantity())));
+			// 订单市场价首付金额
+			BigDecimal firstPaymentChange = new BigDecimal(commodityFirstPayment)
+					.multiply(new BigDecimal(commodityQuantity)).subtract(oldDetail.getCommodityFirstPayment()
+							.multiply(new BigDecimal(oldDetail.getCommodityQuantity())));
+			// 订单签单总额
+			BigDecimal signTotalAmountChange = new BigDecimal(discountPrice).multiply(new BigDecimal(commodityQuantity))
+					.subtract(oldDetail.getDiscountPrice().multiply(new BigDecimal(oldDetail.getCommodityQuantity())));
+			// 订单签单首付金额
+			BigDecimal signFirstPaymentChange = new BigDecimal(discountFirstPayment)
+					.multiply(new BigDecimal(commodityQuantity)).subtract(oldDetail.getDiscountFirstPayment()
+							.multiply(new BigDecimal(oldDetail.getCommodityQuantity())));
+			tOrder.setOrderAmount(tOrder.getOrderAmount().add(totalAmountChange));
+			tOrder.setFirstPayment(tOrder.getFirstPayment().add(firstPaymentChange));
+			tOrder.setSignTotalAmount(tOrder.getSignTotalAmount().add(signTotalAmountChange));
+			tOrder.setSignFirstPayment(tOrder.getSignFirstPayment().add(signFirstPaymentChange));
+			tOrder.setUpdateTime(new Date());
+			tOrderMapper.updateByPrimaryKeySelective(tOrder);
 		}
 		return 1;
 	}
@@ -1016,24 +1005,133 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		TOrderDetail detail = tOrderDetailMapper.selectByPrimaryKey(detailId);
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(detail.getOrderNo());
 		checkOrder(tOrder);
-		if(tOrder != null){
-			checkOrder(tOrder);
-			if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()  //等待签单 + 跟单中
-					|| tOrder.getOrderStage() != OrderStage.FOLLOWING.getCode()){
-				 throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT, detail.getOrderNo(),""));
-			}else{
-				BigDecimal totalAmountChange = new BigDecimal(DecimalCalculate.mul(detail.getCommodityPrice().doubleValue(), Double.valueOf(detail.getCommodityQuantity())));
-				BigDecimal firstPaymentChange = new BigDecimal(DecimalCalculate.mul(detail.getCommodityFirstPayment().doubleValue(), Double.valueOf(detail.getCommodityQuantity())));
-				BigDecimal signTotalAmountChange = new BigDecimal(DecimalCalculate.mul(detail.getDiscountPrice().doubleValue(), Double.valueOf(detail.getCommodityQuantity())));
-				BigDecimal signFirstPaymentChange = new BigDecimal(DecimalCalculate.mul(detail.getCommodityFirstPayment().doubleValue(), Double.valueOf(detail.getCommodityQuantity())));
-				tOrder.setOrderAmount(new BigDecimal(DecimalCalculate.sub(tOrder.getOrderAmount().doubleValue(), totalAmountChange.doubleValue())));
-				tOrder.setFirstPayment(new BigDecimal(DecimalCalculate.sub(tOrder.getFirstPayment().doubleValue(), firstPaymentChange.doubleValue())));
-				tOrder.setSignTotalAmount(new BigDecimal(DecimalCalculate.sub(tOrder.getSignTotalAmount().doubleValue(), signTotalAmountChange.doubleValue())));
-				tOrder.setSignFirstPayment(new BigDecimal(DecimalCalculate.sub(tOrder.getSignFirstPayment().doubleValue(), signFirstPaymentChange.doubleValue())));
-				tOrderMapper.updateByPrimaryKeySelective(tOrder);
-				tOrderDetailMapper.deleteByPrimaryKey(detailId);
-			}
+		if (tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode() // 等待签单 - 跟单中
+				|| tOrder.getOrderStage() != OrderStage.FOLLOWING.getCode()) {
+			throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT, detail.getOrderNo(), ""));
+		} else {
+			BigDecimal totalAmountChange = detail.getCommodityPrice()
+					.multiply(new BigDecimal(detail.getCommodityQuantity()));
+			BigDecimal firstPaymentChange = detail.getCommodityFirstPayment()
+					.multiply(new BigDecimal(detail.getCommodityQuantity()));
+			BigDecimal signTotalAmountChange = detail.getDiscountPrice()
+					.multiply(new BigDecimal(detail.getCommodityQuantity()));
+			BigDecimal signFirstPaymentChange = detail.getCommodityFirstPayment()
+					.multiply(new BigDecimal(detail.getCommodityQuantity()));
+			tOrder.setOrderAmount(tOrder.getOrderAmount().subtract(totalAmountChange));
+			tOrder.setFirstPayment(tOrder.getFirstPayment().subtract(firstPaymentChange));
+			tOrder.setSignTotalAmount(tOrder.getSignTotalAmount().subtract(signTotalAmountChange));
+			tOrder.setSignFirstPayment(tOrder.getSignFirstPayment().subtract(signFirstPaymentChange));
+			tOrderMapper.updateByPrimaryKeySelective(tOrder);
+			tOrderDetailMapper.deleteByPrimaryKey(detailId);
 		}
 		return 1;
 	}
+	
+	@Override
+	public List<OrganizationManagement> selectMyDaeps(){
+		if(TokenManager.hasRole(AFTConstants.SUPERADMIN) || TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)) 
+			return organizationManagementMapper.selectAllDeps();
+		else
+			return selectCurrentDep(TokenManager.getAdminId());
+	}
+	
+	private List<OrganizationManagement> selectSubDeps(List<OrganizationManagement> allData,List<OrganizationManagement> superData){
+		List<OrganizationManagement> subData = new ArrayList<>();
+		String superIds = "";
+		for(OrganizationManagement om : superData){
+			if(!om.getId().equals(om.getSuperId())){
+				superIds += om.getSuperId() + ",";
+			}
+		}
+		if(StringUtils.isNotBlank(superIds)) subData = organizationManagementMapper.selectSubDeps(superIds.substring(0, superIds.length()-1));
+		if(subData != null && subData.size()>0) {
+			allData.addAll(subData);
+			selectSubDeps(allData,subData);
+		} 
+		return allData;
+	} 
+	
+	private List<OrganizationManagement> selectCurrentDep(String managerId){
+		List<OrganizationManagement> allData = new ArrayList<OrganizationManagement>();
+		List<OrganizationManagement> superData = organizationManagementMapper.selectCurrentDeps(managerId);
+		if(superData != null && superData.size()>0){
+			allData.addAll(superData);
+		}
+		selectSubDeps(allData,superData);
+		return allData;
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<OrderListBo> selectDepServiceOrder(OrderListBo bo, String startDate, String endDate,
+			Integer intention, Integer formal, String depIds,Integer pageNo, Integer pageSize) {
+		Map<String,Object> params = disposeParams(bo,startDate,endDate);
+		if(StringUtils.isNotBlank(depIds)) {
+			params.put("depIds", depIds);
+		}else{
+			if(!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.APPROVAL_DECISION))
+				return new Pagination<OrderListBo>();
+		}
+		if((1 == intention && 0 == formal) || ( 0 == intention && 1 == formal)){
+			params.put("intention", intention);
+			params.put("formal", formal);
+		}else if(0 == intention && 0 == formal){
+			return new Pagination<OrderListBo>();
+		}
+		return (Pagination<OrderListBo>)findPage("selectServiceOrderByPage","selectServiceOrderCount", 
+				params, pageNo, pageSize);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<OrderListBo> selectApprovalServiceOrder(OrderListBo bo, String startDate, String endDate,
+			String depIds,Integer approvalHistory, Integer pageNo, Integer pageSize) {
+		Map<String,Object> params = disposeParams(bo,startDate,endDate);
+		if(StringUtils.isNotBlank(depIds)) {
+			params.put("depIds", depIds);
+		}else{
+			if(!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.APPROVAL_DECISION))
+				return new Pagination<OrderListBo>();
+		}
+		if(approvalHistory != null){
+			params.put("approvalHistory", approvalHistory);
+		}
+		return  (Pagination<OrderListBo>)findPage("selectServiceOrderByPage","selectServiceOrderCount", 
+				params, pageNo, pageSize);
+	}
+
+	@Override
+	public int createServiceOrder(String uid, Integer orderType) {
+		TOrder tOrder = new TOrder();
+		tOrder.setOrderNo(idGenerator.generateId().toString());	
+		tOrder.setCreater(TokenManager.getAdminId());
+		tOrder.setCreateTime(new Date());
+		tOrder.setBuyerId(uid);
+		tOrder.setSellerId(DEFAULT_PLATFORM_ID);
+		tOrder.setBrokerageAmount(new BigDecimal(0));
+		tOrder.setFirstPayment(new BigDecimal(0));
+		tOrder.setOrderAmount(new BigDecimal(0));
+		tOrder.setOrderRemarks("");
+		tOrder.setDeleteSign(ActiveState.NORMAL.getCode());
+		tOrder.setOrderChannel(OrderChannel.PORTAL.getCode());	
+		setOrderState(OrderAction.ADD_INTENTION, new BigDecimal(0), tOrder, false);
+		return tOrderMapper.insert(tOrder);
+	}
+
+	@SuppressWarnings("unchecked")
+	@Override
+	public Pagination<OrderListBo> listPublicOrder(Integer pageNo, Integer pageSize) {
+		return (Pagination<OrderListBo>)findPage("selectPublicOrderByPage","selectPublicOrderCount", 
+				null, pageNo, pageSize);
+	}
+
+	@Override
+	public int updateAppointSalesman(String orderNo, String salesmanId) {
+		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
+		checkOrder(tOrder);
+		tOrder.setSalesmanId(salesmanId);
+		tOrder.setUpdateTime(new Date());
+		return tOrderMapper.updateByPrimaryKeySelective(tOrder);
+	}
+
 }

+ 3 - 1
src/main/resources/props/error.properties

@@ -111,4 +111,6 @@ ORDER_CAN_NOT_MODIFY = \u5F53\u524D\u8BA2\u5355\u4E0D\u80FD\u4FEE\u6539{0}
 
 ORDER_ALREADY_FREEZE = \u8BE5\u8BA2\u5355\u5DF2\u7ECF\u51BB\u7ED3{0}
 
-ORDER_ALREADY_REVOKE = \u8BE5\u8BA2\u5355\u5DF2\u7ECF\u5E9F\u9664{0}
+ORDER_ALREADY_REVOKE = \u8BE5\u8BA2\u5355\u5DF2\u7ECF\u5E9F\u9664{0}
+
+ORDER_NOT_EXIST = \u8BA2\u5355\u4E0D\u5B58\u5728{0}

+ 1 - 0
src/main/webapp/WEB-INF/views/common.html

@@ -389,6 +389,7 @@
 				createTime : /*[[${adminData.createTime}]]*/'',
 				uid : /*[[${adminData.id}]]*/'',
 				isSuperAdmin : /*[[${shiro.hasRole('999999')}]]*/false
+				isApprovalDecision : /*[[${shiro.hasRole('99999')}]]*/false
 			}
 			window.showUserManage = /*[[${shiro.hasRole('999999') || shiro.isPermitted('admin/userManage')}]]*/false;
 			window.showServices = /*[[${shiro.hasRole('999999') || shiro.isPermitted('admin/services')}]]*/false;