Ver código fonte

车辆已出一级市场, 修改相对应的一级市场订单状态

linbl 1 ano atrás
pai
commit
3538e46475

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

@@ -109,4 +109,8 @@ public interface LevelOneServerInterface {
     /** 根据航通主键查询appUser */
     @RequestMapping("/TbPeople/rpc/getAppUserByBorderPutrecNo")
     public AppUserDto getAppUserByBorderPutrecNo(@RequestParam("borderPutrecNo") String borderPutrecNo);
+
+    /** 系统接收到航通接口信息:车辆已出一级市场 ,修改相对应的一级市场订单状态 **/
+    @RequestMapping("/TbOrder/rpc/orderFinish")
+    public boolean orderFinish(@RequestParam("billCode") String billCode);
 }

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

@@ -169,6 +169,11 @@ public class LevelOneServerInterfaceFallback implements FallbackFactory<LevelOne
                 log.error("根据航通主键查询appUser错误,当前对象:{},错误信息是:{}",borderPutrecNo,throwable.getMessage());
                 return null;
             }
+
+            @Override
+            public boolean orderFinish(String billCode) {
+                return false;
+            }
         };
     }
 }

+ 6 - 0
sp-service/async-server/src/main/java/com/pj/task/HtByteTask.java

@@ -284,6 +284,12 @@ public class HtByteTask {
                     } else {
                         System.out.println("\n放行记录(过卡记录)信息处理失败。 messageId = " + item.getMessageId() + "\n");
                     }
+
+                    //系统接收到航通过卡记录且卡口类型为'3卡':车辆已出一级市场, 修改相对应的一级市场订单状态
+                    if("3卡".equals(htPassCardRecord.getChannelType())) {
+                        FeignFactory.levelOneServerInterface.orderFinish(htPassCardRecord.getBillCode());
+                    }
+
                     break;
                 case "008":
                     //进口申报单边民确认

+ 26 - 31
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderController.java

@@ -13,7 +13,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 
 /**
  * Controller: tb_order -- 订单表
- * @author loovi 
+ * @author loovi
  */
 @RestController
 @RequestMapping("/TbOrder/")
@@ -22,34 +22,26 @@ public class TbOrderController {
 	/** 底层 Service 对象 */
 	@Autowired
 	TbOrderService tbOrderService;
-//
-//	/** 增 */
-//	@RequestMapping("add")
-//	@SaCheckPermission(TbOrder.PERMISSION_CODE_ADD)
-//	public AjaxJson add(TbOrder t){
-//		tbOrderService.add(t);
-//		t = tbOrderService.getById(SP.publicMapper.getPrimarykey());
-//		return AjaxJson.getSuccessData(t);
-//	}
-
-	/** 删 */  
+
+
+	/** 删 */
 	@RequestMapping("delete")
 	@SaCheckPermission(TbOrder.PERMISSION_CODE_DEL)
 	public AjaxJson delete(Long id){
 		 tbOrderService.delete(id);
 		return AjaxJson.getSuccess();
 	}
-	
-	/** 删 - 根据id列表 */  
+
+	/** 删 - 根据id列表 */
 	@RequestMapping("deleteByIds")
 	@SaCheckPermission(TbOrder.PERMISSION_CODE_DEL)
 	public AjaxJson deleteByIds(){
-		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
 		int line = SP.publicMapper.deleteByIds(TbOrder.TABLE_NAME, ids);
 		return AjaxJson.getByLine(line);
 	}
-	
-	/** 改 */  
+
+	/** 改 */
 	@RequestMapping("update")
 	@SaCheckPermission(TbOrder.PERMISSION_CODE_EDIT)
 	public AjaxJson update(TbOrder t){
@@ -57,37 +49,40 @@ public class TbOrderController {
 		return AjaxJson.getSuccess();
 	}
 
-	/** 查 - 根据id */  
+	/** 查 - 根据id */
 	@RequestMapping("getById")
-		@SaCheckPermission(TbOrder.PERMISSION_CODE)
+	@SaCheckPermission(TbOrder.PERMISSION_CODE)
 	public AjaxJson getById(Long id){
 		TbOrder t = tbOrderService.getById(id);
 		return AjaxJson.getSuccessData(t);
 	}
 
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
 	@RequestMapping("getList")
-//		@SaCheckPermission(TbOrder.PERMISSION_CODE)
-	public AjaxJson getList() { 
+	@SaCheckPermission(TbOrder.PERMISSION_CODE)
+	public AjaxJson getList() {
 		SoMap so = SoMap.getRequestSoMap();
 		List<TbOrder> list = tbOrderService.getList(so.startPage());
 		return AjaxJson.getPageData(so.getDataCount(), list);
 	}
-	
-	
-	
-	/** 改 - 删除状态(0=禁用,1=启用) */  
+
+
+	/** 改 - 删除状态(0=禁用,1=启用) */
 	@RequestMapping("updateDeleteStatus")
 	@SaCheckPermission(TbOrder.PERMISSION_CODE_EDIT)
 	public AjaxJson updateDeleteStatus(Long id, Integer value){
 		int line = SP.publicMapper.updateColumnById(TbOrder.TABLE_NAME, "delete_status", value, id);
 		return AjaxJson.getByLine(line);
 	}
-	
-	
 
-	
-	
-	
+
+
+	/*-----           正常业务逻辑👆👆    rpc远程调用👇👇 -----*/
+
+	/** 系统接收到航通接口信息:车辆已出一级市场 ,相对应的一级市场订单状态修改 **/
+	@RequestMapping("rpc/orderFinish")
+	public boolean orderFinish(@RequestParam("billCode") String billCode) {
+		return tbOrderService.orderFinish(billCode);
+	}
 
 }

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

@@ -86,6 +86,7 @@
 			<if test=' this.has("peopleConfirmType") '> and people_confirm_type = #{peopleConfirmType} </if>
 			<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>
 		</where>
 		order by
 		<choose>
@@ -143,13 +144,10 @@
 		</choose>
 	</select>
 
-
-
-
-
-
-
-
+	<select id="getConfirmStatus" resultType="com.pj.tb_order.vo.ConfirmVo">
+		select id orderId,people_confirm_status,cooper_entrust_status,apply_confirm_status from tb_order
+		where id = #{orderId}
+	</select>
 
 
 </mapper>

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

@@ -415,7 +415,6 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 		FeignFactory.asyncServerInterface.sendConfirm(peopleConfirmDTO);
 	}
 
-
 	/**
 	 *  互助委托申报确认
 	 * @param orderId 一级市场订单表ID
@@ -438,17 +437,24 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 		return result;
 	}
 
+
+	/*-----           正常业务逻辑👆👆    rpc远程调用👇👇 -----*/
+
+
 	// TODO: 2023/8/28 系统接收到航通接口信息:车辆已出一级市场
-	public void orderFinish(Long[] ids){
+	public boolean orderFinish(String billCode){
 		//1、todo: 调用银行接口发起划扣:将边民划扣至银行第三方账户的货款,支付至外籍商户的账户
 		//收到划扣成功回执后,方法往下制行
 
 		//2、修改一级市场订单支付状态为已支付,修改一级市场订单完成状态为已完成
 		//获取登录人
 		APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
-		TbOrder order = new TbOrder();
-		for (Long id : ids) {
-			order.setId(id);
+		//获取出了一级市场的所有边民订单
+		LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
+		wrapper.eq(TbOrder::getPreNo, billCode);
+		List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
+
+		tbOrders.forEach(order -> {
 			order.setTradeStatus(TradeStatus.TRADE_STATUS_ONE.getCode()); //已支付
 			order.setTradeTime(new Date()); //支付时间
 			order.setPayType(0); //支付类型
@@ -459,26 +465,24 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 			order.setUpdateTime(new Date());
 
 			boolean result = updateById(order);
-			if(!result) throw new RuntimeException("当前订单状态修改失败,请联系管理员!");
-
-			//todo:通知边民转售已经采购的商品;边民上架商品,初步定价
-			TbOrder t = getById(id);
-			MessageDto dto = new MessageDto();
-			dto.setUrl("/pages/market/one/leader/order");
-			dto.setUserId(t.getBuyUserId());
-			dto.setContents("你采购的《" + t.getGoodsNames() + "》订单已完成。请及时上架商品到二级市场。");
-			adminInterface.messageSave(dto);
-		}
-
-		//3、todo: 调用航通接口,发送划扣成功回执信息给航通(只发送)
-		OrderDto tbOrderDto = new OrderDto();
-		BeanUtils.copyProperties(order,tbOrderDto);
-		asyncServerInterface.sendLevelOneOrderDto(tbOrderDto,DataType.DATA_TYPE_THREE.getCode());
-	}
+			//修改失败记录是否应该存表??
+			//if(!result) throw new RuntimeException("当前订单状态修改失败,请联系管理员!");
+
+			if(result) {
+				//todo:通知边民转售已经采购的商品;边民上架商品,初步定价
+				MessageDto dto = new MessageDto();
+				dto.setUrl("/pages/market/one/leader/order");
+				dto.setUserId(order.getBuyUserId());
+				dto.setContents("你采购的《" + order.getGoodsNames() + "》订单已完成。请及时上架商品到二级市场。");
+				adminInterface.messageSave(dto);
+			}
+		});
 
+		//3、todo: 调用航通接口,发送划扣成功回执信息给航通(只发送),航通暂未提供此接口
 
+		return true;
+	}
 
-	/*-----           正常业务逻辑👆👆    rpc远程调用👇👇 -----*/
 
 	/** 远程调用:根据时间和登陆人查询订单 */
 	public List<OrderDto> selectOrderList( Long appUserId){