Browse Source

订单管理

wanghui 8 years ago
parent
commit
09ba976dde

+ 17 - 1
src/main/java/com/goafanti/business/bo/BusinessProjectBo.java

@@ -140,6 +140,11 @@ public class BusinessProjectBo {
 	 * 是否精品
 	 * 是否精品
 	 */
 	 */
 	private Integer boutique;
 	private Integer boutique;
+	
+	/**
+	 * 首付金额
+	 */
+	private BigDecimal firstPayment;
 	/**
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.max_logo
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column business_project.max_logo
 	 * @return  the value of business_project.max_logo
 	 * @return  the value of business_project.max_logo
@@ -625,5 +630,16 @@ public class BusinessProjectBo {
 	public void setProjectUrl(String projectUrl) {
 	public void setProjectUrl(String projectUrl) {
 		this.projectUrl = projectUrl;
 		this.projectUrl = projectUrl;
 	}
 	}
-	
+
+
+
+	public BigDecimal getFirstPayment() {
+		return firstPayment;
+	}
+
+
+
+	public void setFirstPayment(BigDecimal firstPayment) {
+		this.firstPayment = firstPayment;
+	}
 }
 }

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

@@ -237,6 +237,7 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 		if (StringUtils.isNotBlank(s.getDistrict())) {
 		if (StringUtils.isNotBlank(s.getDistrict())) {
 			bp.setDistrict(s.getDistrict());
 			bp.setDistrict(s.getDistrict());
 		}
 		}
+
 		bp.setPrice(s.getPrice());
 		bp.setPrice(s.getPrice());
 		bp.setOffset(s.getOffset());
 		bp.setOffset(s.getOffset());
 		bp.setActivityFlag(s.getActivityFlag());
 		bp.setActivityFlag(s.getActivityFlag());
@@ -249,6 +250,8 @@ public class BusinessProjectServiceImpl extends BaseMybatisDao<BusinessProjectMa
 		bp.setMaxLogo(s.getMaxLogo());
 		bp.setMaxLogo(s.getMaxLogo());
 		bp.setBoutique(s.getBoutique());
 		bp.setBoutique(s.getBoutique());
 		bp.setProjectUrl(s.getProjectUrl());
 		bp.setProjectUrl(s.getProjectUrl());
+		bp.setFirstPayment(s.getFirstPayment());
+		
 		if (null!=(s.getStatus())) {
 		if (null!=(s.getStatus())) {
 			bp.setStatus(s.getStatus());
 			bp.setStatus(s.getStatus());
 		}
 		}

+ 159 - 140
src/main/java/com/goafanti/common/mapper/BannersMapper.xml

@@ -1,141 +1,160 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.goafanti.common.dao.BannersMapper">
-  <resultMap id="BaseResultMap" type="com.goafanti.common.model.Banners">
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="sign" jdbcType="VARCHAR" property="sign" />
-    <result column="text" jdbcType="VARCHAR" property="text" />
-    <result column="imgUrl" jdbcType="VARCHAR" property="imgurl" />
-    <result column="url" jdbcType="VARCHAR" property="url" />
-    <result column="width" jdbcType="INTEGER" property="width" />
-    <result column="height" jdbcType="INTEGER" property="height" />
-    <result column="start_date" jdbcType="TIMESTAMP" property="startDate" />
-    <result column="end_date" jdbcType="TIMESTAMP" property="endDate" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    id, sign, text, imgUrl, url, width, height, start_date, end_date
-  </sql>
-  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
-    select 
-    <include refid="Base_Column_List" />
-    from banners
-    where id = #{id,jdbcType=BIGINT}
-  </select>
-  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
-    delete from banners
-    where id = #{id,jdbcType=BIGINT}
-  </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.Banners">
-    insert into banners (id, sign, text, 
-      imgUrl, url, width, 
-      height, start_date, end_date
-      )
-    values (#{id,jdbcType=BIGINT}, #{sign,jdbcType=VARCHAR}, #{text,jdbcType=VARCHAR}, 
-      #{imgurl,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{width,jdbcType=INTEGER}, 
-      #{height,jdbcType=INTEGER}, #{startDate,jdbcType=TIMESTAMP}, #{endDate,jdbcType=TIMESTAMP}
-      )
-  </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.Banners">
-    insert into banners
-    <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
-      <if test="sign != null">
-        sign,
-      </if>
-      <if test="text != null">
-        text,
-      </if>
-      <if test="imgurl != null">
-        imgUrl,
-      </if>
-      <if test="url != null">
-        url,
-      </if>
-      <if test="width != null">
-        width,
-      </if>
-      <if test="height != null">
-        height,
-      </if>
-      <if test="startDate != null">
-        start_date,
-      </if>
-      <if test="endDate != null">
-        end_date,
-      </if>
-    </trim>
-    <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=BIGINT},
-      </if>
-      <if test="sign != null">
-        #{sign,jdbcType=VARCHAR},
-      </if>
-      <if test="text != null">
-        #{text,jdbcType=VARCHAR},
-      </if>
-      <if test="imgurl != null">
-        #{imgurl,jdbcType=VARCHAR},
-      </if>
-      <if test="url != null">
-        #{url,jdbcType=VARCHAR},
-      </if>
-      <if test="width != null">
-        #{width,jdbcType=INTEGER},
-      </if>
-      <if test="height != null">
-        #{height,jdbcType=INTEGER},
-      </if>
-      <if test="startDate != null">
-        #{startDate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="endDate != null">
-        #{endDate,jdbcType=TIMESTAMP},
-      </if>
-    </trim>
-  </insert>
-  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Banners">
-    update banners
-    <set>
-      <if test="sign != null">
-        sign = #{sign,jdbcType=VARCHAR},
-      </if>
-      <if test="text != null">
-        text = #{text,jdbcType=VARCHAR},
-      </if>
-      <if test="imgurl != null">
-        imgUrl = #{imgurl,jdbcType=VARCHAR},
-      </if>
-      <if test="url != null">
-        url = #{url,jdbcType=VARCHAR},
-      </if>
-      <if test="width != null">
-        width = #{width,jdbcType=INTEGER},
-      </if>
-      <if test="height != null">
-        height = #{height,jdbcType=INTEGER},
-      </if>
-      <if test="startDate != null">
-        start_date = #{startDate,jdbcType=TIMESTAMP},
-      </if>
-      <if test="endDate != null">
-        end_date = #{endDate,jdbcType=TIMESTAMP},
-      </if>
-    </set>
-    where id = #{id,jdbcType=BIGINT}
-  </update>
-  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Banners">
-    update banners
-    set sign = #{sign,jdbcType=VARCHAR},
-      text = #{text,jdbcType=VARCHAR},
-      imgUrl = #{imgurl,jdbcType=VARCHAR},
-      url = #{url,jdbcType=VARCHAR},
-      width = #{width,jdbcType=INTEGER},
-      height = #{height,jdbcType=INTEGER},
-      start_date = #{startDate,jdbcType=TIMESTAMP},
-      end_date = #{endDate,jdbcType=TIMESTAMP}
-    where id = #{id,jdbcType=BIGINT}
-  </update>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.BannersMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.Banners">
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="sign" jdbcType="VARCHAR" property="sign" />
+    <result column="text" jdbcType="VARCHAR" property="text" />
+    <result column="imgUrl" jdbcType="VARCHAR" property="imgurl" />
+    <result column="url" jdbcType="VARCHAR" property="url" />
+    <result column="width" jdbcType="INTEGER" property="width" />
+    <result column="height" jdbcType="INTEGER" property="height" />
+    <result column="start_date" jdbcType="TIMESTAMP" property="startDate" />
+    <result column="end_date" jdbcType="TIMESTAMP" property="endDate" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, sign, text, imgUrl, url, width, height, start_date, end_date
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from banners
+    where id = #{id,jdbcType=BIGINT}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
+    delete from banners
+    where id = #{id,jdbcType=BIGINT}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.Banners">
+    insert into banners (id, sign, text, 
+      imgUrl, url, width, 
+      height, start_date, end_date
+      )
+    values (#{id,jdbcType=BIGINT}, #{sign,jdbcType=VARCHAR}, #{text,jdbcType=VARCHAR}, 
+      #{imgurl,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{width,jdbcType=INTEGER}, 
+      #{height,jdbcType=INTEGER}, #{startDate,jdbcType=TIMESTAMP}, #{endDate,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.Banners">
+    insert into banners
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="sign != null">
+        sign,
+      </if>
+      <if test="text != null">
+        text,
+      </if>
+      <if test="imgurl != null">
+        imgUrl,
+      </if>
+      <if test="url != null">
+        url,
+      </if>
+      <if test="width != null">
+        width,
+      </if>
+      <if test="height != null">
+        height,
+      </if>
+      <if test="startDate != null">
+        start_date,
+      </if>
+      <if test="endDate != null">
+        end_date,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=BIGINT},
+      </if>
+      <if test="sign != null">
+        #{sign,jdbcType=VARCHAR},
+      </if>
+      <if test="text != null">
+        #{text,jdbcType=VARCHAR},
+      </if>
+      <if test="imgurl != null">
+        #{imgurl,jdbcType=VARCHAR},
+      </if>
+      <if test="url != null">
+        #{url,jdbcType=VARCHAR},
+      </if>
+      <if test="width != null">
+        #{width,jdbcType=INTEGER},
+      </if>
+      <if test="height != null">
+        #{height,jdbcType=INTEGER},
+      </if>
+      <if test="startDate != null">
+        #{startDate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="endDate != null">
+        #{endDate,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Banners">
+    update banners
+    <set>
+      <if test="sign != null">
+        sign = #{sign,jdbcType=VARCHAR},
+      </if>
+      <if test="text != null">
+        text = #{text,jdbcType=VARCHAR},
+      </if>
+      <if test="imgurl != null">
+        imgUrl = #{imgurl,jdbcType=VARCHAR},
+      </if>
+      <if test="url != null">
+        url = #{url,jdbcType=VARCHAR},
+      </if>
+      <if test="width != null">
+        width = #{width,jdbcType=INTEGER},
+      </if>
+      <if test="height != null">
+        height = #{height,jdbcType=INTEGER},
+      </if>
+      <if test="startDate != null">
+        start_date = #{startDate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="endDate != null">
+        end_date = #{endDate,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.Banners">
+    update banners
+    set sign = #{sign,jdbcType=VARCHAR},
+      text = #{text,jdbcType=VARCHAR},
+      imgUrl = #{imgurl,jdbcType=VARCHAR},
+      url = #{url,jdbcType=VARCHAR},
+      width = #{width,jdbcType=INTEGER},
+      height = #{height,jdbcType=INTEGER},
+      start_date = #{startDate,jdbcType=TIMESTAMP},
+      end_date = #{endDate,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+  <select id="findBannerList" resultMap="BaseResultMap">
+		select
+		<include refid="Base_Column_List" />
+		from banners where 1=1 
+		<if test="sign != null">
+			and sign = #{sign,jdbcType=VARCHAR}
+		</if>
+		order by id desc
+		<if test="pageNo != null and pageSize != null">
+		limit #{pageNo,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}
+		</if>
+	</select>
+	<select id="findBannerListCount" parameterType="java.lang.String" resultType="java.lang.Integer">
+		select count(1)
+		from banners where 1=1 
+		<if test="sign != null">
+			and sign = #{sign,jdbcType=VARCHAR}
+		</if>
+	</select>
 </mapper>
 </mapper>

+ 0 - 23
src/main/java/com/goafanti/common/mapper/BannersMapperExt.xml

@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.goafanti.common.dao.BannersMapper">
-	<select id="findBannerList" resultMap="BaseResultMap">
-		select
-		<include refid="Base_Column_List" />
-		from banners where 1=1 
-		<if test="sign != null">
-			and sign = #{sign,jdbcType=VARCHAR}
-		</if>
-		order by id desc
-		<if test="pageNo != null and pageSize != null">
-		limit #{pageNo,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}
-		</if>
-	</select>
-	<select id="findBannerListCount" parameterType="java.lang.String" resultType="java.lang.Integer">
-		select count(1)
-		from banners where 1=1 
-		<if test="sign != null">
-			and sign = #{sign,jdbcType=VARCHAR}
-		</if>
-	</select>
-</mapper>

+ 1 - 1
src/main/java/com/goafanti/common/mapper/BusinessProjectMapper.xml

@@ -788,7 +788,7 @@ where id=#{id,jdbcType=VARCHAR}
  </select>
  </select>
  
  
  <select id="selectBusinessProjectByName" parameterType="java.lang.String" resultMap="BaseResultMap">
  <select id="selectBusinessProjectByName" parameterType="java.lang.String" resultMap="BaseResultMap">
- 	select  <include refid="Base_Column_List" /> from business_project 
+ 	select  id,bname,ifnull(price,0) as price,ifnull(first_payment,0) as firstPayment from business_project 
  	where bname like concat('%',#{businessName},'%') and delete_sign=0 and status=0
  	where bname like concat('%',#{businessName},'%') and delete_sign=0 and status=0
  </select>
  </select>
  
  

+ 1 - 1
src/main/java/com/goafanti/common/mapper/ContractMapper.xml

@@ -720,7 +720,7 @@
 	   	)
 	   	)
 	and uid = #{uid,jdbcType=VARCHAR} and deleted_sign = 0
 	and uid = #{uid,jdbcType=VARCHAR} and deleted_sign = 0
   </select>
   </select>
-  <insert id="batchInsertContractTask" parameterMap="BaseResultMap">
+  <insert id="batchInsertContractTask" parameterType="com.goafanti.common.model.ContractTask">
   insert
   insert
 	into
 	into
 		contract_task(
 		contract_task(

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

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

+ 32 - 19
src/main/java/com/goafanti/common/mapper/TOrderMapper.xml

@@ -969,9 +969,13 @@
 			commodity_name as commodityName,
 			commodity_name as commodityName,
 			commodity_quantity as commodityQuantity,
 			commodity_quantity as commodityQuantity,
 			commodity_price as commodityPrice,
 			commodity_price as commodityPrice,
+			commodity_first_payment as commodityFirstPayment,
 			commodity_type as commodityType,
 			commodity_type as commodityType,
 			commodity_mode as commodityMode,
 			commodity_mode as commodityMode,
-			discount_price as discountPrice
+			discount_price as discountPrice,
+			discount_first_payment as discountFirstPayment,
+			create_time as createTime,
+			remarks
 		from
 		from
 			t_order_detail
 			t_order_detail
 		where
 		where
@@ -984,26 +988,30 @@
 			a.order_type as orderType,
 			a.order_type as orderType,
 			date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
 			date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
 			a.sign_total_amount as signTotalAmount,
 			a.sign_total_amount as signTotalAmount,
+			a.actually_total_amount as actuallyTotalAmount,
 			a.order_status as orderStatus,
 			a.order_status as orderStatus,
 			a.order_stage as orderStage,
 			a.order_stage as orderStage,
+			a.project_stage as projectStage,
 			a.liquidation_status as liquidationStatus,
 			a.liquidation_status as liquidationStatus,
 			a.approval,
 			a.approval,
 			a.order_channel as orderChannel,
 			a.order_channel as orderChannel,
-			b.nickname as buyerName,
+			a.buyer_id as buyerId,
+			a.seller_id as sellerId,
+			b.nickname as buyerName,		
 			c.name as salesmanName,
 			c.name as salesmanName,
 			d.name as financeName,
 			d.name as financeName,
 			e.name as technicianName,
 			e.name as technicianName,
-			f.departmentName
+			f.name as departmentName
 		from
 		from
 			t_order a left join user b on
 			t_order a left join user b on
 			a.buyer_id = b.id left join admin c on
 			a.buyer_id = b.id left join admin c on
 			a.salesman_id = c.id left join admin d on
 			a.salesman_id = c.id left join admin d on
 			a.finance_id = d.id left join admin e on
 			a.finance_id = d.id left join admin e on
 			a.technician_id = e.id left join department_management f on 
 			a.technician_id = e.id left join department_management f on 
-			d.department_id = f.id
-		where a.type = 0
+			c.department_id = f.id
+		where a.order_type = 0
 		<if test="salesmanId != null">
 		<if test="salesmanId != null">
-			and a.salesman_id = #{a.salesmanId,jdbcType=VARCHAR}
+			and a.salesman_id = #{salesmanId,jdbcType=VARCHAR}
 		</if>
 		</if>
 		<if test="financeId != null">
 		<if test="financeId != null">
 			and a.finance_id = #{financeId,jdbcType=VARCHAR}
 			and a.finance_id = #{financeId,jdbcType=VARCHAR}
@@ -1012,10 +1020,10 @@
 			and a.technician_id = #{technicianId,jdbcType=VARCHAR}
 			and a.technician_id = #{technicianId,jdbcType=VARCHAR}
 		</if>
 		</if>
 		<if test="startDate != null">
 		<if test="startDate != null">
-			and a.create_time &gt; #{a.startDate,jdbcType=TIMESTAMP}
+			and a.create_time &gt; #{startDate,jdbcType=TIMESTAMP}
 		</if>
 		</if>
 		<if test="endDate != null">
 		<if test="endDate != null">
-			and a.create_time &lt; #{a.endDate,jdbcType=TIMESTAMP}
+			and a.create_time &lt; #{endDate,jdbcType=TIMESTAMP}
 		</if>
 		</if>
 		<if test="buyerName != null and buyerName != ''">
 		<if test="buyerName != null and buyerName != ''">
 			and b.nickname = #{buyerName,jdbcType=VARCHAR}
 			and b.nickname = #{buyerName,jdbcType=VARCHAR}
@@ -1030,7 +1038,7 @@
 			and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
 			and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
 		</if>
 		</if>
 		<if test="orderChannel != null">
 		<if test="orderChannel != null">
-			and a.orderChannel = #{orderChannel,jdbcType=INTEGER}
+			and a.order_channel = #{orderChannel,jdbcType=INTEGER}
 		</if>
 		</if>
 		<if test="approval != null">
 		<if test="approval != null">
 			and a.approval = #{approval,jdbcType=INTEGER}
 			and a.approval = #{approval,jdbcType=INTEGER}
@@ -1049,14 +1057,14 @@
 			and a.approval != 0
 			and a.approval != 0
 		</if>
 		</if>
 		<if test="depIds != null and depIds != ''">
 		<if test="depIds != null and depIds != ''">
-			and f.id in #{depIds,jdbcType=VARCHAR}
+			and f.id in (${depIds})
 		</if>
 		</if>
 		<!-- 特殊处理字段结束 -->
 		<!-- 特殊处理字段结束 -->
 		<if test="page_sql != null">
 		<if test="page_sql != null">
 			${page_sql}
 			${page_sql}
 		</if>
 		</if>
   </select>
   </select>
-  <select id="selectServiceOrderByPage" resultType="java.lang.Integer">
+  <select id="selectServiceOrderCount" resultType="java.lang.Integer">
   		select
   		select
 			count(0)
 			count(0)
 		from
 		from
@@ -1065,10 +1073,10 @@
 			a.salesman_id = c.id left join admin d on
 			a.salesman_id = c.id left join admin d on
 			a.finance_id = d.id left join admin e on
 			a.finance_id = d.id left join admin e on
 			a.technician_id = e.id left join department_management f on 
 			a.technician_id = e.id left join department_management f on 
-			d.department_id = f.id
-		where a.type = 0
+			c.department_id = f.id
+		where a.order_type = 0
 		<if test="salesmanId != null">
 		<if test="salesmanId != null">
-			and a.salesman_id = #{a.salesmanId,jdbcType=VARCHAR}
+			and a.salesman_id = #{salesmanId,jdbcType=VARCHAR}
 		</if>
 		</if>
 		<if test="financeId != null">
 		<if test="financeId != null">
 			and a.finance_id = #{financeId,jdbcType=VARCHAR}
 			and a.finance_id = #{financeId,jdbcType=VARCHAR}
@@ -1077,10 +1085,10 @@
 			and a.technician_id = #{technicianId,jdbcType=VARCHAR}
 			and a.technician_id = #{technicianId,jdbcType=VARCHAR}
 		</if>
 		</if>
 		<if test="startDate != null">
 		<if test="startDate != null">
-			and a.create_time &gt; #{a.startDate,jdbcType=STRING}
+			and a.create_time &gt; #{startDate,jdbcType=VARCHAR}
 		</if>
 		</if>
 		<if test="endDate != null">
 		<if test="endDate != null">
-			and a.create_time &lt; #{a.endDate,jdbcType=STRING}
+			and a.create_time &lt; #{endDate,jdbcType=VARCHAR}
 		</if>
 		</if>
 		<if test="buyerName != null and buyerName != ''">
 		<if test="buyerName != null and buyerName != ''">
 			and b.nickname = #{buyerName,jdbcType=VARCHAR}
 			and b.nickname = #{buyerName,jdbcType=VARCHAR}
@@ -1101,7 +1109,7 @@
 			and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
 			and a.liquidation_status = #{liquidationStatus,jdbcType=INTEGER}
 		</if>
 		</if>
 		<if test="orderChannel != null">
 		<if test="orderChannel != null">
-			and.orderChannel =#{orderChannel,jdbcType=INTEGER}
+			and.order_channel =#{orderChannel,jdbcType=INTEGER}
 		</if>
 		</if>
 		<if test="approval != null">
 		<if test="approval != null">
 			and a.approval = #{approval,jdbcType=INTEGER}
 			and a.approval = #{approval,jdbcType=INTEGER}
@@ -1120,7 +1128,7 @@
 			and a.approval != 0
 			and a.approval != 0
 		</if>
 		</if>
 		<if test="depIds != null and depIds != ''">
 		<if test="depIds != null and depIds != ''">
-			and f.id in #{depIds,jdbcType=VARCHAR}
+			and f.id in (${depIds})
 		</if>
 		</if>
 		<!-- 特殊处理字段结束 -->
 		<!-- 特殊处理字段结束 -->
   </select>
   </select>
@@ -1134,6 +1142,10 @@
 			date_format(a.set_up_time,'%Y-%m-%d %H:%i:%S') as setUpTime,
 			date_format(a.set_up_time,'%Y-%m-%d %H:%i:%S') as setUpTime,
 			date_format(a.settlement_time,'%Y-%m-%d %H:%i:%S') as settlementTime,
 			date_format(a.settlement_time,'%Y-%m-%d %H:%i:%S') as settlementTime,
 			a.order_amount as orderAmount,
 			a.order_amount as orderAmount,
+			a.first_payment as firstPayment,
+			a.sign_total_amount as signTotalAmount,
+			a.sign_first_payment as signFirstPayment,
+			a.actually_total_amount as actuallyTotalAmount,
 			a.order_status as orderStatus,
 			a.order_status as orderStatus,
 			a.order_stage as orderStage,
 			a.order_stage as orderStage,
 			a.liquidation_status as liquidationStatus,
 			a.liquidation_status as liquidationStatus,
@@ -1142,6 +1154,7 @@
 			a.order_channel as orderChannel,
 			a.order_channel as orderChannel,
 			a.contract_picture_url as contractPictureUrl,
 			a.contract_picture_url as contractPictureUrl,
 			a.buyer_id as buyerId,
 			a.buyer_id as buyerId,
+			a.seller_id as sellerId,
 			b.nickname as buyerName,
 			b.nickname as buyerName,
 			c.name as salesmanName,
 			c.name as salesmanName,
 			a.finance_id as financeName,
 			a.finance_id as financeName,
@@ -1155,7 +1168,7 @@
 			a.salesman_id = c.id left join admin d on
 			a.salesman_id = c.id left join admin d on
 			a.finance_id = d.id left join admin e on
 			a.finance_id = d.id left join admin e on
 			a.technician_id = e.id
 			a.technician_id = e.id
-		where a.order_no = #{orderNo,jdbcType=STRING}
+		where a.order_no = #{orderNo,jdbcType=VARCHAR}
   </select>
   </select>
   
   
   <select id="selectPublicOrderByPage" resultType="com.goafanti.order.bo.OrderListBo">
   <select id="selectPublicOrderByPage" resultType="com.goafanti.order.bo.OrderListBo">

+ 15 - 0
src/main/java/com/goafanti/common/model/TOrderDetail.java

@@ -3,6 +3,10 @@ package com.goafanti.common.model;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Date;
 
 
+import org.apache.commons.lang3.time.DateFormatUtils;
+
+import com.goafanti.common.constant.AFTConstants;
+
 public class TOrderDetail {
 public class TOrderDetail {
 
 
 	/**
 	/**
@@ -304,4 +308,15 @@ public class TOrderDetail {
 	public void setRemarks(String remarks) {
 	public void setRemarks(String remarks) {
 		this.remarks = remarks;
 		this.remarks = remarks;
 	}
 	}
+	
+	private String createTimes;
+	
+	public String getCreateTimes(){
+		this.createTimes = DateFormatUtils.format(createTime, AFTConstants.YYYYMMDDHHMMSS);
+		return createTimes;
+	}
+	
+	public void setCreateTimes(String createTimes){
+		this.createTimes = createTimes;
+	}
 }
 }

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

@@ -16,6 +16,8 @@ public class OrderListBo {
 	private String signFirstPayment;
 	private String signFirstPayment;
 	/** 合同订单金额 **/
 	/** 合同订单金额 **/
 	private String signTotalAmount;
 	private String signTotalAmount;
+	/** 实际付款金额 **/
+	private String actuallyTotalAmount;
 	/** 买方姓名 **/
 	/** 买方姓名 **/
 	private String buyerName;
 	private String buyerName;
 	/** 卖方姓名 **/
 	/** 卖方姓名 **/
@@ -36,10 +38,18 @@ public class OrderListBo {
 	private String technicianName;
 	private String technicianName;
 	/** 关联部门名称 **/
 	/** 关联部门名称 **/
 	private String departmentName;
 	private String departmentName;
-	/** 项目状态 **/
+	/** 订单阶段 **/
+	private Integer orderStage;
+	/** 项目阶段 **/
 	private Integer projectStage;
 	private Integer projectStage;
 	/** 删除、锁定 状态 **/
 	/** 删除、锁定 状态 **/
 	private Integer deleteSign;
 	private Integer deleteSign;
+	/** 卖方 **/
+	private String buyerId;
+	/** 卖方 **/
+	private String sellerId;
+	/** 可操作状态 **/
+	private OperatorActive active;
 	public String getOrderNo() {
 	public String getOrderNo() {
 		return orderNo;
 		return orderNo;
 	}
 	}
@@ -70,6 +80,12 @@ public class OrderListBo {
 	public void setSignTotalAmount(String signTotalAmount) {
 	public void setSignTotalAmount(String signTotalAmount) {
 		this.signTotalAmount = signTotalAmount;
 		this.signTotalAmount = signTotalAmount;
 	}
 	}
+	public String getActuallyTotalAmount() {
+		return actuallyTotalAmount;
+	}
+	public void setActuallyTotalAmount(String actuallyTotalAmount) {
+		this.actuallyTotalAmount = actuallyTotalAmount;
+	}
 	public String getBuyerName() {
 	public String getBuyerName() {
 		return buyerName;
 		return buyerName;
 	}
 	}
@@ -130,6 +146,12 @@ public class OrderListBo {
 	public void setDepartmentName(String departmentName) {
 	public void setDepartmentName(String departmentName) {
 		this.departmentName = departmentName;
 		this.departmentName = departmentName;
 	}
 	}
+	public Integer getOrderStage() {
+		return orderStage;
+	}
+	public void setOrderStage(Integer orderStage) {
+		this.orderStage = orderStage;
+	}
 	public Integer getProjectStage() {
 	public Integer getProjectStage() {
 		return projectStage;
 		return projectStage;
 	}
 	}
@@ -142,4 +164,22 @@ public class OrderListBo {
 	public void setDeleteSign(Integer deleteSign) {
 	public void setDeleteSign(Integer deleteSign) {
 		this.deleteSign = deleteSign;
 		this.deleteSign = deleteSign;
 	}
 	}
+	public String getBuyerId() {
+		return buyerId;
+	}
+	public void setBuyerId(String buyerId) {
+		this.buyerId = buyerId;
+	}
+	public String getSellerId() {
+		return sellerId;
+	}
+	public void setSellerId(String sellerId) {
+		this.sellerId = sellerId;
+	}
+	public OperatorActive getActive() {
+		return active;
+	}
+	public void setActive(OperatorActive active) {
+		this.active = active;
+	}
 }
 }

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

@@ -3,7 +3,7 @@ package com.goafanti.order.bo;
 public class ServiceOrderDetailBo extends OrderListBo{
 public class ServiceOrderDetailBo extends OrderListBo{
 	/** 签单时间 **/
 	/** 签单时间 **/
 	private String signTime;
 	private String signTime;
-	/** 首付结算时间 **/
+	/** 结算时间 **/
 	private String settlementTime;
 	private String settlementTime;
 	/** 立项时间 **/
 	/** 立项时间 **/
 	private String setUpTime;
 	private String setUpTime;

+ 53 - 14
src/main/java/com/goafanti/order/controller/AdminOrderApiController.java

@@ -63,19 +63,18 @@ public class AdminOrderApiController extends CertifyApiController {
 	 * @return
 	 * @return
 	 */
 	 */
 	@RequestMapping(value = "/updateServiceOrder",method = RequestMethod.POST)
 	@RequestMapping(value = "/updateServiceOrder",method = RequestMethod.POST)
-	public Result updateServiceOrder(String orderNo,String firstPayment,String orderAmount,String signFirstPayment,String signTotalAmount,
-			String approval,String orderRemarks){
+	public Result updateServiceOrder(String orderNo,String signFirstPayment,String signTotalAmount,
+			String orderRemarks){
 		Result res = new Result();
 		Result res = new Result();
 		if(StringUtils.isBlank(orderNo)){
 		if(StringUtils.isBlank(orderNo)){
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "订单编号"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "订单编号"));
 			return res;
 			return res;
 		}
 		}
-		if(StringUtils.isBlank(firstPayment) || StringUtils.isBlank(orderAmount) 
-				|| StringUtils.isBlank(signFirstPayment) || StringUtils.isBlank(signTotalAmount)){
+		if(StringUtils.isBlank(signFirstPayment) || StringUtils.isBlank(signTotalAmount)){
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "订单金额 和 首付金额"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "订单金额 和 首付金额"));
 			return res;
 			return res;
 		}
 		}
-		orderServiceImpl.updateServiceOrder(orderNo,firstPayment,orderAmount,signFirstPayment,signTotalAmount,
+		orderServiceImpl.updateServiceOrder(orderNo,signFirstPayment,signTotalAmount,
 				orderRemarks);
 				orderRemarks);
 		return res;
 		return res;
 	}
 	}
@@ -90,7 +89,8 @@ public class AdminOrderApiController extends CertifyApiController {
 	 * @return
 	 * @return
 	 */
 	 */
 	@RequestMapping(value = "/signServiceOrder", method = RequestMethod.POST)
 	@RequestMapping(value = "/signServiceOrder", method = RequestMethod.POST)
-	public Result signServiceOrder(String orderNo,String signFirstPayment,String signTotalAmount,String approval,String orderRemarks){
+	public Result signServiceOrder(String orderNo,String signFirstPayment,String signTotalAmount,
+			String approval,String orderRemarks){
 		Result res = new Result();
 		Result res = new Result();
 		if(StringUtils.isBlank(orderNo)){
 		if(StringUtils.isBlank(orderNo)){
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "订单编号"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "订单编号"));
@@ -100,17 +100,21 @@ public class AdminOrderApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "订单金额 和 首付金额"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "订单金额 和 首付金额"));
 			return res;
 			return res;
 		}
 		}
+		if(null == approval){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "特批状态"));
+			return res;
+		}
 		orderServiceImpl.updateSignServiceOrder(orderNo,signFirstPayment,signTotalAmount,approval,orderRemarks);
 		orderServiceImpl.updateSignServiceOrder(orderNo,signFirstPayment,signTotalAmount,approval,orderRemarks);
 		return res;
 		return res;
 	}
 	}
 	
 	
 	/** 
 	/** 
-	 * 进入签单
+	 * 订单详情
 	 * @param orderNo
 	 * @param orderNo
 	 * @return
 	 * @return
 	 */
 	 */
-	@RequestMapping(value = "/toSignServiceOrder")
-	public Result toSignServiceOrder(String orderNo){
+	@RequestMapping(value = "/getServiceOrderDetail", method = RequestMethod.GET)
+	public Result getServiceOrderDetail(String orderNo){
 		Result res = new Result();
 		Result res = new Result();
 		if(StringUtils.isBlank(orderNo)){
 		if(StringUtils.isBlank(orderNo)){
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "订单编号"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "订单编号"));
@@ -158,6 +162,7 @@ public class AdminOrderApiController extends CertifyApiController {
 	 * @param businessName
 	 * @param businessName
 	 * @return
 	 * @return
 	 */
 	 */
+	@RequestMapping(value = "/getBusinessProjectByName", method = RequestMethod.GET)
 	public Result getBusinessProjectByName(String businessName){
 	public Result getBusinessProjectByName(String businessName){
 		Result res = new Result();
 		Result res = new Result();
 		res.setData(businessProjectServiceImpl.selectBusinessProjectByName(businessName));
 		res.setData(businessProjectServiceImpl.selectBusinessProjectByName(businessName));
@@ -165,8 +170,21 @@ public class AdminOrderApiController extends CertifyApiController {
 	}
 	}
 	
 	
 	/**
 	/**
-	 * 添加订单商品
+	 * 获取订单商品信息
 	 * @param orderNo
 	 * @param orderNo
+	 * @return
+	 */
+	@RequestMapping(value = "/getOrderCommodity",method = RequestMethod.GET)
+	public Result getOrderCommodity(String orderNo){
+		Result res = new Result();
+		res.setData(orderServiceImpl.selectOrderCommodity(orderNo));
+		return res;
+	}
+	
+	
+	/**
+	 * 添加订单商品
+	 * @param orderNo	
 	 * @param commodityId
 	 * @param commodityId
 	 * @param commodityMode
 	 * @param commodityMode
 	 * @param commodityQuantity
 	 * @param commodityQuantity
@@ -175,7 +193,7 @@ public class AdminOrderApiController extends CertifyApiController {
 	 * @param remarks
 	 * @param remarks
 	 * @return
 	 * @return
 	 */
 	 */
-	
+	@RequestMapping(value = "/addOrderCommodity",method = RequestMethod.POST)
 	public Result addOrderCommodity(String orderNo, String commodityId, String commodityName,String commodityMode, Integer commodityQuantity,Integer commodityType,
 	public Result addOrderCommodity(String orderNo, String commodityId, String commodityName,String commodityMode, Integer commodityQuantity,Integer commodityType,
 			String commodityPrice, String discountPrice,String commodityFirstPayment,String discountFirstPayment,String remarks){
 			String commodityPrice, String discountPrice,String commodityFirstPayment,String discountFirstPayment,String remarks){
 		Result res = new Result();
 		Result res = new Result();
@@ -189,6 +207,23 @@ public class AdminOrderApiController extends CertifyApiController {
 	}
 	}
 	
 	
 	/**
 	/**
+	 * 进入修改商品信息
+	 * @param id
+	 * @return
+	 */
+	@RequestMapping(value = "/toUpdateOrderCommodity",method = RequestMethod.GET)
+	public Result toUpdateOrderCommodity(String id){
+		Result res = new Result();
+		if(StringUtils.isBlank(id)){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","明细ID"));
+			return res;
+		}
+		
+		return res;
+	}
+	
+	
+	/**
 	 * 修改订单商品
 	 * 修改订单商品
 	 * @param detailId
 	 * @param detailId
 	 * @param orderNo
 	 * @param orderNo
@@ -220,6 +255,7 @@ public class AdminOrderApiController extends CertifyApiController {
 	 * @param detailId
 	 * @param detailId
 	 * @return
 	 * @return
 	 */
 	 */
+	@RequestMapping(value = "/deleteOrderCommodity",method = RequestMethod.GET)
 	public Result deleteOrderCommodity(String detailId){
 	public Result deleteOrderCommodity(String detailId){
 		Result res = new Result();
 		Result res = new Result();
 		if(StringUtils.isBlank(detailId)){
 		if(StringUtils.isBlank(detailId)){
@@ -234,9 +270,10 @@ public class AdminOrderApiController extends CertifyApiController {
 	 * 查询分管部门
 	 * 查询分管部门
 	 * @return
 	 * @return
 	 */
 	 */
-	public Result selectMyDaeps(){
+	@RequestMapping(value = "/selectMyDeps")
+	public Result selectMyDeps(){
 		Result res = new Result();
 		Result res = new Result();
-			res.setData(orderServiceImpl.selectMyDaeps());
+			res.setData(orderServiceImpl.selectMyDeps());
 		return res;
 		return res;
 	}
 	}
 	
 	
@@ -281,7 +318,8 @@ public class AdminOrderApiController extends CertifyApiController {
 	 * @param orderType
 	 * @param orderType
 	 * @return
 	 * @return
 	 */
 	 */
-	public Result createServiceOrder(String uid,Integer orderType){
+	@RequestMapping(value = "/createOrder",method = RequestMethod.POST)
+	public Result createOrder(String uid,Integer orderType){
 		Result res = new Result();
 		Result res = new Result();
 		if(StringUtils.isBlank(uid)){
 		if(StringUtils.isBlank(uid)){
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","客户编号"));
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","客户编号"));
@@ -424,4 +462,5 @@ public class AdminOrderApiController extends CertifyApiController {
 		orderServiceImpl.updateBill(billNo, financialPayNo, financialPayTime, remarks);
 		orderServiceImpl.updateBill(billNo, financialPayNo, financialPayTime, remarks);
 		return res;
 		return res;
 	}
 	}
+
 }
 }

+ 15 - 4
src/main/java/com/goafanti/order/service/OrderService.java

@@ -5,6 +5,7 @@ import java.text.ParseException;
 import java.util.List;
 import java.util.List;
 
 
 import com.goafanti.common.model.OrganizationManagement;
 import com.goafanti.common.model.OrganizationManagement;
+import com.goafanti.common.model.TOrderDetail;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.order.bo.BillDetailBo;
 import com.goafanti.order.bo.BillDetailBo;
 import com.goafanti.order.bo.BillListBo;
 import com.goafanti.order.bo.BillListBo;
@@ -132,18 +133,21 @@ public interface OrderService {
 	 * @param orderRemarks
 	 * @param orderRemarks
 	 * @return
 	 * @return
 	 */
 	 */
-	int updateServiceOrder(String orderNo, String firstPayment, String orderAmount, String signFirstPayment,
+	int updateServiceOrder(String orderNo, String signFirstPayment,
 			String signTotalAmount, String orderRemarks);
 			String signTotalAmount, String orderRemarks);
-
+	
 	/**
 	/**
 	 * 签单
 	 * 签单
 	 * @param orderNo
 	 * @param orderNo
+	 * @param firstPayment
+	 * @param orderAmount
 	 * @param signFirstPayment
 	 * @param signFirstPayment
 	 * @param signTotalAmount
 	 * @param signTotalAmount
+	 * @param approval
 	 * @param orderRemarks
 	 * @param orderRemarks
 	 * @return
 	 * @return
 	 */
 	 */
-	int updateSignServiceOrder(String orderNo, String signFirstPayment, String signTotalAmount,
+	int updateSignServiceOrder(String orderNo,String signFirstPayment, String signTotalAmount,
 			String approval,String orderRemarks);
 			String approval,String orderRemarks);
 
 
 	/**
 	/**
@@ -196,7 +200,7 @@ public interface OrderService {
 	 * 查询分管部门
 	 * 查询分管部门
 	 * @return
 	 * @return
 	 */
 	 */
-	List<OrganizationManagement> selectMyDaeps();
+	List<OrganizationManagement> selectMyDeps();
 	
 	
 	/**
 	/**
 	 * 
 	 * 
@@ -347,4 +351,11 @@ public interface OrderService {
 	 * @return
 	 * @return
 	 */
 	 */
 	int setUpProject(String orderNo, String signDate, String signComment);
 	int setUpProject(String orderNo, String signDate, String signComment);
+	
+	/**
+	 * 订单编号
+	 * @param orderNo
+	 * @return
+	 */
+	List<TOrderDetail> selectOrderCommodity(String orderNo);
 }
 }

+ 84 - 38
src/main/java/com/goafanti/order/service/impl/OrderServiceImpl.java

@@ -33,6 +33,7 @@ import com.goafanti.common.model.TOrder;
 import com.goafanti.common.model.TOrderBill;
 import com.goafanti.common.model.TOrderBill;
 import com.goafanti.common.model.TOrderDetail;
 import com.goafanti.common.model.TOrderDetail;
 import com.goafanti.common.model.User;
 import com.goafanti.common.model.User;
+import com.goafanti.common.utils.BeanUtilsExt;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.common.utils.DateUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.JDBCIdGenerator;
 import com.goafanti.core.mybatis.JDBCIdGenerator;
@@ -172,18 +173,24 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	 * @param actionType
 	 * @param actionType
 	 */
 	 */
 	public void setOrderState(OrderAction orderAction,BigDecimal changeAmount,TOrder tOrder,boolean confrim){
 	public void setOrderState(OrderAction orderAction,BigDecimal changeAmount,TOrder tOrder,boolean confrim){
+		BigDecimal initial = new BigDecimal(0);
 		checkOrder(tOrder);
 		checkOrder(tOrder);
 		if(orderAction == OrderAction.ADD_INTENTION){ //添加意向订单
 		if(orderAction == OrderAction.ADD_INTENTION){ //添加意向订单
-			tOrder.setOrderStatus(OrderState.INVALID.getCode());
+			tOrder.setOrderStatus(OrderState.WAIT_FOR_CONFIRM.getCode());
 			tOrder.setLiquidationStatus(LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode());
 			tOrder.setLiquidationStatus(LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode());
 			tOrder.setOrderStage(OrderStage.INTENTION.getCode());
 			tOrder.setOrderStage(OrderStage.INTENTION.getCode());
 			tOrder.setProjectStage(ProjectStage.NOT_SATISFY_CONDITION.getCode());
 			tOrder.setProjectStage(ProjectStage.NOT_SATISFY_CONDITION.getCode());
-			tOrder.setActuallyFirstPayment(new BigDecimal(0));
-			tOrder.setActuallyTotalAmount(new BigDecimal(0));
-			tOrder.setActuallyBrokerageAmount(new BigDecimal(0));
-			tOrder.setActuallyWithdrawAmount(new BigDecimal(0));
+			tOrder.setLiquidationStatus(LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode());
+			tOrder.setSignFirstPayment(initial);
+			tOrder.setActuallyFirstPayment(initial);
+			tOrder.setSignBrokerageAmount(initial);
+			tOrder.setActuallyBrokerageAmount(initial);
+			tOrder.setSignTotalAmount(initial);
+			tOrder.setActuallyTotalAmount(initial);
+			tOrder.setSignWithdrawAmount(initial);
+			tOrder.setActuallyWithdrawAmount(initial);
 		}else if(orderAction == OrderAction.CONFIRM_INTENTION){ //确认意向订单 (用户确认)
 		}else if(orderAction == OrderAction.CONFIRM_INTENTION){ //确认意向订单 (用户确认)
-			if(tOrder.getOrderStatus() == OrderState.WAIT_FOR_CONFIRM.getCode()){
+			if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_CONFIRM.getCode()){
 				throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT,"确认意向订单"));
 				throw new BusinessException(new Error(ErrorConstants.NOT_ACCORD_WITH_NEXT,"确认意向订单"));
 			}
 			}
 			if (confrim) {
 			if (confrim) {
@@ -378,10 +385,9 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 				}
 				}
 				boolean flag = true;
 				boolean flag = true;
 				if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_CONFIRM.getCode()
 				if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_CONFIRM.getCode()
-						|| tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()){
+						&& tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()){
 					flag = false;
 					flag = false;
 				}
 				}
-				
 				if(tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode()
 				if(tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode()
 						&& tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_LAST_BALANCE.getCode()
 						&& tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_LAST_BALANCE.getCode()
 						&& tOrder.getLiquidationStatus() != LiquidationState.ALREADY_PAY.getCode()){
 						&& tOrder.getLiquidationStatus() != LiquidationState.ALREADY_PAY.getCode()){
@@ -424,11 +430,9 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 					active.setRefuseIntention(false); 
 					active.setRefuseIntention(false); 
 				}
 				}
 				boolean flag = true;
 				boolean flag = true;
-				if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_CONFIRM.getCode()
-						|| tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()){
+				if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()){
 					flag = false;
 					flag = false;
 				}
 				}
-			
 				if(tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode()
 				if(tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode()
 						&& tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_LAST_BALANCE.getCode()
 						&& tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_LAST_BALANCE.getCode()
 						&& tOrder.getLiquidationStatus() != LiquidationState.ALREADY_PAY.getCode()){
 						&& tOrder.getLiquidationStatus() != LiquidationState.ALREADY_PAY.getCode()){
@@ -480,10 +484,8 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 					active.setConfirmIntention(false);
 					active.setConfirmIntention(false);
 					active.setRefuseIntention(false);
 					active.setRefuseIntention(false);
 				}
 				}
-				// 平台方作为中间方 确认首付 - 尾款 - 退款 
 				boolean flag = true;
 				boolean flag = true;
-				if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_CONFIRM.getCode()
-						|| tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()){
+				if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()){
 					flag = false;
 					flag = false;
 				}			
 				}			
 				if(tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode()
 				if(tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_FIRST_BALANCE.getCode()
@@ -552,9 +554,6 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		flag = true;
 		flag = true;
 		if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode())
 		if(tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode())
 			flag = false;
 			flag = false;
-		if(tOrder.getLiquidationStatus() != LiquidationState.WAIT_PAY_LAST_BALANCE.getCode() 
-					&& tOrder.getApproval() != ApprovalState.AUDIT_PASS.getCode())
-			flag = false;		
 		active.setApplySign(flag);
 		active.setApplySign(flag);
 		return active;
 		return active;
 	}
 	}
@@ -772,7 +771,8 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	public Pagination<OrderListBo> selectServiceOrder(OrderListBo bo,String startDate,String endDate,Integer intention,Integer formal,
 	public Pagination<OrderListBo> selectServiceOrder(OrderListBo bo,String startDate,String endDate,Integer intention,Integer formal,
 			Integer pageNo, Integer pageSize) {
 			Integer pageNo, Integer pageSize) {
 		Map<String,Object> params = disposeParams(bo,startDate,endDate);
 		Map<String,Object> params = disposeParams(bo,startDate,endDate);
-		params.put("salesmanId", TokenManager.getAdminId());
+		if(!TokenManager.hasRole(AFTConstants.SUPERADMIN))
+			params.put("salesmanId", TokenManager.getAdminId());
 		if((1 == intention && 0 == formal) || ( 0 == intention && 1 == formal)){
 		if((1 == intention && 0 == formal) || ( 0 == intention && 1 == formal)){
 			params.put("intention", intention);
 			params.put("intention", intention);
 			params.put("formal", formal);
 			params.put("formal", formal);
@@ -781,6 +781,19 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		}
 		}
 		Pagination<OrderListBo> data = (Pagination<OrderListBo>)findPage("selectServiceOrderByPage","selectServiceOrderCount", 
 		Pagination<OrderListBo> data = (Pagination<OrderListBo>)findPage("selectServiceOrderByPage","selectServiceOrderCount", 
 				params, pageNo, pageSize);
 				params, pageNo, pageSize);
+		TOrder tOrder = null;
+		List<OrderListBo> list = (List<OrderListBo>)data.getList();
+		for(OrderListBo olb:list){
+			tOrder = new TOrder();
+			try {
+				BeanUtilsExt.copyProperties(tOrder, olb);
+				tOrder.setActuallyTotalAmount(new BigDecimal(olb.getActuallyTotalAmount()));
+			} catch (InvocationTargetException | IllegalAccessException e) {
+				e.printStackTrace();
+			}
+			olb.setActive(setOperatorActive(tOrder));
+		}
+		data.setList(list);
 		return data;
 		return data;
 	}
 	}
 	
 	
@@ -799,28 +812,31 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 
 
 	@Override
 	@Override
 	public ServiceOrderDetailBo selectServiceOrderDetail(String orderNo) {
 	public ServiceOrderDetailBo selectServiceOrderDetail(String orderNo) {
+		ServiceOrderDetailBo bo = tOrderMapper.selectServiceOrderDetail(orderNo);
+		TOrder tOrder = new TOrder();
+		try {
+			BeanUtilsExt.copyProperties(tOrder, bo);
+			tOrder.setActuallyTotalAmount(new BigDecimal(bo.getActuallyTotalAmount()));
+			bo.setActive(setOperatorActive(tOrder));
+		} catch (IllegalAccessException | InvocationTargetException e) {
+			e.printStackTrace();
+		}
 		return tOrderMapper.selectServiceOrderDetail(orderNo);
 		return tOrderMapper.selectServiceOrderDetail(orderNo);
 	}
 	}
 
 
 	@Override
 	@Override
-	public int updateServiceOrder(String orderNo, String firstPayment, String orderAmount, String signFirstPayment,
-			String signTotalAmount,  String orderRemarks) {
+	public int updateServiceOrder(String orderNo,  String signFirstPayment,
+			String signTotalAmount, String orderRemarks) {
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
 		checkOrder(tOrder);
 		checkOrder(tOrder);
 		boolean flag = false;
 		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)
 		if (new BigDecimal(signFirstPayment).compareTo(tOrder.getSignFirstPayment()) != 0)
 			flag = true;
 			flag = true;
 		if (new BigDecimal(signTotalAmount).compareTo(tOrder.getSignTotalAmount()) != 0)
 		if (new BigDecimal(signTotalAmount).compareTo(tOrder.getSignTotalAmount()) != 0)
 			flag = true;
 			flag = true;
-		if (tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode() || flag) {
+		if (tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode() && flag) {
 			throw new BusinessException(new Error(ErrorConstants.ORDER_CAN_NOT_MODIFY, orderNo, ""));
 			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.setSignFirstPayment(new BigDecimal(signFirstPayment));
 		tOrder.setSignTotalAmount(new BigDecimal(signTotalAmount));
 		tOrder.setSignTotalAmount(new BigDecimal(signTotalAmount));
 		tOrder.setOrderRemarks(orderRemarks);
 		tOrder.setOrderRemarks(orderRemarks);
@@ -830,8 +846,8 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	}
 	}
 
 
 	@Override
 	@Override
-	public int updateSignServiceOrder(String orderNo, String signFirstPayment, String signTotalAmount,String approval,
-			String orderRemarks) {
+	public int updateSignServiceOrder(String orderNo, String signFirstPayment, String signTotalAmount,
+			String approval,String orderRemarks) {
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
 		TOrder tOrder = tOrderMapper.selectByPrimaryKey(orderNo);
 		checkOrder(tOrder);
 		checkOrder(tOrder);
 		if (tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()) {
 		if (tOrder.getOrderStatus() != OrderState.WAIT_FOR_SIGN.getCode()) {
@@ -891,6 +907,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 				detail.setId(UUID.randomUUID().toString());
 				detail.setId(UUID.randomUUID().toString());
 				detail.setOrderNo(orderNo);
 				detail.setOrderNo(orderNo);
 				detail.setCommodityId(commodityId);
 				detail.setCommodityId(commodityId);
+				detail.setCommodityName(commodityName);
 				detail.setCommodityQuantity(commodityQuantity);
 				detail.setCommodityQuantity(commodityQuantity);
 				detail.setCommodityType(commodityType);
 				detail.setCommodityType(commodityType);
 				detail.setCommodityMode(StringUtils.isBlank(commodityMode)?DEFAULT_COMMODITY_MODE:commodityMode);
 				detail.setCommodityMode(StringUtils.isBlank(commodityMode)?DEFAULT_COMMODITY_MODE:commodityMode);
@@ -898,7 +915,8 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 				detail.setDiscountPrice(new BigDecimal(discountPrice));
 				detail.setDiscountPrice(new BigDecimal(discountPrice));
 				detail.setCommodityFirstPayment(new BigDecimal(commodityFirstPayment));
 				detail.setCommodityFirstPayment(new BigDecimal(commodityFirstPayment));
 				detail.setDiscountFirstPayment(new BigDecimal(discountFirstPayment));
 				detail.setDiscountFirstPayment(new BigDecimal(discountFirstPayment));
-				detail.setRemarks(remarks);
+				detail.setRemarks(remarks);	
+				detail.setCreateTime(new Date());
 				tOrderDetailMapper.insert(detail);
 				tOrderDetailMapper.insert(detail);
 				//订单市场价总额
 				//订单市场价总额
 				BigDecimal totalAmountChange = new BigDecimal(commodityPrice).multiply(new BigDecimal(commodityQuantity));
 				BigDecimal totalAmountChange = new BigDecimal(commodityPrice).multiply(new BigDecimal(commodityQuantity));
@@ -993,7 +1011,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 	}
 	}
 	
 	
 	@Override
 	@Override
-	public List<OrganizationManagement> selectMyDaeps(){
+	public List<OrganizationManagement> selectMyDeps(){
 		if(TokenManager.hasRole(AFTConstants.SUPERADMIN) || TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)) 
 		if(TokenManager.hasRole(AFTConstants.SUPERADMIN) || TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)) 
 			return organizationManagementMapper.selectAllDeps();
 			return organizationManagementMapper.selectAllDeps();
 		else
 		else
@@ -1005,7 +1023,7 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		String superIds = "";
 		String superIds = "";
 		for(OrganizationManagement om : superData){
 		for(OrganizationManagement om : superData){
 			if(!om.getId().equals(om.getSuperId())){
 			if(!om.getId().equals(om.getSuperId())){
-				superIds += om.getSuperId() + ",";
+				superIds += om.getId() + ",";
 			}
 			}
 		}
 		}
 		if(StringUtils.isNotBlank(superIds)) subData = organizationManagementMapper.selectSubDeps(superIds.substring(0, superIds.length()-1));
 		if(StringUtils.isNotBlank(superIds)) subData = organizationManagementMapper.selectSubDeps(superIds.substring(0, superIds.length()-1));
@@ -1032,7 +1050,12 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 			Integer intention, Integer formal, String depIds,Integer pageNo, Integer pageSize) {
 			Integer intention, Integer formal, String depIds,Integer pageNo, Integer pageSize) {
 		Map<String,Object> params = disposeParams(bo,startDate,endDate);
 		Map<String,Object> params = disposeParams(bo,startDate,endDate);
 		if(StringUtils.isNotBlank(depIds)) {
 		if(StringUtils.isNotBlank(depIds)) {
-			params.put("depIds", depIds);
+			if(!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.APPROVAL_DECISION)){
+				params.put("depIds","'" + depIds.replace(",", "','") + "'");
+			}else{
+				if(!depIds.contains(",")) params.put("depIds","'" + depIds + "'");
+			}
+				
 		}else{
 		}else{
 			if(!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.APPROVAL_DECISION))
 			if(!TokenManager.hasRole(AFTConstants.SUPERADMIN) && !TokenManager.hasRole(AFTConstants.APPROVAL_DECISION))
 				return new Pagination<OrderListBo>();
 				return new Pagination<OrderListBo>();
@@ -1043,8 +1066,22 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		}else if(0 == intention && 0 == formal){
 		}else if(0 == intention && 0 == formal){
 			return new Pagination<OrderListBo>();
 			return new Pagination<OrderListBo>();
 		}
 		}
-		return (Pagination<OrderListBo>)findPage("selectServiceOrderByPage","selectServiceOrderCount", 
+		Pagination<OrderListBo> data = (Pagination<OrderListBo>)findPage("selectServiceOrderByPage","selectServiceOrderCount", 
 				params, pageNo, pageSize);
 				params, pageNo, pageSize);
+		TOrder tOrder = null;
+		List<OrderListBo> list = (List<OrderListBo>)data.getList();
+		for(OrderListBo olb:list){
+			tOrder = new TOrder();
+			try {
+				BeanUtilsExt.copyProperties(tOrder, olb);
+				tOrder.setActuallyTotalAmount(new BigDecimal(olb.getActuallyTotalAmount()));
+			} catch (InvocationTargetException | IllegalAccessException e) {
+				e.printStackTrace();
+			}
+			olb.setActive(setOperatorActive(tOrder));
+		}
+		data.setList(list);
+		return data;
 	}
 	}
 
 
 	@SuppressWarnings("unchecked")
 	@SuppressWarnings("unchecked")
@@ -1067,18 +1104,22 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 
 
 	@Override
 	@Override
 	public int createServiceOrder(String uid, Integer orderType) {
 	public int createServiceOrder(String uid, Integer orderType) {
+		BigDecimal initial = new BigDecimal(0);
 		TOrder tOrder = new TOrder();
 		TOrder tOrder = new TOrder();
+		tOrder.setOrderType(orderType);
 		tOrder.setOrderNo(idGenerator.generateId().toString());	
 		tOrder.setOrderNo(idGenerator.generateId().toString());	
 		tOrder.setCreater(TokenManager.getAdminId());
 		tOrder.setCreater(TokenManager.getAdminId());
 		tOrder.setCreateTime(new Date());
 		tOrder.setCreateTime(new Date());
 		tOrder.setBuyerId(uid);
 		tOrder.setBuyerId(uid);
 		tOrder.setSellerId(DEFAULT_PLATFORM_ID);
 		tOrder.setSellerId(DEFAULT_PLATFORM_ID);
-		tOrder.setBrokerageAmount(new BigDecimal(0));
-		tOrder.setFirstPayment(new BigDecimal(0));
-		tOrder.setOrderAmount(new BigDecimal(0));
+		tOrder.setSalesmanId(TokenManager.getAdminId());
+		tOrder.setBrokerageAmount(initial);
+		tOrder.setFirstPayment(initial);
+		tOrder.setOrderAmount(initial);
+		tOrder.setOrderChannel(OrderChannel.PORTAL.getCode());	
 		tOrder.setOrderRemarks("");
 		tOrder.setOrderRemarks("");
 		tOrder.setDeleteSign(ActiveState.NORMAL.getCode());
 		tOrder.setDeleteSign(ActiveState.NORMAL.getCode());
-		tOrder.setOrderChannel(OrderChannel.PORTAL.getCode());	
+		tOrder.setApproval(ApprovalState.NORMAL.getCode());
 		setOrderState(OrderAction.ADD_INTENTION, new BigDecimal(0), tOrder, false);
 		setOrderState(OrderAction.ADD_INTENTION, new BigDecimal(0), tOrder, false);
 		return tOrderMapper.insert(tOrder);
 		return tOrderMapper.insert(tOrder);
 	}
 	}
@@ -1319,4 +1360,9 @@ public class OrderServiceImpl extends BaseMybatisDao<TOrderMapper> implements Or
 		return 1;
 		return 1;
 	}
 	}
 
 
+	@Override
+	public List<TOrderDetail> selectOrderCommodity(String orderNo) {
+		return tOrderMapper.selectOrderCommodity(orderNo);
+	}
+
 }
 }