ソースを参照

上朵分销系统

wangxiaoming 6 年 前
コミット
564e768655

+ 10 - 0
tooth-common-core/src/main/java/com/iamberry/wechat/core/entity/cart/CartDto.java

@@ -49,6 +49,8 @@ public class CartDto implements Serializable{
 
 	private Integer colorSoldNum;	//产品售出数量
 
+	private Integer isSelfLifting;	//该产品是否能自提   1:能够  2:不能
+
 	
 	public String getProductColor() {
 		return productColor;
@@ -186,4 +188,12 @@ public class CartDto implements Serializable{
 	public void setColorSoldNum(Integer colorSoldNum) {
 		this.colorSoldNum = colorSoldNum;
 	}
+
+	public Integer getIsSelfLifting() {
+		return isSelfLifting;
+	}
+
+	public void setIsSelfLifting(Integer isSelfLifting) {
+		this.isSelfLifting = isSelfLifting;
+	}
 }

+ 20 - 0
tooth-common-core/src/main/java/com/iamberry/wechat/core/entity/cart/ShopSalesOrderDto.java

@@ -86,6 +86,10 @@ public class ShopSalesOrderDto implements Serializable{
 
 	private String salesAuditRemark;		//订单备注
 
+	private Integer salesIsCustomized;		//是否为定制牙刷  1:不为定制   2:定制牙刷
+
+	private Integer salesTransportationType;	//订单运输类型  1:邮寄  2:自提
+
 	public boolean isEfficacious() {
 		return efficacious;
 	}
@@ -333,4 +337,20 @@ public class ShopSalesOrderDto implements Serializable{
 	public void setSalesAuditRemark(String salesAuditRemark) {
 		this.salesAuditRemark = salesAuditRemark;
 	}
+
+	public Integer getSalesIsCustomized() {
+		return salesIsCustomized;
+	}
+
+	public void setSalesIsCustomized(Integer salesIsCustomized) {
+		this.salesIsCustomized = salesIsCustomized;
+	}
+
+	public Integer getSalesTransportationType() {
+		return salesTransportationType;
+	}
+
+	public void setSalesTransportationType(Integer salesTransportationType) {
+		this.salesTransportationType = salesTransportationType;
+	}
 }

+ 30 - 0
tooth-common-core/src/main/java/com/iamberry/wechat/core/entity/cart/TempOrderDto.java

@@ -40,6 +40,12 @@ public class TempOrderDto implements java.io.Serializable{
 	
 	private int balancePayAmount ; //账户余额支付额度
 
+	private int salesTransportationType=1 ; //是否自提 1:邮寄  2:自提
+
+	private int channelType=0;		//1:主渠道  2:子渠道
+
+	private int channelId=0;	//渠道id
+
 	public String getOrderAddressInfo() {
 		return orderAddressInfo;
 	}
@@ -120,6 +126,30 @@ public class TempOrderDto implements java.io.Serializable{
 		this.isCustomize = isCustomize;
 	}
 
+	public int getSalesTransportationType() {
+		return salesTransportationType;
+	}
+
+	public void setSalesTransportationType(int salesTransportationType) {
+		this.salesTransportationType = salesTransportationType;
+	}
+
+	public int getChannelType() {
+		return channelType;
+	}
+
+	public void setChannelType(int channelType) {
+		this.channelType = channelType;
+	}
+
+	public int getChannelId() {
+		return channelId;
+	}
+
+	public void setChannelId(int channelId) {
+		this.channelId = channelId;
+	}
+
 	@Override
 	public String toString() {
 		return "TempOrderDto [orderAddressInfo=" + orderAddressInfo

+ 14 - 3
tooth-common-core/src/main/java/com/iamberry/wechat/core/entity/channel/ChannelAdmin.java

@@ -1,23 +1,26 @@
 package com.iamberry.wechat.core.entity.channel;
+
 import  java.util.Date;
 import  java.io.Serializable;
 /**
- *  渠道管理员类
+ *  渠道管理员
  * @author xm
- * @Date 2018-08-02
+ * @Date 2018-08-03
  */
 public class ChannelAdmin  implements  Serializable{
     //管理员id
     private Integer channelAdminId;
     //渠道id
     private Integer channelId;
+    //返利渠道类型 1:主渠道 2:子渠道
+    private Integer channelType;
     //Openid
     private String channelAdminOpenId;
     //状态 1:使用中 2:已停用
     private Integer channelAdminStatus;
     //创建时间
     private Date channelAdminCreateTime;
-    //修改时间'
+    //修改时间
     private Date channelAdminUpdateTime;
 
     public Integer getChannelAdminId(){
@@ -36,6 +39,14 @@ public class ChannelAdmin  implements  Serializable{
         this.channelId=channelId;
     }
 
+    public Integer getChannelType(){
+        return channelType;
+    }
+
+    public void setChannelType(Integer  channelType){
+        this.channelType=channelType;
+    }
+
     public String getChannelAdminOpenId(){
         return channelAdminOpenId;
     }

+ 35 - 0
tooth-common-core/src/main/java/com/iamberry/wechat/core/entity/order/Order.java

@@ -88,6 +88,11 @@ public class Order implements java.io.Serializable{
 
 	private Integer salesIsCustomized;		//是否为定制牙刷  1:不为定制   2:定制牙刷
 
+	private Integer salesTransportationType;	//订单运输类型  1:邮寄  2:自提
+	private Integer salesChannelType;	//1:主渠道  2:子渠道
+	private Integer salesChannelId;	//渠道id
+	private List<Integer> channelIds;	//渠道ids
+
 	public String getSalesAuditRemark() {
 		return salesAuditRemark;
 	}
@@ -415,5 +420,35 @@ public class Order implements java.io.Serializable{
 		this.salesIsCustomized = salesIsCustomized;
 	}
 
+	public Integer getSalesTransportationType() {
+		return salesTransportationType;
+	}
+
+	public void setSalesTransportationType(Integer salesTransportationType) {
+		this.salesTransportationType = salesTransportationType;
+	}
+
+	public Integer getSalesChannelType() {
+		return salesChannelType;
+	}
+
+	public void setSalesChannelType(Integer salesChannelType) {
+		this.salesChannelType = salesChannelType;
+	}
 
+	public Integer getSalesChannelId() {
+		return salesChannelId;
+	}
+
+	public void setSalesChannelId(Integer salesChannelId) {
+		this.salesChannelId = salesChannelId;
+	}
+
+	public List<Integer> getChannelIds() {
+		return channelIds;
+	}
+
+	public void setChannelIds(List<Integer> channelIds) {
+		this.channelIds = channelIds;
+	}
 }

+ 3 - 1
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/cartMapper.xml

@@ -211,7 +211,9 @@ PUBLIC
 			O.SALES_LOCK_TYPE salesLockType,O.SALES_COUPON_RECEIVE_ID salesCouponReceiveId,
 			O.SALES_TRANSACTION_DATE salesTransactionDate,
 			O.SALES_AUDIT_REMARK salesAuditRemark,
-			O.SALES_BALANCE_AMOUNT balancePayAmount 
+			O.SALES_BALANCE_AMOUNT balancePayAmount,
+			O.sales_is_customized salesIsCustomized,
+			O.sales_transportation_type salesTransportationType
 		FROM 
 			TB_IAMBERRY_SHOP_SALES_ORDER O 
 		WHERE 

+ 56 - 30
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/channelAdminMapper.xml

@@ -4,6 +4,7 @@
     <resultMap  id="BaseResultMap" type="ChannelAdmin" >
         <result    column="channel_admin_id"    property="channelAdminId" />
         <result    column="channel_id"    property="channelId" />
+        <result    column="channel_type"    property="channelType" />
         <result    column="channel_admin_open_id"    property="channelAdminOpenId" />
         <result    column="channel_admin_status"    property="channelAdminStatus" />
         <result    column="channel_admin_create_time"    property="channelAdminCreateTime" />
@@ -12,11 +13,13 @@
     <sql    id="Base_List" >
         t.channel_admin_id,
         t.channel_id,
+        t.channel_type,
         t.channel_admin_open_id,
         t.channel_admin_status,
         t.channel_admin_create_time,
         t.channel_admin_update_time
     </sql>
+
     <select id="getChannelAdminList" resultMap="BaseResultMap" parameterType="ChannelAdmin" >
         select
         <include refid="Base_List" />
@@ -28,6 +31,9 @@
             <if test="channelId != null ">
                 AND t.channel_id = #{channelId}
             </if >
+            <if test="channelType != null ">
+                AND t.channel_type = #{channelType}
+            </if >
             <if test="channelAdminOpenId != null and channelAdminOpenId != ''">
                 AND t.channel_admin_open_id = #{channelAdminOpenId}
             </if >
@@ -36,27 +42,52 @@
             </if >
         </where>
     </select>
+
     <select id="getChannelAdminById" resultMap="BaseResultMap" parameterType="Integer" >
         select
         <include refid="Base_List" />
         from tb_iamberry_channel_admin t
         where t.channel_admin_id= #{channelAdminId}
     </select>
+
     <insert id="save" parameterType="ChannelAdmin" >
         insert into
         tb_iamberry_channel_admin
         (
         channel_id,
+        channel_type,
         channel_admin_open_id,
         channel_admin_status
         )
         values
         (
         #{channelId},
+        #{channelType},
         #{channelAdminOpenId},
         #{channelAdminStatus}
         )
     </insert>
+
+    <insert id="saveList" parameterType="java.util.List" >
+        insert into
+        tb_iamberry_channel_admin
+        (
+        channel_id,
+        channel_type,
+        channel_admin_open_id,
+        channel_admin_status
+        )
+        values
+        <foreach collection="list" item="node" index="index" separator="," open="" close="">
+            (
+            #{node.channelId},
+            #{node.channelType},
+            #{node.channelAdminOpenId},
+            #{node.channelAdminStatus}
+            )
+        </foreach >
+    </insert>
+
     <update id="update" parameterType="ChannelAdmin" >
         update
         tb_iamberry_channel_admin
@@ -64,6 +95,9 @@
             <if test="channelId != null ">
                 channel_id = #{channelId},
             </if >
+            <if test="channelType != null ">
+                channel_type = #{channelType},
+            </if >
             <if test="channelAdminOpenId != null and channelAdminOpenId != ''">
                 channel_admin_open_id = #{channelAdminOpenId},
             </if >
@@ -73,28 +107,13 @@
         </set >
         where channel_admin_id= #{channelAdminId}
     </update>
+
     <delete id="delete" parameterType="Integer" >
         delete FROM
         tb_iamberry_channel_admin
         where channel_admin_id=#{channelAdminId}
     </delete>
-    <insert id="saveList" parameterType="java.util.List" >
-        insert into
-        tb_iamberry_channel_admin
-        (
-        channel_id,
-        channel_admin_open_id,
-        channel_admin_status
-        )
-        values
-        <foreach collection="list" item="node" index="index" separator="," open="" close="">
-            (
-            #{node.channelId},
-            #{node.channelAdminOpenId},
-            #{node.channelAdminStatus}
-            )
-        </foreach >
-    </insert>
+
     <delete id="deleteList" parameterType="String" >
         delete FROM
         tb_iamberry_channel_admin
@@ -104,23 +123,30 @@
         </foreach >
     </delete>
 
-
     <select id="listOrderPage" resultType="Order" parameterType="Order" >
-        select
-          *
-        from tb_iamberry_channel_admin t
+        SELECT
+          so.*
+        FROM
+          tb_iamberry_shop_sales_order so
+        LEFT JOIN tb_iamberry_main_channel mc ON so.sales_channel_type = 1 AND so.sales_channel_id = mc.main_channel_id
+        LEFT JOIN tb_iamberry_child_channel cc ON so.sales_channel_type = 2 AND so.sales_channel_id = cc.child_channel_id
         <where>
-            <if test="channelAdminId != null ">
-                AND t.channel_admin_id = #{channelAdminId}
+            <if test="channelIds != null ">
+                (mc.main_channel_id in
+                    <foreach collection="channelIds" item="item" index="index" separator="," open="(" close=")">
+                        #{item}
+                    </foreach >
+                OR cc.main_channel_id in
+                    <foreach collection="channelIds" item="item" index="index" separator="," open="(" close=")">
+                        #{item}
+                    </foreach >
+                )
             </if >
-            <if test="channelId != null ">
-                AND t.channel_id = #{channelId}
-            </if >
-            <if test="channelAdminOpenId != null and channelAdminOpenId != ''">
-                AND t.channel_admin_open_id = #{channelAdminOpenId}
+            <if test="salesTransportationType != null ">
+                AND so.sales_transportation_type = #{salesTransportationType}
             </if >
-            <if test="channelAdminStatus != null ">
-                AND t.channel_admin_status = #{channelAdminStatus}
+            <if test="salesStatus != null ">
+                AND so.sales_status = #{salesStatus}
             </if >
         </where>
     </select>

+ 4 - 2
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/mapper/orderMapper.xml

@@ -17,7 +17,8 @@ PUBLIC
 			 		SALES_INTEGRAL_NUM, SALES_RATE_AMOUNT, SALES_CREATE_DATE,
 			 		SALES_REWARD_INTEGRAL_NUM, SALES_ADDRESS_INFO, SALES_ADDRESS_POSTNUM,
 			 		SALES_ADDRESS_TEL, SALES_ADDRESS_NAME, SALES_USER_REMARK, SALES_STATUS, 
-			 		SALES_PROXY_REWARD, SALES_REWARD_NUM,SALES_COUPON_RECEIVE_ID, Sales_balance_amount, sales_is_customized
+			 		SALES_PROXY_REWARD, SALES_REWARD_NUM,SALES_COUPON_RECEIVE_ID, Sales_balance_amount, sales_is_customized,
+			 		sales_transportation_type,sales_channel_type,sales_channel_id
 				)
 		 VALUES 
 		  	( 
@@ -39,7 +40,8 @@ PUBLIC
 			  #{salesRewardNum},
 			  #{couponId},
 			  #{balancePayAmount},
-			  #{salesIsCustomized}
+			  #{salesIsCustomized},
+			  #{salesTransportationType},#{salesChannelType},#{salesChannelId}
 		  	)
 	</insert>
 	

+ 2 - 2
tooth-wechat-service/src/main/java/com/iamberry/wechat/service/order/AdminOrderServiceImpl.java

@@ -148,8 +148,8 @@ public class AdminOrderServiceImpl implements AdminOrderService {
 		//修改订单状态
 		int num = this.adminOrderDao.updateOrderStatusByOrderId(order);
 		//修改更换刷头提示信息
-		int count = adminOrderService.updateAgentOrderHint(order);
-		if (num > 0 && count > 0) {
+//		int count = adminOrderService.updateAgentOrderHint(order);
+		if (num > 0) {
 			return true;
 		} else {
 			return false;

+ 139 - 0
tooth-wechat-web/src/main/java/com/iamberry/wechat/handles/channel/ChannelAdminHandler.java

@@ -0,0 +1,139 @@
+package com.iamberry.wechat.handles.channel;
+
+import com.iamberry.wechat.core.entity.ResultMsg;
+import com.iamberry.wechat.core.entity.WechatUtils;
+import com.iamberry.wechat.core.entity.channel.ChannelAdmin;
+import com.iamberry.wechat.core.entity.member.Member;
+import com.iamberry.wechat.core.entity.order.Order;
+import com.iamberry.wechat.core.entity.order.OrderItem;
+import com.iamberry.wechat.core.entity.page.PageRequest;
+import com.iamberry.wechat.core.entity.page.PagedResult;
+import com.iamberry.wechat.core.entity.receive.ChargerReceive;
+import com.iamberry.wechat.face.channel.ChannelAdminService;
+import com.iamberry.wechat.face.channel.MainChannelService;
+import com.iamberry.wechat.face.member.MemberService;
+import com.iamberry.wechat.face.order.AdminOrderService;
+import com.iamberry.wechat.tools.ResultInfo;
+import com.iamberry.wechat.utils.StitchAttrUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
+
+@Controller
+@RequestMapping("/wechat/channelAdmin")
+public class ChannelAdminHandler {
+
+    private Logger logger = LoggerFactory.getLogger(ChannelAdminHandler.class);
+
+    @Autowired
+    private MemberService memberService;
+
+    @Autowired
+    private ChannelAdminService channelAdminService;
+
+    @Autowired
+    private MainChannelService mainChannelService;
+
+    @Autowired
+    private AdminOrderService adminOrderService;
+
+    /**
+     *  获取提货列表
+     *  主渠道下面所有的提货
+     *  主渠道下面所有子渠道的
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping(value = "/getChannelList")
+    public ResultMsg getChannelList(HttpServletRequest request,Order order,
+       @RequestParam(value= "pageSize",defaultValue= "10" ,required=false) Integer pageSize,
+       @RequestParam(value = "pageNO", defaultValue = "1",required=false) Integer pageNO,
+       @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum
+    ) throws Exception {
+        ResultMsg msg = ResultMsg.getError();
+
+        // 用户信息
+        String openId  = WechatUtils.getUserBySession(request).getUserOpenid();
+
+        ChannelAdmin channelAdmin = new ChannelAdmin();
+        channelAdmin.setChannelAdminOpenId(openId);
+        channelAdmin.setChannelAdminStatus(1);
+        channelAdmin.setChannelType(1); //主渠道
+        List<ChannelAdmin> channelAdminList = channelAdminService.getChannelAdminList(channelAdmin);
+
+        if(channelAdminList == null || channelAdminList.size() < 1){
+            logger.info("====="+openId+"不是主渠道的管理员!");
+            msg.setMessage("您还不是主渠道的管理员,请联系上朵!");
+            return msg;
+        }
+
+        List<Integer> ids = new ArrayList<>();
+        for (int i=0;i<channelAdminList.size();i++){
+            ids.add(channelAdminList.get(i).getChannelId());
+        }
+        order.setChannelIds(ids);
+        order.setSalesTransportationType(2);
+
+        // 封装请求数据
+        PageRequest<Order> pageRequest = new PageRequest<>(order, pageNO, pageSize, totalNum == 0);
+        // 查询订单列表
+        PagedResult<Order> result = channelAdminService.listOrderPage(pageRequest);
+        List<Order> orderList = result.getDataList();
+        for (Order or :orderList) {
+            List<OrderItem>orderItemList = adminOrderService.getShopOrderItemByOrderId(or.getSalesOrderid());
+            or.setOrderItemList(orderItemList);
+        }
+        msg = ResultMsg.getSuccess();
+        msg.setData(orderList);
+        return msg;
+    }
+
+    /**
+     *  修改订单状态为已提货
+     *  订单状态:  已付款 --> 已发货
+     * @param request
+     * @return
+     * @throws Exception
+     */
+    @ResponseBody
+    @RequestMapping(value = "/updateStatus")
+    public ResultMsg updateStatus(HttpServletRequest request,String salesOrderid) throws Exception {
+        ResultMsg msg = ResultMsg.getError();
+
+        if(salesOrderid == null || "".equals(salesOrderid)){
+            msg.setMessage("订单号不能为空");
+            return msg;
+        }
+        Order order = adminOrderService.getShopOrderByOrderId(salesOrderid);
+        if(order.getSalesStatus() != 2){
+            msg.setMessage("该订单无法修改为已提货");
+            return msg;
+        }
+
+        order = new Order();
+        order.setSalesOrderid(salesOrderid);
+        order.setSalesStatus(5);
+        order.setOldStatus(2);
+        boolean flag = adminOrderService.updateOrderStatusByOrderId(order);
+
+        if(flag){
+            msg = ResultMsg.getSuccess();
+            return msg;
+        }else{
+            msg.setMessage("修改订单状态失败!");
+            return msg;
+        }
+    }
+
+
+}

+ 22 - 21
tooth-wechat-web/src/main/java/com/iamberry/wechat/handles/order/OrderHandler.java

@@ -178,17 +178,17 @@ public class OrderHandler {
 
 			/*上朵分销,查看是否为分销*/
 			for (CartDto cd : cartDtos) {
-				Integer price = 0,discount=0;
+				cd.setIsSelfLifting(2);	//不能自提
+
 				if(channelType > 0 && channelId > 0){
 					ChannelPrice channelPrice = channelPriceService.getChannelPriceByChannel(channelId,channelType,cd.getCartColorId());
 					if(channelPrice != null){
 						cd.setProductPrice( channelPrice.getChannelPriceOffer());	//因结算页面都是去price,所以都赋值优惠价
 						cd.setProductDiscount( channelPrice.getChannelPriceOffer());
+						cd.setIsSelfLifting(1);
 					}
-
 				}
 			}
-
 		}else if("2".equals(isCustomize)){
 			Integer id = Integer.valueOf(cartIds);
 			CustomizedTooth customizedTooth = customizedToothService.getCustomizedToothById(id);
@@ -244,7 +244,6 @@ public class OrderHandler {
 					toothbrushTotal += cartDto.getCartNum() * cartDto.getProductPrice();
 				}
 			}
-
 			String[] brushelEls = brushelEment.split("-");
 			for(String brushelEl : brushelEls){
 				if(cartDto.getProductType() == Integer.valueOf(brushelEl)){		//判断订单中是否有刷头,有刷头 brushFlag 为true;
@@ -351,8 +350,6 @@ public class OrderHandler {
 	@RequestMapping(value = "/pay", method = RequestMethod.POST)
 	public ResultMsg requestPay(
 			TempOrderDto temp,
-			@RequestParam(value = "channelType",defaultValue = "0") Integer channelType,
-			@RequestParam(value = "channelId",defaultValue = "0") Integer channelId,
 			HttpServletRequest request
 	) throws Exception {
 
@@ -378,7 +375,6 @@ public class OrderHandler {
 			msg.setMessage(ResultInfo.paramFormatError);
 			return msg;
 		}
-
 		/*校验订单信息*/
 		if(temp.getOrderAddressMoblie() == null || "".equals(temp.getOrderAddressMoblie())){
 			msg.setMessage("电话号码为空,请重新添加收货地址信息!");
@@ -392,17 +388,10 @@ public class OrderHandler {
 			msg.setMessage("电话号码错误,请重新添加收货地址信息!");
 			return msg;
 		}
-
-		if(temp.getOrderAddressInfo() == null || "".equals(temp.getOrderAddressInfo())){
-			msg.setMessage("收货人地址为空,请重新添加收货地址信息!");
-			return msg;
-		}
-
 		if(temp.getOrderAddressName() == null || "".equals(temp.getOrderAddressName())){
 			msg.setMessage("收货人姓名为空,请重新添加收货地址信息!");
 			return msg;
 		}
-
 		if(temp.getCartIdStr() == null || "".equals(temp.getCartIdStr())){
 			msg.setMessage("未选择商品,请重新选择商品并结算!");
 			return msg;
@@ -413,6 +402,13 @@ public class OrderHandler {
 				return msg;
 			}
 		}
+		//salesTransportationType
+		if(temp.getSalesTransportationType() == 1){
+			if(temp.getOrderAddressInfo() == null || "".equals(temp.getOrderAddressInfo())){
+				msg.setMessage("收货人地址为空,请重新添加收货地址信息!");
+				return msg;
+			}
+		}
 
 		if(temp.getIsCustomize() == null || "".equals(temp.getIsCustomize())){		//默认为1
 			temp.setIsCustomize("1");
@@ -487,8 +483,8 @@ public class OrderHandler {
 				total += subTotal;
 
 				/*上朵分销,*/
-				if(channelType > 0 && channelId > 0){
-					ChannelPrice channelPrice = channelPriceService.getChannelPriceByChannel(channelId,channelType,cartDto.getCartColorId());
+				if(temp.getChannelType() > 0 && temp.getChannelId() > 0){
+					ChannelPrice channelPrice = channelPriceService.getChannelPriceByChannel(temp.getChannelId(),temp.getChannelType(),cartDto.getCartColorId());
 					if(channelPrice != null){
 						subTotal = cartDto.getCartNum() * channelPrice.getChannelPriceOffer();
 					}
@@ -535,7 +531,7 @@ public class OrderHandler {
 		order.setSalesOpenid(member.getUserOpenid()); // openid 
 		order.setSalesAmount(total); // 订单金额
 
-		if(total > channelTotal && channelType > 0 && channelId > 0){		//如果有分销优惠,将直接使用分销优惠价
+		if(total > channelTotal && temp.getChannelType() > 0 && temp.getChannelId() > 0){		//如果有分销优惠,将直接使用分销优惠价
 			total = channelTotal;
 		}
 
@@ -641,6 +637,11 @@ public class OrderHandler {
 		order.setSalesAddressTel(temp.getOrderAddressMoblie()); // 收入联系方式
 		order.setSalesAddressPostnum(temp.getOrderAddressPostNum()); // 物流编号
 		order.setSalesUserRemark(temp.getOrderUserRemark()); // 用户备注
+
+		order.setSalesChannelId(temp.getChannelId());
+		order.setSalesChannelType(temp.getChannelType());
+		order.setSalesTransportationType(temp.getSalesTransportationType());	//salesTransportationType	订单运输类型  1:邮寄  2:自提
+
 		// 保存
 		boolean flag = false;
 		try {
@@ -656,8 +657,8 @@ public class OrderHandler {
 			List<OrderItem> orderItemList = adminOrderService.getShopOrderItemByOrderId(order.getSalesOrderid());
 			try{
 				for (OrderItem oi:orderItemList) {
-					if(channelType > 0 && channelId > 0){
-						ChannelPrice channelPrice = channelPriceService.getChannelPriceByChannel(channelId,channelType,oi.getItemColorId());
+					if(temp.getChannelType() > 0 && temp.getChannelId() > 0){
+						ChannelPrice channelPrice = channelPriceService.getChannelPriceByChannel(temp.getChannelId(),temp.getChannelType(),oi.getItemColorId());
 						if(channelPrice != null){
 							Integer rebateAmount = channelPrice.getChannelRebateAmount();	//channelRebateAmount  返利金额
 							rebateAmount = rebateAmount * oi.getItemNum();
@@ -666,8 +667,8 @@ public class OrderHandler {
 							channelRebate.setRebateSalesOrderId(order.getSalesOrderid());
 							channelRebate.setRebackFromOpenId(member.getUserOpenid());
 							channelRebate.setRebateItemId(oi.getItemId());
-							channelRebate.setRebackChannelType(channelType);
-							channelRebate.setRebackChannelId(channelId);
+							channelRebate.setRebackChannelType(temp.getChannelType());
+							channelRebate.setRebackChannelId(temp.getChannelId());
 							channelRebate.setRebackAmount(rebateAmount);
 							channelRebate.setRebackStatus(1); 	//1:待返利
 							Integer fl = channelRebateService.save(channelRebate);

+ 2 - 0
tooth-wechat-web/src/main/resources/iamberry-wechat-service-mybatis.xml

@@ -279,6 +279,7 @@
 		<typeAlias type="com.iamberry.wechat.core.entity.channel.ChildChannel" alias="ChildChannel"/>
 		<typeAlias type="com.iamberry.wechat.core.entity.channel.MainChannel" alias="MainChannel"/>
 		<typeAlias type="com.iamberry.wechat.core.entity.channel.BalanceLog" alias="BalanceLog"/>
+		<typeAlias type="com.iamberry.wechat.core.entity.channel.ChannelAdmin" alias="ChannelAdmin"/>
 
 		<package name="com.iamberry.wechat.core.entity.rent"/>
 	</typeAliases>
@@ -411,6 +412,7 @@
 		<mapper resource="com/iamberry/wechat/service/mapper/channelRebateMapper.xml"/>
 		<mapper resource="com/iamberry/wechat/service/mapper/channelPriceMapper.xml"/>
 		<mapper resource="com/iamberry/wechat/service/mapper/balanceLogMapper.xml"/>
+		<mapper resource="com/iamberry/wechat/service/mapper/channelAdminMapper.xml"/>
 
 	</mappers>
 </configuration>