| @@ -194,7 +194,8 @@ | |||||
| software.amazon.ion, | software.amazon.ion, | ||||
| tk.mybatis, | tk.mybatis, | ||||
| xmlpull, | xmlpull, | ||||
| xpp3 | |||||
| xpp3, | |||||
| com.hikvision.ga | |||||
| </excludeGroupIds> | </excludeGroupIds> | ||||
| </configuration> | </configuration> | ||||
| </plugin> | </plugin> | ||||
| @@ -10,6 +10,7 @@ import com.iformall.domain.po.WxMallFloor; | |||||
| import com.iformall.domain.po.WxUserDataRule; | import com.iformall.domain.po.WxUserDataRule; | ||||
| import com.iformall.enums.EnumYesOrNo; | import com.iformall.enums.EnumYesOrNo; | ||||
| import com.iformall.service.WxMallBuildingService; | import com.iformall.service.WxMallBuildingService; | ||||
| import com.iformall.service.util.UserDateRuleCacheUtils; | |||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| import com.iformall.utils.RedisCacheUtils; | import com.iformall.utils.RedisCacheUtils; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| @@ -86,6 +87,7 @@ public class WxMallBuildingController extends BaseController { | |||||
| String key = Constant.mallBuildingPrev + getTenantInfo().getTenantId(); | String key = Constant.mallBuildingPrev + getTenantInfo().getTenantId(); | ||||
| RedisCacheUtils.removeCache(objectCommonRedisTemplate, key); | RedisCacheUtils.removeCache(objectCommonRedisTemplate, key); | ||||
| UserDateRuleCacheUtils.removeMallBuildCacheAll(objectCommonRedisTemplate); | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @@ -1,7 +1,172 @@ | |||||
| user_basic_info_address_28 拷贝到user_basic_info_address_8, user_basic_info_address_20 | |||||
| wx_c_user_basic_child_28 拷贝到wx_c_user_basic_child_8,wx_c_user_basic_child_20 | |||||
| wx_c_user_basic_info_28 拷贝到wx_c_user_basic_info_8,wx_c_user_basic_info_20 | |||||
| wx_c_user_basic_sign_28 拷贝到wx_c_user_basic_sign_8,wx_c_user_basic_sign_20 | |||||
| wx_c_user_tags_28 拷贝到 wx_c_user_tags_8,wx_c_user_tags_20 | |||||
| wx_level_config 拷贝 | |||||
| wx_mall更新,缓存更新 | |||||
| update wx_merchant set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update mall_resource set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update mall_role set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update mall_role_permission set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update mall_user_action set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update mall_user_info set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| //清除sysconfig缓存 | |||||
| update sys_config_value set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_activity set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_activity_join set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| //清除appinfo缓存 | |||||
| #user_basic_info_address_28 拷贝到user_basic_info_address_8, user_basic_info_address_20 | |||||
| insert into user_basic_info_address_8 select * from user_basic_info_address_28; | |||||
| insert into user_basic_info_address_20 select * from user_basic_info_address_28; | |||||
| create table user_basic_info_address_28_bak like user_basic_info_address_28; | |||||
| insert into user_basic_info_address_28_bak select * from user_basic_info_address_28; | |||||
| delete from user_basic_info_address_28; | |||||
| update user_basic_info_address_8 set tenant_id = ',1008,',parent_tenant_id = null,final_tenant_id ='1008'; | |||||
| update user_basic_info_address_20 set tenant_id = ',1020,',parent_tenant_id = null,final_tenant_id ='1020'; | |||||
| update wx_batch_order_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_batch_order_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| #wx_business_28拷贝到wx_business_8,wx_business_20 | |||||
| insert into wx_business_8 select * from wx_business_28; | |||||
| insert into wx_business_20 select * from wx_business_28; | |||||
| create table wx_business_28_bak like wx_business_20; | |||||
| insert into wx_business_28_bak select * from wx_business_20; | |||||
| UPDATE wx_business_8 SET final_tenant_id = '1008' ; | |||||
| UPDATE wx_business_20 SET final_tenant_id = '1020'; | |||||
| delete from wx_business_28; | |||||
| update wx_c_user_8 set parent_tenant_id = null ; | |||||
| update wx_c_user_20 set parent_tenant_id = null ; | |||||
| #wx_c_user_basic_child_28 拷贝到wx_c_user_basic_child_8,wx_c_user_basic_child_20 | |||||
| insert into wx_c_user_basic_child_8 select * from wx_c_user_basic_child_28; | |||||
| insert into wx_c_user_basic_child_20 select * from wx_c_user_basic_child_28; | |||||
| create table wx_c_user_basic_child_28_bak like wx_c_user_basic_child_28; | |||||
| insert into wx_c_user_basic_child_28_bak select * from wx_c_user_basic_child_28; | |||||
| delete from wx_c_user_basic_child_28; | |||||
| update wx_c_user_basic_child_8 set tenant_id = '1008'; | |||||
| update wx_c_user_basic_child_20 set tenant_id = '1020'; | |||||
| #wx_c_user_basic_info_28 拷贝到wx_c_user_basic_info_8,wx_c_user_basic_info_20 | |||||
| insert into wx_c_user_basic_info_8 select * from wx_c_user_basic_info_28; | |||||
| insert into wx_c_user_basic_info_20 select * from wx_c_user_basic_info_28; | |||||
| create table wx_c_user_basic_info_28_bak like wx_c_user_basic_info_28; | |||||
| insert into wx_c_user_basic_info_28_bak select * from wx_c_user_basic_info_28; | |||||
| delete from wx_c_user_basic_info_28; | |||||
| update wx_c_user_basic_info_8 set tenant_id = ',1008,',parent_tenant_id = null,final_tenant_id ='1008'; | |||||
| update wx_c_user_basic_info_20 set tenant_id = ',1020,',parent_tenant_id = null,final_tenant_id ='1020'; | |||||
| #wx_c_user_basic_sign_28 拷贝到wx_c_user_basic_sign_8,wx_c_user_basic_sign_20 | |||||
| insert into wx_c_user_basic_sign_8 select * from wx_c_user_basic_sign_28; | |||||
| insert into wx_c_user_basic_sign_20 select * from wx_c_user_basic_sign_28; | |||||
| create table wx_c_user_basic_sign_28_bak like wx_c_user_basic_sign_28; | |||||
| insert into wx_c_user_basic_sign_28_bak select * from wx_c_user_basic_sign_28; | |||||
| delete from wx_c_user_basic_sign_28; | |||||
| update wx_c_user_basic_sign_8 set tenant_id = '1008',parent_tenant_id = null; | |||||
| update wx_c_user_basic_sign_20 set tenant_id = '1020',parent_tenant_id = null; | |||||
| update wx_c_user_from_8 set parent_tenant_id = null; | |||||
| update wx_c_user_from_20 set parent_tenant_id = null; | |||||
| #wx_c_user_tags_28 拷贝到 wx_c_user_tags_8,wx_c_user_tags_20 | |||||
| insert into wx_c_user_tags_8 select * from wx_c_user_tags_28; | |||||
| insert into wx_c_user_tags_20 select * from wx_c_user_tags_28; | |||||
| create table wx_c_user_tags_28_bak like wx_c_user_tags_28; | |||||
| insert into wx_c_user_tags_28_bak select * from wx_c_user_tags_28; | |||||
| delete from wx_c_user_tags_28; | |||||
| update wx_c_user_tags_8 set tenant_id = '1008'; | |||||
| update wx_c_user_tags_20 set tenant_id = '1020'; | |||||
| update wx_campaign set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_campaign_join set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_card_daily_log set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_card_info set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_card_spend set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_card_transfer_info set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_action_log_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_action_log_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_batch_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_batch_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_batch_item_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_batch_item_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_channel_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_channel_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_inject set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_mall_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_mall_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_merchant_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_merchant_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_order_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_order_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_order_reservation_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_order_reservation_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_password set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_present set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_send set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_send_config set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_coupon_send_inject set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| #wx_credit_history_8, wx_credit_history_20更新parent_tenant_id 为null; | |||||
| insert into wx_credit_history_8 select * from wx_credit_history_28 where rules_tenant_id = '1008'; | |||||
| insert into wx_credit_history_20 select * from wx_credit_history_28 where rules_tenant_id = '1020'; | |||||
| create table wx_credit_history_28_bak like wx_credit_history_28; | |||||
| insert into wx_credit_history_28_bak select * from wx_credit_history_28; | |||||
| delete from wx_credit_history_28; | |||||
| update wx_credit_history_8 set tenant_id = '1008'; | |||||
| update wx_credit_history_20 set tenant_id = '1020'; | |||||
| update wx_customize_module set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_date_amount_record set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_flow_config set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_flow_model set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_flow_record set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_game set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_game_action_log set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_game_user_count set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| #wx_level_config 拷贝 | |||||
| update wx_level_config set tenant_id = '10281' where tenant_id = '1028'; | |||||
| update wx_level_merchant set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_mall set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_mall_building set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_mall_dispose set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_mall_floor set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_mall_notice_contact set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_mall_version set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_merchant_b_user set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_merchant_corp set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_merchant_relation set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_merchant_shop set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_merchant_subsidy_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_merchant_subsidy_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_merchant_tax set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_msg set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_msg_callback set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_msg_config set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_msg_limit set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_msg_model set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_msg_record set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_msg_signature set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_msg_validationcode set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_msg_validationcode_model_tenant set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_order_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_order_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_order_group_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_order_group_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_order_press_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_order_press_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_park set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_pay_account set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_pay_account_bill set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_pay_order_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_pay_order_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_press_batch_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_press_batch_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_press_batch_item_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_press_batch_item_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_profit_payment_receiver set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_profit_sharing_order_8 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_profit_sharing_order_20 set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_profit_sharing_receiver set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_refund_order set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| #wx_score_history_8,wx_score_history_20更新parent_tenant_id 为null; | |||||
| insert into wx_score_history_8 select * from wx_score_history_28 where rules_tenant_id = '1008'; | |||||
| insert into wx_score_history_20 select * from wx_score_history_28 where rules_tenant_id = '1020'; | |||||
| create table wx_score_history_28_bak like wx_score_history_28; | |||||
| insert into wx_score_history_28_bak select * from wx_score_history_28; | |||||
| delete from wx_score_history_28; | |||||
| update wx_score_history_8 set tenant_id = '1008'; | |||||
| update wx_score_history_20 set tenant_id = '1020'; | |||||
| update wx_shop set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_template_msg set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_topic set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_user_data_rule set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| update wx_user_visit set parent_tenant_id = null where tenant_id in ('1008','1020'); | |||||
| @@ -150,7 +150,8 @@ | |||||
| software.amazon.ion, | software.amazon.ion, | ||||
| tk.mybatis, | tk.mybatis, | ||||
| xmlpull, | xmlpull, | ||||
| xpp3 | |||||
| xpp3, | |||||
| com.hikvision.ga | |||||
| </excludeGroupIds> | </excludeGroupIds> | ||||
| </configuration> | </configuration> | ||||
| </plugin> | </plugin> | ||||
| @@ -156,7 +156,8 @@ | |||||
| software.amazon.ion, | software.amazon.ion, | ||||
| tk.mybatis, | tk.mybatis, | ||||
| xmlpull, | xmlpull, | ||||
| xpp3 | |||||
| xpp3, | |||||
| com.hikvision.ga | |||||
| </excludeGroupIds> | </excludeGroupIds> | ||||
| </configuration> | </configuration> | ||||
| </plugin> | </plugin> | ||||
| @@ -139,7 +139,7 @@ public class WxUserGrantController extends BaseController { | |||||
| @TenantIgnore | @TenantIgnore | ||||
| @PostMapping("/login") | @PostMapping("/login") | ||||
| @ApiOperation(value = "用户登录", notes = "{\"appId\":\"string\",\"code\":\"string\",\"scene\":\"string\",\"sceneAddress\":\"string\",\"latitude\":\"string\",\"longitude\":\"string\",\"systemInfo\":\"string\"}") | @ApiOperation(value = "用户登录", notes = "{\"appId\":\"string\",\"code\":\"string\",\"scene\":\"string\",\"sceneAddress\":\"string\",\"latitude\":\"string\",\"longitude\":\"string\",\"systemInfo\":\"string\"}") | ||||
| public ResultData userLogin(@RequestBody Map<String, String> map) { | |||||
| public ResultData login(@RequestBody Map<String, String> map) { | |||||
| logger.info("dologin >>>>>>>>>>>>>>>>>"+map.toString()); | logger.info("dologin >>>>>>>>>>>>>>>>>"+map.toString()); | ||||
| Map resultMap = new HashMap(); | Map resultMap = new HashMap(); | ||||
| @@ -152,7 +152,8 @@ | |||||
| software.amazon.ion, | software.amazon.ion, | ||||
| tk.mybatis, | tk.mybatis, | ||||
| xmlpull, | xmlpull, | ||||
| xpp3 | |||||
| xpp3, | |||||
| com.hikvision.ga | |||||
| </excludeGroupIds> | </excludeGroupIds> | ||||
| </configuration> | </configuration> | ||||
| </plugin> | </plugin> | ||||
| @@ -0,0 +1,214 @@ | |||||
| package com.iformall.controller.callback.car.haikangweishi; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.controller.callback.car.WxParkCallBackBaseController; | |||||
| import com.iformall.enums.EnumCarCmd; | |||||
| import com.iformall.enums.EnumCarVendor; | |||||
| import com.iformall.service.*; | |||||
| import lombok.extern.slf4j.Slf4j; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.PostMapping; | |||||
| import org.springframework.web.bind.annotation.RequestBody; | |||||
| import org.springframework.web.bind.annotation.RequestMapping; | |||||
| import org.springframework.web.bind.annotation.RestController; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * @author: furunxin | |||||
| * @Date: 2020/7/6 15:29 | |||||
| * @Description: 海康威视回调接口 | |||||
| */ | |||||
| @Slf4j | |||||
| @RestController | |||||
| @RequestMapping("/hkwsv3CarCallback") | |||||
| public class WxCarHaiKangWeiShiV3CallBackController extends WxParkCallBackBaseController { | |||||
| @Autowired | |||||
| WxParkService wxParkService; | |||||
| @Autowired | |||||
| WxCarCmdLogService wxCarCmdLogService; | |||||
| @Autowired | |||||
| WxCUserService wxCUserService; | |||||
| @Autowired | |||||
| WxCUserCarService wxCUserCarService; | |||||
| @Autowired | |||||
| WxCouponSendService wxCouponSendService; | |||||
| @Autowired | |||||
| WxCarPayRecordService wxCarPayRecordService; | |||||
| @Autowired | |||||
| WxCUserBasicInfoService wxCUserBasicInfoService; | |||||
| /** | |||||
| * 入场事件: | |||||
| { | |||||
| "method":"OnEventNotify", | |||||
| "params":{ | |||||
| "ability":"vehicle_pass_in_event", | |||||
| "eventType":771760131, | |||||
| "events":[ | |||||
| { | |||||
| "crossTime":"2021-07-01T17:29:27+08:00", | |||||
| "crossType":1, | |||||
| "eventIndexCode":"74b64514-4888-4f42-8cf7-22fed37d5dc8", | |||||
| "eventType":3, | |||||
| "resource":{ | |||||
| "deviceId":"3715149265421676", | |||||
| "deviceSerial":"R20150664", | |||||
| "direction":0, | |||||
| "entranceId":"2063867554789264", | |||||
| "entranceName":"前门1", | |||||
| "parkId":"2064637172217744", | |||||
| "parkName":"车库", | |||||
| "resType":"roadway", | |||||
| "roadWayId":"2064272439342992", | |||||
| "roadWayName":"前门入口" | |||||
| }, | |||||
| "stopType":11, | |||||
| "vehicle":{ | |||||
| "plateColor":12, | |||||
| "plateNo":"苏A23658", | |||||
| "plateType":8, | |||||
| "vehicleColor":12, | |||||
| "vehicleType":12 | |||||
| } | |||||
| } | |||||
| ], | |||||
| "sendTime":"2021-07-01T17:29:29.315+08:00" | |||||
| } | |||||
| } | |||||
| 3 出场事件: | |||||
| { | |||||
| "method":"OnEventNotify", | |||||
| "params":{ | |||||
| "ability":"vehicle_pass_out_event", | |||||
| "eventType":771760134, | |||||
| "events":[ | |||||
| { | |||||
| "crossTime":"2021-07-01T17:31:17+08:00", | |||||
| "crossType":1, | |||||
| "eventIndexCode":"a5464f46-ba7b-4059-b657-5ebc2f3774a9", | |||||
| "eventType":4, | |||||
| "resource":{ | |||||
| "deviceId":"370573791833424", | |||||
| "deviceSerial":"9b1037b5-8a95-4657-81f0-edf27f71d92f", | |||||
| "direction":1, | |||||
| "entranceId":"2063867554789264", | |||||
| "entranceName":"前门1", | |||||
| "parkId":"2064637172217744", | |||||
| "parkName":"车库", | |||||
| "resType":"roadway", | |||||
| "roadWayId":"2064664422217616", | |||||
| "roadWayName":"前门出口test" | |||||
| }, | |||||
| "stopType":11, | |||||
| "vehicle":{ | |||||
| "plateColor":12, | |||||
| "plateNo":"苏A23658", | |||||
| "plateType":8, | |||||
| "vehicleColor":12, | |||||
| "vehicleType":12 | |||||
| } | |||||
| } | |||||
| ], | |||||
| "sendTime":"2021-07-01T17:31:17.337+08:00" | |||||
| } | |||||
| } | |||||
| 4 图片事件: | |||||
| { | |||||
| "method":"OnEventNotify", | |||||
| "params":{ | |||||
| "ability":"vehicle_pass_out_event", | |||||
| "eventType":771760144, | |||||
| "events":[ | |||||
| { | |||||
| "crossTime":"2021-07-01T17:31:17+08:00", | |||||
| "crossType":1, | |||||
| "eventIndexCode":"a5464f46-ba7b-4059-b657-5ebc2f3774a9", | |||||
| "eventType":4, | |||||
| "resource":{ | |||||
| "deviceId":"370573791833424", | |||||
| "deviceSerial":"9b1037b5-8a95-4657-81f0-edf27f71d92f", | |||||
| "direction":1, | |||||
| "entranceId":"2063867554789264", | |||||
| "entranceName":"前门1", | |||||
| "parkId":"2064637172217744", | |||||
| "parkName":"车库", | |||||
| "resType":"roadway", | |||||
| "roadWayId":"2064664422217616", | |||||
| "roadWayName":"前门出口test" | |||||
| }, | |||||
| "stopType":11, | |||||
| "vehicle":{ | |||||
| "plateColor":12, | |||||
| "plateNo":"苏A23658", | |||||
| "plateNoPicUrl":"62834762", | |||||
| "plateType":8, | |||||
| "vehicleColor":12, | |||||
| "vehiclePicUrl":"62834762", | |||||
| "vehicleType":12 | |||||
| } | |||||
| } | |||||
| ], | |||||
| "sendTime":"2021-07-01T17:31:19.659+08:00" | |||||
| } | |||||
| } | |||||
| * @param paramMap | |||||
| * @return | |||||
| * | |||||
| * 这个接口需要你们实现的时候规定下: | |||||
| 1、POST格式, | |||||
| 2、接口返回参数JSON格式:{errcode:0, errmsg: "success",data:null} | |||||
| 3、接口建议接收到过车事件,立即返回接收成功 | |||||
| * | |||||
| */ | |||||
| @PostMapping(value = "/notify") | |||||
| public Map notify(@RequestBody Map<String, Object> paramMap) { | |||||
| Map retMap = new HashMap(); | |||||
| try { | |||||
| log.info("["+getIpAddr()+"] hkwsv2CarCallback notify: " + paramMap.toString()); | |||||
| Map params = (Map)paramMap.get("params"); | |||||
| String eventType = params.get("eventType").toString(); | |||||
| Result result = null; | |||||
| if ("771760131".equals(eventType)) { | |||||
| //解析车易付参数 | |||||
| result = super.parkInCallBack(EnumCarVendor.CAR_HAIKANGWEISHI_V2, EnumCarCmd.CAR_HAIKANGWEISHI_V2_CALLBACK_PARK_IN, paramMap); | |||||
| }else if ("771760134".equals(eventType)) { | |||||
| result = super.parkOutCallBack(EnumCarVendor.CAR_HAIKANGWEISHI_V2, EnumCarCmd.CAR_HAIKANGWEISHI_V2_CALLBACK_PARK_OUT, paramMap); | |||||
| } | |||||
| int errcode = 0; | |||||
| String msg = "success"; | |||||
| if (null != result) { | |||||
| if (result.code != Result.SUCCESS) { | |||||
| errcode = result.code; | |||||
| msg = result.message; | |||||
| } | |||||
| }else { | |||||
| errcode = Result.ERROR; | |||||
| msg = "no result.eventType["+eventType+"]"; | |||||
| } | |||||
| retMap.put("errcode", errcode); | |||||
| retMap.put("errmsg", msg); | |||||
| } catch(Exception e) { | |||||
| retMap.put("errcode", Result.ERROR); | |||||
| retMap.put("errmsg", "notify error."+e.getLocalizedMessage()); | |||||
| log.error("haikangweishiv2 notity error "+paramMap.toString(),e); | |||||
| } | |||||
| retMap.put("data", null); | |||||
| return retMap; | |||||
| } | |||||
| } | |||||
| @@ -147,7 +147,8 @@ | |||||
| software.amazon.ion, | software.amazon.ion, | ||||
| tk.mybatis, | tk.mybatis, | ||||
| xmlpull, | xmlpull, | ||||
| xpp3 | |||||
| xpp3, | |||||
| com.hikvision.ga | |||||
| </excludeGroupIds> | </excludeGroupIds> | ||||
| </configuration> | </configuration> | ||||
| </plugin> | </plugin> | ||||
| @@ -145,7 +145,8 @@ | |||||
| software.amazon.ion, | software.amazon.ion, | ||||
| tk.mybatis, | tk.mybatis, | ||||
| xmlpull, | xmlpull, | ||||
| xpp3 | |||||
| xpp3, | |||||
| com.hikvision.ga | |||||
| </excludeGroupIds> | </excludeGroupIds> | ||||
| </configuration> | </configuration> | ||||
| </plugin> | </plugin> | ||||
| @@ -147,7 +147,8 @@ | |||||
| software.amazon.ion, | software.amazon.ion, | ||||
| tk.mybatis, | tk.mybatis, | ||||
| xmlpull, | xmlpull, | ||||
| xpp3 | |||||
| xpp3, | |||||
| com.hikvision.ga | |||||
| </excludeGroupIds> | </excludeGroupIds> | ||||
| </configuration> | </configuration> | ||||
| </plugin> | </plugin> | ||||
| @@ -45,6 +45,11 @@ | |||||
| <artifactId>jsoup</artifactId> | <artifactId>jsoup</artifactId> | ||||
| <version>1.13.1</version> | <version>1.13.1</version> | ||||
| </dependency> | </dependency> | ||||
| <dependency> | |||||
| <groupId>com.hikvision.ga</groupId> | |||||
| <artifactId>artemis-http-client</artifactId> | |||||
| <version>1.1.13.RELEASE</version> | |||||
| </dependency> | |||||
| </dependencies> | </dependencies> | ||||
| </project> | </project> | ||||
| @@ -13,6 +13,7 @@ public enum EnumCarVendor { | |||||
| CAR_JIESHUN_V2(10,"JIESHUNV2",true),//捷顺通用版本 | CAR_JIESHUN_V2(10,"JIESHUNV2",true),//捷顺通用版本 | ||||
| CAR_HAIKANGWEISHI(8,"HAIKANGWEISHI",true), | CAR_HAIKANGWEISHI(8,"HAIKANGWEISHI",true), | ||||
| CAR_HAIKANGWEISHI_V2(18,"HAIKANGV2",true), | CAR_HAIKANGWEISHI_V2(18,"HAIKANGV2",true), | ||||
| CAR_HAIKANGWEISHI_V3(19,"HAIKANGV3",true), | |||||
| CAR_FUTE(9,"FUTE",false),//深圳市福特智能科技有限公司 | CAR_FUTE(9,"FUTE",false),//深圳市福特智能科技有限公司 | ||||
| CAR_KETUO(11,"KETUO",false),//科拓停车 | CAR_KETUO(11,"KETUO",false),//科拓停车 | ||||
| CAR_LIFANG(12,"LIFANG",false),// 立方【接口不支持未接通,不能使用】 | CAR_LIFANG(12,"LIFANG",false),// 立方【接口不支持未接通,不能使用】 | ||||
| @@ -1083,18 +1083,20 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { | |||||
| .select(WxCouponSend::getConditions) | .select(WxCouponSend::getConditions) | ||||
| .eq(WxCouponSend::getTenantId, mallTenantId) | .eq(WxCouponSend::getTenantId, mallTenantId) | ||||
| .in(!CollectionUtils.isEmpty(couponIdList), WxCouponSend::getCouponId, couponIdList)); | .in(!CollectionUtils.isEmpty(couponIdList), WxCouponSend::getCouponId, couponIdList)); | ||||
| List<Long> sendMerchantIds = couponSends.stream().filter(x -> StringUtils.isNotBlank(x.getConditions())).map(x -> { | |||||
| JSONObject jsonObject = new JSONObject(); | |||||
| try { | |||||
| jsonObject = JSONObject.parseObject(x.getConditions()); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return jsonObject.getLong("id"); | |||||
| }).collect(Collectors.toList()); | |||||
| Set<Long> merchantIdsSet = new HashSet<>(merchantIds); | |||||
| merchantIdsSet.addAll(sendMerchantIds); | |||||
| mallMerchantIdList.put(mallTenantId, new ArrayList<>(merchantIdsSet)); | |||||
| if (null != couponSends) { | |||||
| List<Long> sendMerchantIds = couponSends.stream().filter(x -> StringUtils.isNotBlank(x.getConditions())).map(x -> { | |||||
| JSONObject jsonObject = new JSONObject(); | |||||
| try { | |||||
| jsonObject = JSONObject.parseObject(x.getConditions()); | |||||
| } catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| } | |||||
| return jsonObject.getLong("id"); | |||||
| }).collect(Collectors.toList()); | |||||
| Set<Long> merchantIdsSet = new HashSet<>(merchantIds); | |||||
| merchantIdsSet.addAll(sendMerchantIds); | |||||
| mallMerchantIdList.put(mallTenantId, new ArrayList<>(merchantIdsSet)); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -14,6 +14,8 @@ import com.iformall.service.park.impl.haikangweishi.HaiKangWeiShiParkCallbackSer | |||||
| import com.iformall.service.park.impl.haikangweishi.HaiKangWeiShiParkService; | import com.iformall.service.park.impl.haikangweishi.HaiKangWeiShiParkService; | ||||
| import com.iformall.service.park.impl.haikangweishiv2.HaiKangWeiShiV2ParkCallbackService; | import com.iformall.service.park.impl.haikangweishiv2.HaiKangWeiShiV2ParkCallbackService; | ||||
| import com.iformall.service.park.impl.haikangweishiv2.HaiKangWeiShiV2ParkService; | import com.iformall.service.park.impl.haikangweishiv2.HaiKangWeiShiV2ParkService; | ||||
| import com.iformall.service.park.impl.haikangweishiv3.HaiKangWeiShiV3ParkCallbackService; | |||||
| import com.iformall.service.park.impl.haikangweishiv3.HaiKangWeiShiV3ParkService; | |||||
| import com.iformall.service.park.impl.jieshun.JieShunParkCallbackService; | import com.iformall.service.park.impl.jieshun.JieShunParkCallbackService; | ||||
| import com.iformall.service.park.impl.jieshun.JieShunParkService; | import com.iformall.service.park.impl.jieshun.JieShunParkService; | ||||
| import com.iformall.service.park.impl.jieshunV2.JieShunV2ParkCallbackService; | import com.iformall.service.park.impl.jieshunV2.JieShunV2ParkCallbackService; | ||||
| @@ -52,6 +54,8 @@ public class ParkFactory { | |||||
| @Autowired | @Autowired | ||||
| HaiKangWeiShiV2ParkService haikangWeishiV2Service; | HaiKangWeiShiV2ParkService haikangWeishiV2Service; | ||||
| @Autowired | @Autowired | ||||
| HaiKangWeiShiV3ParkService haikangWeishiV3Service; | |||||
| @Autowired | |||||
| FuteParkService futeParkService; | FuteParkService futeParkService; | ||||
| @Autowired | @Autowired | ||||
| LiFangParkService lifangParkService; | LiFangParkService lifangParkService; | ||||
| @@ -71,6 +75,8 @@ public class ParkFactory { | |||||
| @Autowired | @Autowired | ||||
| HaiKangWeiShiV2ParkCallbackService haikangWeishiV2CallBackService; | HaiKangWeiShiV2ParkCallbackService haikangWeishiV2CallBackService; | ||||
| @Autowired | @Autowired | ||||
| HaiKangWeiShiV3ParkCallbackService haikangWeishiV3CallBackService; | |||||
| @Autowired | |||||
| FuteParkCallbackService futeParkCallbackService; | FuteParkCallbackService futeParkCallbackService; | ||||
| @Autowired | @Autowired | ||||
| LiFangParkCallbackService lifangParkCallbackService; | LiFangParkCallbackService lifangParkCallbackService; | ||||
| @@ -98,6 +104,7 @@ public class ParkFactory { | |||||
| parkServiceMap.put(EnumCarVendor.CAR_JIESHUN_V2.getCode(), jieshunV2Service); | parkServiceMap.put(EnumCarVendor.CAR_JIESHUN_V2.getCode(), jieshunV2Service); | ||||
| parkServiceMap.put(EnumCarVendor.CAR_HAIKANGWEISHI.getCode(), haikangWeishiService); | parkServiceMap.put(EnumCarVendor.CAR_HAIKANGWEISHI.getCode(), haikangWeishiService); | ||||
| parkServiceMap.put(EnumCarVendor.CAR_HAIKANGWEISHI_V2.getCode(), haikangWeishiV2Service); | parkServiceMap.put(EnumCarVendor.CAR_HAIKANGWEISHI_V2.getCode(), haikangWeishiV2Service); | ||||
| parkServiceMap.put(EnumCarVendor.CAR_HAIKANGWEISHI_V3.getCode(), haikangWeishiV3Service); | |||||
| parkServiceMap.put(EnumCarVendor.CAR_FUTE.getCode(), futeParkService); | parkServiceMap.put(EnumCarVendor.CAR_FUTE.getCode(), futeParkService); | ||||
| parkServiceMap.put(EnumCarVendor.CAR_LIFANG.getCode(), lifangParkService); | parkServiceMap.put(EnumCarVendor.CAR_LIFANG.getCode(), lifangParkService); | ||||
| parkServiceMap.put(EnumCarVendor.CAR_KETUO.getCode(), keTuoParkService); | parkServiceMap.put(EnumCarVendor.CAR_KETUO.getCode(), keTuoParkService); | ||||
| @@ -124,6 +131,7 @@ public class ParkFactory { | |||||
| callBackServiceMap.put(EnumCarVendor.CAE_CYF.getCode(), cyfCallbackService); | callBackServiceMap.put(EnumCarVendor.CAE_CYF.getCode(), cyfCallbackService); | ||||
| callBackServiceMap.put(EnumCarVendor.CAR_FUTE.getCode(), futeParkCallbackService); | callBackServiceMap.put(EnumCarVendor.CAR_FUTE.getCode(), futeParkCallbackService); | ||||
| callBackServiceMap.put(EnumCarVendor.CAR_HAIKANGWEISHI_V2.getCode(), haikangWeishiV2CallBackService); | callBackServiceMap.put(EnumCarVendor.CAR_HAIKANGWEISHI_V2.getCode(), haikangWeishiV2CallBackService); | ||||
| callBackServiceMap.put(EnumCarVendor.CAR_HAIKANGWEISHI_V3.getCode(), haikangWeishiV3CallBackService); | |||||
| callBackServiceMap.put(EnumCarVendor.CAR_LIFANG.getCode(), lifangParkCallbackService); | callBackServiceMap.put(EnumCarVendor.CAR_LIFANG.getCode(), lifangParkCallbackService); | ||||
| callBackServiceMap.put(EnumCarVendor.CAR_KETUO.getCode(), keTuoParkCallbackService); | callBackServiceMap.put(EnumCarVendor.CAR_KETUO.getCode(), keTuoParkCallbackService); | ||||
| callBackServiceMap.put(EnumCarVendor.CAR_DAHUA.getCode(), dahuaCallbackService); | callBackServiceMap.put(EnumCarVendor.CAR_DAHUA.getCode(), dahuaCallbackService); | ||||
| @@ -0,0 +1,104 @@ | |||||
| package com.iformall.service.park.impl.haikangweishiv3; | |||||
| import com.iformall.service.WxParkService; | |||||
| import com.iformall.service.park.ParkCallBackAdapterService; | |||||
| import com.iformall.service.park.entity.ParkNotifyParam; | |||||
| import com.iformall.service.park.impl.BaseParkService; | |||||
| import lombok.extern.slf4j.Slf4j; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.Date; | |||||
| import java.util.Map; | |||||
| @Slf4j | |||||
| @Service | |||||
| public class HaiKangWeiShiV3ParkCallbackService extends BaseParkService implements ParkCallBackAdapterService { | |||||
| @Autowired | |||||
| WxParkService wxParkService; | |||||
| /** | |||||
| * {card_number=, user_name=, park_id=1101780001, sign=001b2dbfa21089a14274c4d3e330cd82, in_channel_id=营销中心入口, | |||||
| * remark=正常入场, in_channel=2f48a7a9-1be5-406c-b078-51d3506adab2, park_flag=1, area_id=90221771-fe94-4cfd-80d7-c14e7c97e775, | |||||
| * empty_plot=3490, user_no=, car_type=36, uid=001, in_time=1676563040, car_number=湘A87M0K, c_type=通道扫牌, in_optname=监控室, | |||||
| * order_id=46eea0c8-8a0b-4583-9273-f9843a42ddec, in_image=} | |||||
| */ | |||||
| @Override | |||||
| public ParkNotifyParam parseInNoticyParam(Object param) { | |||||
| Map<String,Object> paramMap = (Map<String, Object>) param; | |||||
| String carNumber = paramMap.get("car_number").toString(); | |||||
| String parkCode = paramMap.get("park_id").toString(); | |||||
| String parkName = ""; | |||||
| String synId = paramMap.get("order_id").toString(); | |||||
| Integer inTime = (Integer)paramMap.get("in_time"); | |||||
| ParkNotifyParam p = new ParkNotifyParam(); | |||||
| p.setCarNumber(carNumber); | |||||
| p.setParkId(parkCode); | |||||
| p.setParkName(parkName); | |||||
| p.setSynId(synId); | |||||
| try { | |||||
| p.setEntranceTime(new Date(inTime.longValue()*1000)); | |||||
| } catch (Exception e) { | |||||
| log.error("fute entranceTime format error",e); | |||||
| return null; | |||||
| } | |||||
| return p; | |||||
| } | |||||
| /** | |||||
| * {out_channel=08497aa1-bc39-4223-9659-83fba2680082, sign=37316011fd7f4997f0937ae839246968, remark=正常出场, | |||||
| * in_channel=cdb95bb9-b43e-4a4c-83cc-99d0e5e1f7d4, empty_plot=19, car_type=36, duration=99, uid=001, total=0.0000, | |||||
| * freereasons=, out_image=, out_optname=监控室, pay_type=cash, in_optcode=001, reduce_amount=0.0000, out_time=1676562822, | |||||
| * card_number=, park_id=1101780001, in_channel_id=南门入口相机, auth_code=, in_time=1676556899, ouid=001, out_type=通道扫牌, | |||||
| * car_number=湘A67H9R, out_order_id=03d6973e-0276-4264-bd0a-5aee59e6cf98, c_type=通道扫牌, pay_channel=0, | |||||
| * amount_receivable=0.0000, in_optname=监控室, out_channel_id=南门出口直行相机, order_id=03d6973e-0276-4264-bd0a-5aee59e6cf98} | |||||
| */ | |||||
| @Override | |||||
| public ParkNotifyParam parseOutNoticyParam(Object param) { | |||||
| Map<String,Object> paramMap = (Map<String, Object>) param; | |||||
| String carNumber = paramMap.get("car_number").toString(); | |||||
| String parkCode = paramMap.get("park_id").toString(); | |||||
| String parkName = ""; | |||||
| String synId = paramMap.get("order_id").toString(); | |||||
| Integer inTime = (Integer)paramMap.get("in_time"); | |||||
| Integer outTime = (Integer)paramMap.get("out_time"); | |||||
| ParkNotifyParam p = new ParkNotifyParam(); | |||||
| p.setCarNumber(carNumber); | |||||
| p.setParkId(parkCode); | |||||
| p.setParkName(parkName); | |||||
| p.setSynId(synId); | |||||
| try { | |||||
| p.setEntranceTime(new Date(inTime.longValue()*1000)); | |||||
| } catch (Exception e) { | |||||
| log.error("fute entranceTime format error",e); | |||||
| return null; | |||||
| } | |||||
| try { | |||||
| p.setOutTime(new Date(outTime.longValue()*1000)); | |||||
| } catch (Exception e) { | |||||
| log.error("fute outTime format error",e); | |||||
| return null; | |||||
| } | |||||
| p.setFee(String.valueOf(paramMap.get("amount_receivable"))); | |||||
| return p; | |||||
| } | |||||
| @Override | |||||
| public ParkNotifyParam parseUnbindNoticyParam(Object param) { | |||||
| return null; | |||||
| } | |||||
| @Override | |||||
| public ParkNotifyParam parsePaidNoticyParam(Object param) { | |||||
| return null; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,244 @@ | |||||
| package com.iformall.service.park.impl.haikangweishiv3; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONArray; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.hikvision.artemis.sdk.config.ArtemisConfig; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxCUserBasicInfo; | |||||
| import com.iformall.domain.po.WxCoupon; | |||||
| import com.iformall.domain.po.WxPark; | |||||
| import com.iformall.domain.vo.WxCouponOrderCarCVo; | |||||
| import com.iformall.domain.vo.WxParkCouponConfig; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.service.park.ParkAdapterService; | |||||
| import com.iformall.service.park.entity.ParkCreatePayOrder; | |||||
| import com.iformall.service.park.entity.ParkNotifyPaid; | |||||
| import com.iformall.service.park.entity.ParkPaidNotifyResult; | |||||
| import com.iformall.service.park.entity.ParkStopFee; | |||||
| import com.iformall.service.park.impl.BaseParkService; | |||||
| import com.iformall.service.park.impl.util.ParkHelper; | |||||
| import com.iformall.utils.DateUtils; | |||||
| import com.iformall.utils.RedisCacheUtils; | |||||
| import com.iformall.utils.RedisLock; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.beans.factory.annotation.Qualifier; | |||||
| import org.springframework.data.redis.core.RedisTemplate; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.math.BigDecimal; | |||||
| import java.time.format.DateTimeFormatter; | |||||
| import java.util.Date; | |||||
| import java.util.Map; | |||||
| /** | |||||
| * 海康停车 | |||||
| * 本地部署。需要本地系统安装之后获取appKey,appSercet | |||||
| * https://open.hikvision.com/docs/docId?productId=5c67f1e2f05948198c909700&version=%2F29c78ef52ca842c7933bd2b8e051e9d0&tagPath=API%E5%88%97%E8%A1%A8-%E8%BD%A6%E8%BE%86%E7%AE%A1%E6%8E%A7-%E8%BD%A6%E8%BE%86%E5%8F%8A%E8%BD%A6%E5%BA%93%E4%BF%A1%E6%81%AF%E6%8E%A5%E5%8F%A3 | |||||
| * | |||||
| * 临时车收费 | |||||
| * https://open.hikvision.com/docs/docId?productId=648a7c1a8c0c24eb99adc1bf&version=%2Fd393f08c5f4c48fcb3b34d3ecce5e5d8&tagPath=%E8%BD%A6%E8%BE%86%E7%AE%A1%E6%8E%A7%E4%B8%9A%E5%8A%A1-%E8%BD%A6%E8%BE%86%E7%9A%84%E5%85%85%E5%80%BC%E4%B8%8E%E6%94%B6%E8%B4%B9-%E4%B8%B4%E6%97%B6%E8%BD%A6%E6%94%B6%E8%B4%B9 | |||||
| */ | |||||
| @Service | |||||
| public class HaiKangWeiShiV3ParkService extends BaseParkService implements ParkAdapterService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| ParkHelper parkHelper; | |||||
| @Autowired | |||||
| @Qualifier("objectCommonRedisTemplate") | |||||
| RedisTemplate<String, Object> redisTemplate; | |||||
| @Autowired | |||||
| RedisLock redisLock; | |||||
| HaiKangWeiShiV3Util haikangV3 = new HaiKangWeiShiV3Util(); | |||||
| private ArtemisConfig getConfig(WxPark park) { | |||||
| ArtemisConfig config = RedisCacheUtils.getCacheObject(redisTemplate, "carStop:haikangv3token:"+park.getId(),ArtemisConfig.class); | |||||
| if (null == config) { | |||||
| String lockKey = "carStop:haikangv3tokenlock:"+park.getTenantId(); | |||||
| long time = System.currentTimeMillis() + 2000; | |||||
| String timeStr = String.valueOf(time); | |||||
| if (redisLock.lock2(lockKey, timeStr)) { | |||||
| config = haikangV3.generateConfig(park); | |||||
| if (null != config) { | |||||
| setCacheConfig(park, config); | |||||
| } | |||||
| redisLock.unlock(lockKey, timeStr); | |||||
| } else { | |||||
| try { | |||||
| Thread.sleep(2000); | |||||
| } catch (InterruptedException e) { | |||||
| e.printStackTrace(); | |||||
| }finally { | |||||
| redisLock.unlock(lockKey, timeStr); | |||||
| } | |||||
| } | |||||
| } | |||||
| return RedisCacheUtils.getCacheObject(redisTemplate, "carStop:haikangv3token:"+park.getId(),ArtemisConfig.class); | |||||
| } | |||||
| private void setCacheConfig(WxPark park,ArtemisConfig config) { | |||||
| RedisCacheUtils.cache(redisTemplate, "carStop:haikangv3token:"+park.getId(), config, 36000); | |||||
| } | |||||
| @Override | |||||
| public ResultData parkInitConfig(WxPark park) throws Exception { | |||||
| return null; | |||||
| } | |||||
| @Override | |||||
| public String initLogin(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | |||||
| return null; | |||||
| } | |||||
| @Override | |||||
| public String bindCar(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | |||||
| return "haikangV3"; | |||||
| } | |||||
| @Override | |||||
| public void unbindCar(Map<String, String> paramMap, WxPark park, WxCUserBasicInfo member) throws Exception{ | |||||
| } | |||||
| //查询停车账单(根据停车库和车牌号) /api/pms/v1/pay/quickPreBill | |||||
| @Override | |||||
| public ParkStopFee carStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||||
| return haiKangWeiShiCarStopFee(paramMap, park,carNumber); | |||||
| } | |||||
| private ParkStopFee haiKangWeiShiCarStopFee(Map<String, String> paramMap, WxPark park,String carNumber) throws Exception{ | |||||
| //如果车牌号是鄂AAAAAA, 为测试车牌 | |||||
| if (carNumber.equals("鄂AAAAAA")) { | |||||
| return new ParkStopFee("-111",haikangV3.utcToLocal("2020-12-16 00:00:00"),haikangV3.utcToLocal("2020-12-17 00:00:00"), | |||||
| "0.01","","payPath",null,"测试车牌,仅测试用",null); | |||||
| }else if(carNumber.equals("鄂AAAAAB")) { | |||||
| throw new MallinkException(21000,"车辆未入场"); | |||||
| } | |||||
| JSONObject attribute = haikangV3.getCarStopFee(park, carNumber, getConfig(park)); | |||||
| String appId = ""; | |||||
| String parkOrderId = attribute.getString("billSyscode"); | |||||
| Double needfee = 0.00; | |||||
| String neddfeestr = attribute.getString("supposeCost"); | |||||
| if (StringUtils.isNotBlank(neddfeestr)) { | |||||
| needfee = Double.parseDouble(neddfeestr); | |||||
| } | |||||
| Double reducefee = 0.00; | |||||
| String reducefeestr = attribute.getString("deduceCost"); | |||||
| if (StringUtils.isNotBlank(reducefeestr)) { | |||||
| reducefee = Double.parseDouble(reducefeestr); | |||||
| } | |||||
| Double fee = needfee - reducefee; | |||||
| if (fee <= 0 && StringUtils.isBlank(parkOrderId)) { | |||||
| parkOrderId = attribute.getString("inRecordSyscode"); | |||||
| } | |||||
| Date _createTime = DateUtils.stringToDate(attribute.getString("enterTime"), "yyyy-MM-dd'T'HH:mm:ssZ"); | |||||
| Date _endTime = DateUtils.getMinuteTimeAfter(attribute.getIntValue("parkPeriodTime"), _createTime);//离场时间,格式为“yyyy-MM-dd HH:mi:ss” | |||||
| String payPath = ""; | |||||
| Integer freeMinute = (Integer)park.getVendorParamsByKey("freeMinute"); | |||||
| return new ParkStopFee(parkOrderId,_createTime,_endTime, | |||||
| String.valueOf(fee),appId,payPath,null,null,"0元请勿使用优惠券,无法退回。支付后"+freeMinute+"分钟内离场"); | |||||
| } | |||||
| /** | |||||
| * @return | |||||
| */ | |||||
| @Override | |||||
| public ResultData useCoupon(Map<String, String> paramMap, WxPark park, WxCouponOrderCarCVo userCar,WxCoupon coupon,String carNumber) throws Exception{ | |||||
| if (null == userCar) { | |||||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(),"当前用户未查询到优惠券!"); | |||||
| } | |||||
| if (StringUtils.isBlank(userCar.getCUserPhone())) { | |||||
| return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(),"当前用户未查询到手机号!"+userCar.getcUserId()); | |||||
| } | |||||
| Map<String,String> valueMap = WxParkCouponConfig.parseValue(userCar.getVendorParams()); | |||||
| if (null == valueMap) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券没有关联停车场优惠券配置。"+coupon.getTitle()); | |||||
| } | |||||
| String reduceType = valueMap.get("reduceType"); | |||||
| if (StringUtils.isBlank(reduceType)) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券未设置停车场优惠券配置参数[减免类型]。"+coupon.getTitle()); | |||||
| } | |||||
| if ((!"1".equals(reduceType)) && (!"2".equals(reduceType))) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券设置停车场优惠券配置参数[减免类型]值非法。"+coupon.getTitle()); | |||||
| } | |||||
| String reduceValueStr = valueMap.get("reduceValue"); | |||||
| if (StringUtils.isBlank(reduceValueStr)) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券未设置停车场优惠券配置参数[减免数值]。"+coupon.getTitle()); | |||||
| } | |||||
| Integer reduceValue = 0; | |||||
| try { | |||||
| reduceValue = Integer.parseInt(reduceValueStr); | |||||
| }catch(Exception e) { | |||||
| return new ResultData(ErrorCode.COUPON_IS_EMPTY.getCode(),"当前停车券设置停车场优惠券配置参数[减免数值]值非法。"+coupon.getTitle()); | |||||
| } | |||||
| boolean isTimeCash = false; | |||||
| if ("1".equals(reduceType)) { | |||||
| isTimeCash = true; | |||||
| } | |||||
| // //查询临停信息,判断缓存是否已经存在 | |||||
| // JSONObject stopInfo = haikangV3.getCarStopFee(park, carNumber, getCacheToken(park)); | |||||
| // String inRecordSyscode = stopInfo.getString("inUnid"); | |||||
| // Integer used = RedisCacheUtils.getCacheInteger(redisTemplate, "carStop:haikangv2StopInfoUseCoupon:"+carNumber+":"+inRecordSyscode); | |||||
| // if (null == used || (null != used && used.intValue() < 1) ) { | |||||
| // //do nothing | |||||
| // }else { | |||||
| // return new ResultData(ErrorCode.CYF_STOP_FEE_FAIL.getCode(), "已经使用过优惠券, 不能重复使用."); | |||||
| // } | |||||
| // | |||||
| // JSONObject retObj = haikangV3.useCoupon(park,getCacheToken(park),carNumber,isTimeCash,reduceValue,coupon.getValidStartDate(),coupon.getValidEndDate()); | |||||
| // RedisCacheUtils.cache(redisTemplate, "carStop:haikangv2StopInfoUseCoupon:"+carNumber+":"+inRecordSyscode, 1, 24*3600); | |||||
| return new ResultData(); | |||||
| } | |||||
| @Override | |||||
| public ParkCreatePayOrder createPayOrder(Map<String, String> paramMap, WxPark park, String carNumber) throws Exception { | |||||
| JSONObject result = haikangV3.getCarStopFee(park, carNumber, getConfig(park)); | |||||
| String parkOrderId = result.getString("billSyscode"); | |||||
| Double needfee = 0.00; | |||||
| String neddfeestr = result.getString("supposeCost"); | |||||
| if (StringUtils.isNotBlank(neddfeestr)) { | |||||
| needfee = Double.parseDouble(neddfeestr); | |||||
| } | |||||
| Double reducefee = 0.00; | |||||
| String reducefeestr = result.getString("deduceCost"); | |||||
| if (StringUtils.isNotBlank(reducefeestr)) { | |||||
| reducefee = Double.parseDouble(reducefeestr); | |||||
| } | |||||
| Double fee = (needfee - reducefee)*100; | |||||
| return new ParkCreatePayOrder(parkOrderId, fee.intValue()); | |||||
| } | |||||
| @Override | |||||
| public ParkPaidNotifyResult notifyPaid(WxPark park,ParkNotifyPaid notifyPaid) throws Exception { | |||||
| JSONObject result = haikangV3.notifyPaid(park, notifyPaid.getParkOrderNo(), notifyPaid.getFee(),getConfig(park)); | |||||
| return new ParkPaidNotifyResult(true, result, null); | |||||
| } | |||||
| @Override | |||||
| public ResultData getParkStatus(WxPark park) throws Exception{ | |||||
| return new ResultData(); | |||||
| } | |||||
| @Override | |||||
| public boolean ignoreUseCouponCache() { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,201 @@ | |||||
| package com.iformall.service.park.impl.haikangweishiv3; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.hikvision.artemis.sdk.ArtemisHttpUtil; | |||||
| import com.hikvision.artemis.sdk.config.ArtemisConfig; | |||||
| import com.hikvision.artemis.sdk.constant.Constants; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.domain.po.WxPark; | |||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.utils.DateUtils; | |||||
| import lombok.extern.slf4j.Slf4j; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.apache.http.HttpEntity; | |||||
| import org.apache.http.HttpResponse; | |||||
| import org.apache.http.NameValuePair; | |||||
| import org.apache.http.client.methods.HttpPost; | |||||
| import org.apache.http.entity.ContentType; | |||||
| import org.apache.http.entity.StringEntity; | |||||
| import org.apache.http.entity.mime.MultipartEntityBuilder; | |||||
| import org.apache.http.entity.mime.content.StringBody; | |||||
| import org.apache.http.impl.client.CloseableHttpClient; | |||||
| import org.apache.http.impl.client.HttpClients; | |||||
| import org.apache.http.message.BasicNameValuePair; | |||||
| import org.apache.http.protocol.HTTP; | |||||
| import org.apache.http.util.EntityUtils; | |||||
| import java.io.IOException; | |||||
| import java.io.UnsupportedEncodingException; | |||||
| import java.math.BigDecimal; | |||||
| import java.net.URLEncoder; | |||||
| import java.security.MessageDigest; | |||||
| import java.security.NoSuchAlgorithmException; | |||||
| import java.text.ParseException; | |||||
| import java.text.SimpleDateFormat; | |||||
| import java.util.*; | |||||
| /** | |||||
| * @author: furunxin | |||||
| * @Date: 2020/7/1 17:16 | |||||
| * @Description: 车易付接口对接参数类 | |||||
| */ | |||||
| @Slf4j | |||||
| public class HaiKangWeiShiV3Util { | |||||
| private static final String ARTEMIS_PATH = "/artemis"; | |||||
| static { | |||||
| //连接超时时间 | |||||
| Constants.DEFAULT_TIMEOUT = 10000; | |||||
| //读取超时时间 | |||||
| Constants.SOCKET_TIMEOUT = 60000; | |||||
| } | |||||
| public static final String QUERY_PRICE = "/api/pms/v1/pay/quickPreBill"; | |||||
| public static final String COUPON_USE = "http://api.hikparking.com:9016/artemis/api/v1/sendCoupon"; | |||||
| public static final String NOTIFY_PAID = "/api/pms/v2/pay/receipt"; | |||||
| public ArtemisConfig generateConfig(WxPark park) { | |||||
| String vendroParams = park.getVendorParams(); | |||||
| JSONObject vp = JSON.parseObject(vendroParams); | |||||
| String appKey = vp.getString("appKey"); | |||||
| String appSecret = vp.getString("appSecret"); | |||||
| ArtemisConfig config = new ArtemisConfig(); | |||||
| config.setHost("127.0.0.1"); // 代理API网关nginx服务器ip端口 | |||||
| config.setAppKey(appKey); // 秘钥appkey | |||||
| config.setAppSecret(appSecret);// 秘钥appSecret | |||||
| return config; | |||||
| } | |||||
| public String callPostApi(ArtemisConfig config,String api,Map<String, String> paramMap) throws Exception { | |||||
| final String getCamsApi = ARTEMIS_PATH + api; | |||||
| String body = null; | |||||
| if (null != paramMap) { | |||||
| body = JSON.toJSON(paramMap).toString(); | |||||
| } | |||||
| Map<String, String> path = new HashMap<String, String>(2) { | |||||
| { | |||||
| put("https://", getCamsApi); | |||||
| } | |||||
| }; | |||||
| return ArtemisHttpUtil.doPostStringArtemis(config,path, body, null, null, "application/json"); | |||||
| } | |||||
| /** | |||||
| * @description UTC时间转化为本地时间 | |||||
| * @Params [utcTime] | |||||
| * @return java.util.Date | |||||
| * @Author furunxin | |||||
| * @Date 2020/7/8 下午12:45 | |||||
| **/ | |||||
| public static Date utcToLocal(String seconds) throws ParseException { | |||||
| String format = "yyyy-MM-dd HH:mm:ss"; | |||||
| SimpleDateFormat sdf = new SimpleDateFormat(format); | |||||
| Date date=sdf.parse(seconds); | |||||
| return date; | |||||
| } | |||||
| /** | |||||
| * 查询停车费 | |||||
| **/ | |||||
| public JSONObject getCarStopFee(WxPark wxPark,String carNumber,ArtemisConfig config){ | |||||
| String vendroParams = wxPark.getVendorParams(); | |||||
| JSONObject vp = JSON.parseObject(vendroParams); | |||||
| Map<String,String> params = new HashMap<String,String>(); | |||||
| params.put("plateNo", carNumber); | |||||
| params.put("parkSyscode", wxPark.getParkingId()); | |||||
| try { | |||||
| String retCode = callPostApi(config,QUERY_PRICE, params); | |||||
| if (StringUtils.isBlank(retCode)) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "haikangv3 getCarStopInfo error. has no result"); | |||||
| } | |||||
| JSONObject result = JSON.parseObject(retCode); | |||||
| String code = result.getString("code"); | |||||
| if (!code.equals("0") ) { | |||||
| String message = result.getString("msg"); | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "haikangv3 getCarStopInfo error.["+code+"]"+message); | |||||
| } | |||||
| return result.getJSONObject("data"); | |||||
| } catch (Exception e) { | |||||
| log.error("haikangweishiv3 getCarStopFee error.",e); | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "haikangv3 getCarStopInfo error."+e.getMessage()); | |||||
| } | |||||
| } | |||||
| /** | |||||
| * 使用优惠券 | |||||
| **/ | |||||
| public JSONObject useCoupon(WxPark wxPark,String token,String carNumber,boolean isTime,Integer cashValue,Date startTime,Date endTime){ | |||||
| String vendroParams = wxPark.getVendorParams(); | |||||
| JSONObject vp = JSON.parseObject(vendroParams); | |||||
| Map<String,Object> params = new HashMap<String,Object>(); | |||||
| params.put("parkCodes", vp.getString("parkCodes")); | |||||
| params.put("generateObj", 1); | |||||
| params.put("plateNo", carNumber); | |||||
| if (isTime) { | |||||
| params.put("couponType", 4); | |||||
| params.put("deductContent", cashValue*60); | |||||
| }else { | |||||
| params.put("couponType", 1); | |||||
| params.put("deductContent", cashValue*100); | |||||
| } | |||||
| params.put("startTime", startTime); | |||||
| params.put("endTime", endTime); | |||||
| params.put("couponSource", vp.getString("couponSource")); | |||||
| //String retCode = ProcBussiness(COUPON_USE, params,token); | |||||
| String retCode = ""; | |||||
| if (StringUtils.isBlank(retCode)) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "haikangv2 useCoupon error. has no result"); | |||||
| } | |||||
| JSONObject result = JSON.parseObject(retCode); | |||||
| String code = result.getString("code"); | |||||
| if (!code.equals("200") ) { | |||||
| String message = result.getString("msg"); | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "haikangv2 useCoupon error.["+code+"]"+message); | |||||
| } | |||||
| return result; | |||||
| } | |||||
| /** | |||||
| * 支付成功通知车场 | |||||
| * @param wxPark | |||||
| * @param orderNo | |||||
| * @param token | |||||
| * @return | |||||
| */ | |||||
| public JSONObject notifyPaid(WxPark wxPark,String parkOrderNo,Integer fee,ArtemisConfig config) { | |||||
| String vendroParams = wxPark.getVendorParams(); | |||||
| JSONObject vp = JSON.parseObject(vendroParams); | |||||
| Map param = new HashMap(); | |||||
| param.put("billSyscode", parkOrderNo);//商户编号 | |||||
| try { | |||||
| String retCode = callPostApi(config,NOTIFY_PAID, param); | |||||
| if (StringUtils.isBlank(retCode)) { | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "haikangv3 notifyPaid error. has no result"); | |||||
| } | |||||
| JSONObject result = JSON.parseObject(retCode); | |||||
| String code = result.getString("code"); | |||||
| if (!code.equals("0") ) { | |||||
| String message = result.getString("msg"); | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "haikangv3 notifyPaid error.["+code+"]"+message); | |||||
| } | |||||
| return result; | |||||
| } catch (Exception e) { | |||||
| log.error("haikangweishiv3 getCarStopFee error.",e); | |||||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(), "haikangv3 getCarStopInfo error."+e.getMessage()); | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,297 @@ | |||||
| package com.iformall.service.park.impl.haikangweishiv3.demo; | |||||
| import java.io.InputStream; | |||||
| import java.security.KeyManagementException; | |||||
| import java.security.NoSuchAlgorithmException; | |||||
| import java.security.cert.CertificateException; | |||||
| import java.security.cert.X509Certificate; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| import javax.net.ssl.SSLContext; | |||||
| import javax.net.ssl.TrustManager; | |||||
| import javax.net.ssl.X509TrustManager; | |||||
| import org.apache.http.HttpEntity; | |||||
| import org.apache.http.HttpResponse; | |||||
| import org.apache.http.client.HttpClient; | |||||
| import org.apache.http.client.methods.HttpGet; | |||||
| import org.apache.http.conn.ClientConnectionManager; | |||||
| import org.apache.http.conn.scheme.Scheme; | |||||
| import org.apache.http.conn.scheme.SchemeRegistry; | |||||
| import org.apache.http.conn.ssl.SSLSocketFactory; | |||||
| import org.apache.http.impl.client.DefaultHttpClient; | |||||
| import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONObject; | |||||
| import com.hikvision.artemis.sdk.ArtemisHttpUtil; | |||||
| import com.hikvision.artemis.sdk.Response; | |||||
| import com.hikvision.artemis.sdk.config.ArtemisConfig; | |||||
| import com.hikvision.artemis.sdk.constant.Constants; | |||||
| import com.hikvision.artemis.sdk.constant.SystemHeader; | |||||
| public class ArtemisPost { | |||||
| /** | |||||
| * 请根据技术支持提供的实际的平台IP/端口和API网关中的合作方信息更换static静态块中的三个参数. | |||||
| * [1 host] | |||||
| * host格式为IP:Port,如10.0.0.1:443 | |||||
| * 当使用https协议调用接口时,IP是平台(nginx)IP,Port是https协议的端口; | |||||
| * 当使用http协议调用接口时,IP是artemis服务的IP,Port是artemis服务的端口(默认9016)。 | |||||
| * [2 appKey和appSecret] | |||||
| * 请按照技术支持提供的合作方Key和合作方Secret修改 | |||||
| * appKey:合作方Key | |||||
| * appSecret:合作方Secret | |||||
| * 调用前看清接口传入的是什么,是传入json就用doPostStringArtemis方法,是表单提交就用doPostFromArtemis方法 | |||||
| * | |||||
| */ | |||||
| /** | |||||
| * API网关的后端服务上下文为:/artemis | |||||
| */ | |||||
| private static final String ARTEMIS_PATH = "/artemis"; | |||||
| /** | |||||
| * 根据需求调整超时时间 | |||||
| */ | |||||
| static { | |||||
| //连接超时时间 | |||||
| Constants.DEFAULT_TIMEOUT = 10000; | |||||
| //读取超时时间 | |||||
| Constants.SOCKET_TIMEOUT = 60000; | |||||
| } | |||||
| /** | |||||
| * 调用POST请求类型接口,这里以获取组织列表为例 | |||||
| * 接口实际url:https://ip:port/artemis/api/resource/v1/org/orgList | |||||
| * @return | |||||
| */ | |||||
| public static String callPostApiGetOrgList() throws Exception { | |||||
| /** | |||||
| * https://ip:port/artemis/api/resource/v1/org/orgList | |||||
| * 通过查阅AI Cloud开放平台文档或网关门户的文档可以看到获取组织列表的接口定义,该接口为POST请求的Rest接口, 入参为JSON字符串,接口协议为https。 | |||||
| * ArtemisHttpUtil工具类提供了doPostStringArtemis调用POST请求的方法,入参可传JSON字符串, 请阅读开发指南了解方法入参,没有的参数可传null | |||||
| */ | |||||
| ArtemisConfig config = new ArtemisConfig(); | |||||
| config.setHost("127.0.0.1"); // 代理API网关nginx服务器ip端口 | |||||
| config.setAppKey("20469790"); // 秘钥appkey | |||||
| config.setAppSecret("lofnD6DbnBllHmk5YOyx");// 秘钥appSecret | |||||
| final String getCamsApi = ARTEMIS_PATH + "/api/resource/v1/org/orgList"; | |||||
| Map<String, String> paramMap = new HashMap<String, String>();// post请求Form表单参数 | |||||
| paramMap.put("pageNo", "1"); | |||||
| paramMap.put("pageSize", "2"); | |||||
| String body = JSON.toJSON(paramMap).toString(); | |||||
| Map<String, String> path = new HashMap<String, String>(2) { | |||||
| { | |||||
| put("https://", getCamsApi); | |||||
| } | |||||
| }; | |||||
| return ArtemisHttpUtil.doPostStringArtemis(config,path, body, null, null, "application/json"); | |||||
| } | |||||
| /** | |||||
| * 调用POST请求类型接口,这里以分页获取区域列表为例 | |||||
| * 接口实际url:https://ip:port/artemis/api/api/resource/v1/regions | |||||
| * @return | |||||
| */ | |||||
| public static String callPostApiGetRegions() throws Exception { | |||||
| /** | |||||
| * https://ip:port/artemis/api/resource/v1/regions | |||||
| * 过查阅AI Cloud开放平台文档或网关门户的文档可以看到分页获取区域列表的定义,这是一个POST请求的Rest接口, 入参为JSON字符串,接口协议为https。 | |||||
| * ArtemisHttpUtil工具类提供了doPostStringArtemis调用POST请求的方法,入参可传JSON字符串, 请阅读开发指南了解方法入参,没有的参数可传null | |||||
| */ | |||||
| ArtemisConfig config = new ArtemisConfig(); | |||||
| config.setHost("127.0.0.1"); // 代理API网关nginx服务器ip端口 | |||||
| config.setAppKey("20469790"); // 秘钥appkey | |||||
| config.setAppSecret("lofnD6DbnBllHmk5YOyx");// 秘钥appSecret | |||||
| final String getCamsApi = ARTEMIS_PATH + "/api/resource/v1/regions"; | |||||
| Map<String, String> paramMap = new HashMap<String, String>();// post请求Form表单参数 | |||||
| paramMap.put("pageNo", "1"); | |||||
| paramMap.put("pageSize", "2"); | |||||
| paramMap.put("treeCode", "0"); | |||||
| String body = JSON.toJSON(paramMap).toString(); | |||||
| Map<String, String> path = new HashMap<String, String>(2) { | |||||
| { | |||||
| put("https://", getCamsApi); | |||||
| } | |||||
| }; | |||||
| return ArtemisHttpUtil.doPostStringArtemis(config,path, body, null, null, "application/json"); | |||||
| } | |||||
| /** | |||||
| * 调用POST接口,返回图片 | |||||
| * 接口实际url:https://ip:port/artemis/api/visitor/v1/record/pictures | |||||
| * @return | |||||
| */ | |||||
| public static String callPostImgs() throws Exception { | |||||
| ArtemisConfig config = new ArtemisConfig(); | |||||
| config.setHost("127.0.0.1"); // 代理API网关nginx服务器ip端口 | |||||
| config.setAppKey("20469790"); // 秘钥appkey | |||||
| config.setAppSecret("lofnD6DbnBllHmk5YOyx");// 秘钥appSecret | |||||
| final String getSecurityApi = "/artemis" + "/api/visitor/v1/record/pictures"; // 接口路径 | |||||
| Map<String, String> path = new HashMap<String, String>(2) { | |||||
| { | |||||
| put("https://", getSecurityApi); | |||||
| } | |||||
| }; | |||||
| Map<String, String> head = new HashMap<String, String>(2) { //get请求的head参数 | |||||
| { | |||||
| put("headpost", "sky-test"); | |||||
| } | |||||
| }; | |||||
| Map<String, String> query = new HashMap<String, String>(2) { //get请求的head参数 | |||||
| { | |||||
| put("domainId", "0"); | |||||
| } | |||||
| }; | |||||
| JSONObject jsonBody = new JSONObject(); | |||||
| jsonBody.put("svrIndexCode", "9ff58bc2-65a5-464b-b28c-daea67ba9569"); | |||||
| jsonBody.put("picUri", "/pic?9dda12i40-e*5b84626c4105m5ep=t=i3p*i=d1s*i=d3b*i1d3b*855925cea-96008b--2718943z855s=5i76="); | |||||
| String body = jsonBody.toJSONString(); | |||||
| //参数根据接口实际情况设置 | |||||
| //参数根据接口实际情况设置 | |||||
| //【注】:该方法从artemis-http-client v1.1.12版本后,返回值修改为Response,此前为HttpResponse;升级时注意兼容性问题 | |||||
| Response result = ArtemisHttpUtil.doPostStringImgArtemis(config, path, body, null, null, "application/json", null); | |||||
| try { | |||||
| if (302==result.getStatusCode()) { | |||||
| /* | |||||
| 获取图片数据保存到本地 | |||||
| 注:1.对于有时效的图片,必须尽快保存到本地 | |||||
| 2.若无时效,则可以直接保存location,后续自行访问获取 | |||||
| */ | |||||
| String location= result.getHeader("Location"); | |||||
| HttpGet httpget = new HttpGet(location); | |||||
| HttpClient httpClient = wrapClient(httpget.getURI().getScheme()+"://"+httpget.getURI().getHost()); | |||||
| HttpResponse execute = httpClient.execute(httpget); | |||||
| HttpEntity entity = execute.getEntity(); | |||||
| InputStream in = entity.getContent(); | |||||
| Tools.savePicToDisk(in, "d:/", "test311.jpg"); | |||||
| //TODO 可以返回保存后的路径 | |||||
| }else{ | |||||
| System.out.println("下载出错:"+result.getBody()); | |||||
| } | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| return getSecurityApi; | |||||
| } | |||||
| /** | |||||
| * 调用POST接口,下载文件 | |||||
| * 接口实际url:https://ip:port/artemis/api/fedof/v1/org/downloadCameraCSV | |||||
| * @return | |||||
| */ | |||||
| public static void callPostDownloadFile() throws Exception { | |||||
| ArtemisConfig config = new ArtemisConfig(); | |||||
| config.setHost("127.0.0.1"); // 代理API网关nginx服务器ip端口 | |||||
| config.setAppKey("20469790"); // 秘钥appkey | |||||
| config.setAppSecret("lofnD6DbnBllHmk5YOyx");// 秘钥appSecret | |||||
| final String getSecurityApi = "/artemis" + "/api/fedof/v1/org/downloadCameraCSV"; // 接口路径 | |||||
| Map<String, String> path = new HashMap<String, String>(2) { | |||||
| { | |||||
| put("https://", getSecurityApi); | |||||
| } | |||||
| }; | |||||
| Map<String, String> head = new HashMap<String, String>(2) { //get请求的head参数 | |||||
| { | |||||
| put("headpost", "sky-test"); | |||||
| } | |||||
| }; | |||||
| Map<String, String> query = new HashMap<String, String>(2) { //get请求的head参数 | |||||
| { | |||||
| put("domainId", "0"); | |||||
| } | |||||
| }; | |||||
| JSONObject jsonBody = new JSONObject(); | |||||
| jsonBody.put("svrIndexCode", "9ff58bc2-65a5-464b-b28c-daea67ba9569"); | |||||
| jsonBody.put("picUri", "/pic?9dda12i40-e*5b84626c4105m5ep=t=i3p*i=d1s*i=d3b*i1d3b*855925cea-96008b--2718943z855s=5i76="); | |||||
| String body = jsonBody.toJSONString(); | |||||
| //参数根据接口实际情况设置 | |||||
| //参数根据接口实际情况设置 | |||||
| //【注】:该方法从artemis-http-client v1.1.12版本后,返回值修改为Response,此前为HttpResponse;升级时注意兼容性问题 | |||||
| Response result = ArtemisHttpUtil.doPostDownloadFileArtemis(config, path, body, null, null, null, null); | |||||
| String filePath = "D:\\download\\"; | |||||
| InputStream content = result.getResponse().getEntity().getContent(); | |||||
| Tools.savePicToDisk(content, filePath, "test.zip"); | |||||
| } | |||||
| /** | |||||
| * 调用POST请求类型接口,这里演示了外层代理服务对artemis对外接口封装的场景。例如: | |||||
| * artemis上开放的接口实际url:https://ip:port/artemis/api/api/resource/v1/regions | |||||
| * 外部代理服务上上开放的接口url:https://ip:port/proxy/api/api/resource/v1/regions | |||||
| * 需保证安全认证库签名使用的path参数与artemis一致,可在请求头中设置x-ca-path参数,内容为:/artemis/api/api/resource/v1/regions | |||||
| * @return | |||||
| */ | |||||
| public static String callPostApiGetRegionsByProxy() throws Exception { | |||||
| /** | |||||
| * https://ip:port/proxy/api/api/resource/v1/regions | |||||
| */ | |||||
| ArtemisConfig config = new ArtemisConfig(); | |||||
| config.setHost("127.0.0.1"); // 代理API网关nginx服务器ip端口 | |||||
| config.setAppKey("20469790"); // 秘钥appkey | |||||
| config.setAppSecret("lofnD6DbnBllHmk5YOyx");// 秘钥appSecret | |||||
| final String getCamsApi = "/proxy/api/resource/v1/regions"; | |||||
| Map<String, String> paramMap = new HashMap<String, String>();// post请求Form表单参数 | |||||
| paramMap.put("pageNo", "1"); | |||||
| paramMap.put("pageSize", "2"); | |||||
| paramMap.put("treeCode", "0"); | |||||
| String body = JSON.toJSON(paramMap).toString(); | |||||
| Map<String, String> path = new HashMap<String, String>(2) { | |||||
| { | |||||
| put("https://", getCamsApi); | |||||
| } | |||||
| }; | |||||
| Map<String, String> head = new HashMap<String, String>(2) { | |||||
| { | |||||
| put(SystemHeader.X_CA_PATH, "/artemis/api/api/resource/v1/regions"); | |||||
| } | |||||
| }; | |||||
| return ArtemisHttpUtil.doPostStringArtemis(config,path, body, null, null, "application/json", head); | |||||
| } | |||||
| private static HttpClient wrapClient(String host) { | |||||
| HttpClient httpClient = new DefaultHttpClient(); | |||||
| if (host.startsWith("https://")) { | |||||
| sslClient(httpClient); | |||||
| } | |||||
| return httpClient; | |||||
| } | |||||
| private static void sslClient(HttpClient httpClient) { | |||||
| try{ | |||||
| SSLContext ctx = SSLContext.getInstance("TLS"); | |||||
| X509TrustManager tm = new X509TrustManager() { | |||||
| @Override | |||||
| public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { | |||||
| } | |||||
| @Override | |||||
| public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { | |||||
| } | |||||
| @Override | |||||
| public X509Certificate[] getAcceptedIssuers() { | |||||
| return null; | |||||
| } | |||||
| }; | |||||
| ctx.init(null,new TrustManager[] { tm },null); | |||||
| SSLSocketFactory ssf = new SSLSocketFactory(ctx); | |||||
| ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); | |||||
| ClientConnectionManager ccm = httpClient.getConnectionManager(); | |||||
| SchemeRegistry registry = ccm.getSchemeRegistry(); | |||||
| registry.register(new Scheme("https",443,ssf)); | |||||
| } catch (KeyManagementException ex1) { | |||||
| throw new RuntimeException(ex1); | |||||
| } catch (NoSuchAlgorithmException ex) { | |||||
| throw new RuntimeException(ex); | |||||
| } | |||||
| } | |||||
| public static void main(String[] args) throws Exception { | |||||
| String result = callPostApiGetOrgList(); | |||||
| System.out.println(result); | |||||
| String VechicleDataResult = callPostApiGetRegions(); | |||||
| System.out.println(VechicleDataResult); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,58 @@ | |||||
| package com.iformall.service.park.impl.haikangweishiv3.demo; | |||||
| import java.io.File; | |||||
| import java.io.FileOutputStream; | |||||
| import java.io.IOException; | |||||
| import java.io.InputStream; | |||||
| /** | |||||
| * 工具类 | |||||
| * | |||||
| * @author | |||||
| * @create 2019-01-11 17:06 | |||||
| **/ | |||||
| public class Tools { | |||||
| /** | |||||
| * 将图片写到 硬盘指定目录下 | |||||
| * | |||||
| * @param in | |||||
| * @param dirPath | |||||
| * @param filePath | |||||
| */ | |||||
| public static void savePicToDisk(InputStream in, String dirPath, | |||||
| String filePath) { | |||||
| try { | |||||
| File dir = new File(dirPath); | |||||
| if (dir == null || !dir.exists()) { | |||||
| dir.mkdirs(); | |||||
| } | |||||
| //文件真实路径 | |||||
| String realPath = dirPath.concat(filePath); | |||||
| File file = new File(realPath); | |||||
| if (file == null || !file.exists()) { | |||||
| file.createNewFile(); | |||||
| } | |||||
| FileOutputStream fos = new FileOutputStream(file); | |||||
| byte[] buf = new byte[1024]; | |||||
| int len = 0; | |||||
| while ((len = in.read(buf)) != -1) { | |||||
| fos.write(buf, 0, len); | |||||
| } | |||||
| fos.flush(); | |||||
| fos.close(); | |||||
| } catch (IOException e) { | |||||
| e.printStackTrace(); | |||||
| } finally { | |||||
| try { | |||||
| in.close(); | |||||
| } catch (IOException e) { | |||||
| e.printStackTrace(); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -21,6 +21,10 @@ public class UserDateRuleCacheUtils { | |||||
| RedisCacheUtils.removeCache(template, key); | RedisCacheUtils.removeCache(template, key); | ||||
| } | } | ||||
| public static void removeMallBuildCacheAll(RedisTemplate<String, Object> template) { | |||||
| RedisCacheUtils.removeCachePrefix(template, "udmallBuilding:"); | |||||
| } | |||||
| public static void setMallBuildingCache(RedisTemplate<String, Object> template,Long userId,List<WxMallBuilding> wxMallBuildings) { | public static void setMallBuildingCache(RedisTemplate<String, Object> template,Long userId,List<WxMallBuilding> wxMallBuildings) { | ||||
| String key = "udmallBuilding:"+userId; | String key = "udmallBuilding:"+userId; | ||||
| RedisCacheUtils.cache(template, key, wxMallBuildings, 24*3600); | RedisCacheUtils.cache(template, key, wxMallBuildings, 24*3600); | ||||
| @@ -181,7 +181,8 @@ | |||||
| software.amazon.ion, | software.amazon.ion, | ||||
| tk.mybatis, | tk.mybatis, | ||||
| xmlpull, | xmlpull, | ||||
| xpp3 | |||||
| xpp3, | |||||
| com.hikvision.ga | |||||
| </excludeGroupIds> | </excludeGroupIds> | ||||
| </configuration> | </configuration> | ||||
| </plugin> | </plugin> | ||||
| @@ -152,7 +152,8 @@ | |||||
| software.amazon.ion, | software.amazon.ion, | ||||
| tk.mybatis, | tk.mybatis, | ||||
| xmlpull, | xmlpull, | ||||
| xpp3 | |||||
| xpp3, | |||||
| com.hikvision.ga | |||||
| </excludeGroupIds> | </excludeGroupIds> | ||||
| </configuration> | </configuration> | ||||
| </plugin> | </plugin> | ||||