no message
This commit is contained in:
@ -82,6 +82,13 @@ public class SendDataController {
|
||||
return sendDataService.sendSubOrderToBattery(Long.parseLong(id));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "接收充电同步数据接口")
|
||||
@GetMapping("/OrderMeal/{id}")
|
||||
public Map<String,String> sendUserMeal(@PathVariable String id){
|
||||
log.info("/OrderMeal 接收用户订单套餐数据:{}",id);
|
||||
return sendDataService.sendUserMeal(Long.parseLong(id));
|
||||
}
|
||||
|
||||
|
||||
// @ApiOperation(value = "异步接收充电同步数据接口")
|
||||
// @GetMapping("/subOrder/{id}")
|
||||
|
||||
@ -21,4 +21,6 @@ public interface OrderBatteryInfoMapper extends BaseMapper<OrderBatteryInfo> {
|
||||
OrderBatteryInfo selectOrderBatteryInfoById(@Param("id") Long id);
|
||||
|
||||
String selectOrderStatus(@Param("suborderId") Long suborderId);
|
||||
|
||||
OrderBatteryInfo selectUserBatteryMealById(@Param("id") Long id);
|
||||
}
|
||||
|
||||
@ -21,6 +21,8 @@ public interface SendDataService {
|
||||
Map<String, String> sendStoreInfoToBattery(Long id);
|
||||
|
||||
Map<String,String> sendSubOrderToBattery(Long id);
|
||||
|
||||
Map<String,String> sendUserMeal(Long id);
|
||||
/**
|
||||
* 异步转发数据到第三方平台
|
||||
*
|
||||
|
||||
@ -341,6 +341,36 @@ public class SendDataServiceImpl implements SendDataService {
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Map<String,String> sendUserMeal(Long id) {
|
||||
OrderBatteryInfo orderBatteryInfo = orderBatteryInfoMapper.selectUserBatteryMealById(id);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
||||
String response = thirdPartyForwardService.forwardData(URL+"/check_meal",JSON.toJSONString(orderBatteryInfo));
|
||||
JSONObject jsonObject = JSON.parseObject(response);
|
||||
String status = jsonObject.get("status").toString();
|
||||
|
||||
if (status.equals("40001") || status.equals("40002") || status.equals("40003") || status.equals("40005") || status.equals("40006")){
|
||||
map.put("code",status);
|
||||
map.put("msg",jsonObject.get("msg").toString());
|
||||
return map;
|
||||
}else if (status.equals("200")){
|
||||
String bOrdNo = jsonObject.get("order_no").toString();
|
||||
companyStoreMapper.updateOdId(bOrdNo,id);
|
||||
map.put("code",status);
|
||||
map.put("msg","发送成功");
|
||||
return map;
|
||||
}else if (status.equals("401")){
|
||||
map.put("code",status);
|
||||
map.put("msg","鉴权失败");
|
||||
return map;
|
||||
}
|
||||
map.put("code","500");
|
||||
map.put("msg","系统异常");
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
private boolean saveRecord(SyncRequest request,String url,Long id,String dataType) {
|
||||
|
||||
|
||||
@ -22,8 +22,8 @@
|
||||
SELECT
|
||||
zom.customer_phone AS phone,
|
||||
zrb.meal_id AS meal_id,
|
||||
zos.created_at AS start_date,
|
||||
zos.return_time AS end_date,
|
||||
zom.start_rent_time AS start_date,
|
||||
zom.end_rent_time AS end_date,
|
||||
zcs.city_id as city,
|
||||
zcs.id as store,
|
||||
zrb.category_id as category,
|
||||
@ -46,4 +46,23 @@
|
||||
<select id="selectOrderStatus" parameterType="java.lang.Long" resultType="java.lang.String">
|
||||
select m.order_status from zc_order_main m,zc_order_sub s where s.order_id = m.order_id and s.suborder_id = #{suborderId}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectUserBatteryMealById" resultMap="OrderBatteryInfoMap">
|
||||
SELECT
|
||||
zom.customer_phone AS phone,
|
||||
zrb.meal_id AS meal_id
|
||||
FROM
|
||||
zc_order_main AS zom,
|
||||
zc_order_sub AS zos,
|
||||
zc_rent_battey_rule AS zrb,
|
||||
zc_company_store AS zcs
|
||||
WHERE
|
||||
zom.rent_battey_rule_id = zrb.id
|
||||
AND zom.order_id = zos.order_id
|
||||
AND suborder_type = 'RENTBATTEY'
|
||||
and zom.store_id = zcs.id
|
||||
and zos.suborder_id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user