Procházet zdrojové kódy

Merge branch 'feature/asyncOrder' of http://git.aseanbusiness.cn/qzyReal/market-server into feature/asyncOrder

qzyReal před 1 rokem
rodič
revize
4ed537c720

+ 2 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/level_one_server/LevelOneServerInterface.java

@@ -91,6 +91,8 @@ public interface LevelOneServerInterface {
     @RequestMapping("/app/TbOrder/rpc/updateResaleStatus")
     public boolean updateResaleStatus(@RequestParam("id") Long orderId);
 
+    @RequestMapping("/app/TbOrder/rpc/updateBeingOrder")
+    public boolean updateBeingOrder(@RequestParam("id") Long levelOneOrderId);
 
     /**
      * 远程调用: 根据电话查询外籍商户

+ 5 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/level_one_server/LevelOneServerInterfaceFallback.java

@@ -143,6 +143,11 @@ public class LevelOneServerInterfaceFallback implements FallbackFactory<LevelOne
             }
 
             @Override
+            public boolean updateBeingOrder(Long levelOneOrderId) {
+                return false;
+            }
+
+            @Override
             public List<EnterpriseDto> getEnterpriseDtoListByPhone(String phone) {
                 System.out.println(throwable.getMessage());
                 log.error("查询一级市场外籍商户错误,当前电话:{},错误信息是:{}",phone,throwable.getMessage());

+ 4 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrder.java

@@ -379,4 +379,8 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	 */
 	private String settleBillNo;
 
+	/**
+	 * 订单转售后是否在二级市场被下单[0=未被下单,1=已被下单]
+	 */
+	private Integer beingOrder;
 }

+ 5 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderAppController.java

@@ -180,4 +180,9 @@ public class TbOrderAppController {
 		return tbOrderService.updateResaleStatus(orderId);
 	}
 
+	/** 远程调用 根据订单Id修改状态:在二级市场被下单[0=未被下单,1=已被下单] */
+	@RequestMapping("rpc/updateBeingOrder")
+	public boolean updateBeingOrder(@RequestParam("id")Long levelOneOrderId) {
+		return tbOrderService.updateBeingOrder(levelOneOrderId);
+	}
 }

+ 2 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderMapper.xml

@@ -73,7 +73,7 @@
 			<if test=' this.has("send") '> and send = #{send} </if>
 			<if test=' this.has("sendTime") '> and send_time = #{sendTime} </if>
 			<if test=' this.has("levelTwoOrderId") '> and level_two_order_id = #{levelTwoOrderId} </if>
-			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
+			<if test="dateBegin != null  and dateBegin != ''"> AND create_time BETWEEN #{dateBegin} AND #{dateEnd} + INTERVAL 1 DAY</if>
 			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>
 			<if test=' this.has("createName") '> and create_name = #{createName} </if>
 			<if test=' this.has("updateTime") '> and update_time = #{updateTime} </if>
@@ -87,6 +87,7 @@
 			<if test=' this.has("collageOrdersId") '> and collage_orders_id = #{collageOrdersId} </if>
 			<if test=' this.has("applyConfirmStatus") '> and apply_confirm_status = #{applyConfirmStatus} </if>
 			<if test=' this.has("cooperEntrustStatus") '> and cooper_entrust_status = #{cooperEntrustStatus} </if>
+			<if test=' this.has("beingOrder") '> and being_order = #{beingOrder} </if>
 		</where>
 		order by
 		<choose>

+ 9 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderService.java

@@ -525,7 +525,15 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 		return update == 1;
 	}
 
+	/** 远程调用 根据订单Id修改状态:在二级市场被下单[0=未被下单,1=已被下单] */
+	public boolean updateBeingOrder(Long levelOneOrderId) {
+		TbOrder tbOrder = new TbOrder();
+		tbOrder.setId(levelOneOrderId);
+		tbOrder.setBeingOrder(1);
+		int i = tbOrderMapper.updateById(tbOrder);
+		if(1 != i) System.out.println("远程调用:根据订单Id修改状态(当前订单在二级市场被下单)失败!!!!!!");
 
-
+		return true;
+	}
 
 }

+ 13 - 0
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersApiController.java

@@ -118,5 +118,18 @@ public class TbOrdersApiController {
 		return AjaxJson.getSuccessData(list);
 	}
 
+	/** 根据一级市场id查询二级市场订单 */
+	@RequestMapping("getByLevelOneOrderId")
+	public AjaxJson getByLevelOneOrderId() {
+		SoMap so = SoMap.getRequestSoMap();
+		return AjaxJson.getSuccessData(tbOrdersService.getByLevelOneOrderId(so));
+	}
 
+	/**
+	 * 修改转售金额
+	 */
+	@RequestMapping("updateResalePrice")
+	public AjaxJson updateResalePrice(TbOrders tbOrders) {
+		return AjaxJson.toAjax(tbOrdersService.updateResalePrice(tbOrders));
+	}
 }

+ 25 - 2
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersService.java

@@ -137,8 +137,12 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
             boolean b = updateById(orders);
             if (!b) throw new RuntimeException("购买异常,请重新登录或联系管理员!");
 
-            //todo:给每个购买他商品的边民发一条支付成功消息,通知边民发起缴税申请以及缴费申请
+
             TbOrders t = getById(id);
+            //修改对应的一级市场订单状态:BeingOrder值为已被下单
+            levelOneServerInterface.updateBeingOrder(t.getLevelOneOrderId());
+
+            //todo:给每个购买他商品的边民发一条支付成功消息,通知边民发起缴税申请以及缴费申请
             MessageDto dto = new MessageDto();
             dto.setUrl("/pages/market/two/leader/order");
             dto.setUserId(t.getLeaderId());
@@ -285,7 +289,7 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
     /**
      * 增 一级市场已完成订单进行转售时,新增二级市场订单
      */
-    boolean addOrderByResale(SoMap so) {
+    public boolean addOrderByResale(SoMap so) {
         OrderDto orderDto = levelOneServerInterface.getOrderDtoById(so.getLong("id"));
         if (null == orderDto) throw new RuntimeException("当前一级市场订单为空,请联系管理员!");
 
@@ -324,6 +328,25 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
     }
 
     /**
+     * 根据一级市场id查询二级市场订单
+     */
+    public TbOrders getByLevelOneOrderId(SoMap so) {
+        Long levelOneOrderId = so.getLong("levelOneOrderId");
+        LambdaQueryWrapper<TbOrders> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(TbOrders::getLevelOneOrderId, levelOneOrderId);
+        List<TbOrders> tbOrders = tbOrdersMapper.selectList(wrapper);
+
+        if(tbOrders.size()>0) return tbOrders.get(0);
+        return null;
+    }
+
+    /**
+     * 修改转售金额
+     */
+    public boolean updateResalePrice(TbOrders tbOrders) {
+        return updateById(tbOrders);
+    }
+    /**
      * 增  二级市场订单
      */
     boolean addByDetail(GoodsDemandVo goodsDemandVo) {