GITZYY před 7 měsíci
rodič
revize
e2d4b9306b

+ 19 - 7
egress-gateway-service-domain/src/main/java/com/hrsk/cloud/eg/domain/api/func/EncryptionFunction.java

@@ -98,14 +98,26 @@ public class EncryptionFunction {
      */
     public static Integer combinationCodeSuccessIsExit(FunctionParam functionParam) {
        try {
+
            List<Object> extArg = functionParam.getExtArg();
-           Integer o = (Integer) extArg.get(0);
-           Boolean o1 = (Boolean) extArg.get(1);
-           Boolean o2 = (Boolean) extArg.get(2);
-          if (o.equals(DataVoStatusEnum.SUCCESS.getCode())
-           && o1&&o2) {
-              return DataVoStatusEnum.SUCCESS.getCode();
-          }
+           int size = extArg.size();
+           if (size == 3) {
+               Integer o = (Integer) extArg.get(0);
+               Boolean o1 = (Boolean) extArg.get(1);
+               Boolean o2 = (Boolean) extArg.get(2);
+               if (o.equals(DataVoStatusEnum.SUCCESS.getCode())
+                       && o1&&o2) {
+                   return DataVoStatusEnum.SUCCESS.getCode();
+               }
+           }
+           if (size == 2) {
+               Integer o = (Integer) extArg.get(0);
+               Boolean o1 = Boolean.parseBoolean(extArg.get(1).toString());
+               if (o.equals(DataVoStatusEnum.SUCCESS.getCode())
+                       && o1) {
+                   return DataVoStatusEnum.SUCCESS.getCode();
+               }
+           }
 
        }catch (Exception e){
            log.error("组合方式参数校验出现错误{}",e.getMessage(),e);

+ 65 - 0
egress-gateway-service-infrastructure/src/main/java/com/hrsk/cloud/eg/infrastructure/business/GenerateCheckIntoHttpApiConfigService.java

@@ -761,4 +761,69 @@ public class GenerateCheckIntoHttpApiConfigService {
         return httpApiConfig;
     }
 
+    /**
+     * 汇鑫对接方式
+     * @param threeSystemConfig
+     */
+    public void generateHuixinConfig(String threeSystemConfig) {
+        EgApiDo egApiDo=new EgApiDo();
+        egApiDo.setApiCode("EG:"+BusinessPrefixEnum.CHECK_INTO_PREFIX.getCode()+":Huixin");
+        egApiDo.setApiName(BusinessPrefixEnum.CHECK_INTO_PREFIX.getMsg());
+        egApiService.save(egApiDo);
+        JSONObject jsonObject = JSONObject.parseObject(threeSystemConfig);
+        EgApiEndpointDo egApiEndpointDo=new EgApiEndpointDo();
+        egApiEndpointDo.setApiCode(egApiDo.getApiCode());
+        egApiEndpointDo.setApiId(egApiDo.getId());
+        egApiEndpointDo.setApiName(jsonObject.getString("name"));
+        egApiEndpointDo.setApiConfig(HessianUtils.serialize(createHuixinCheckIntoBean(threeSystemConfig)));
+        egApiEndpointService.save(egApiEndpointDo);
+    }
+
+    private HttpApiConfig createHuixinCheckIntoBean(String threeSystemConfig) {
+        JSONObject jsonObject=JSONObject.parseObject(threeSystemConfig);
+        HttpApiConfig httpApiConfig = new HttpApiConfig();
+        httpApiConfig.setUrl(jsonObject.getString("url")+"pushdata.ashx?type=CheckMobilePhone");
+        httpApiConfig.setMethod("POST");
+        httpApiConfig.setContentType(ApiPayloadTypeEnum.APPLICATION_JSON.getCode());
+        List<KeyValueObject> headers = Lists.newArrayList();
+        KeyValueObject head=new KeyValueObject();
+        head.setType(ValueObjectTypeEnum.BASIC.getType());
+        head.setKey("Content-Type");
+        head.setValue("application/json");
+        headers.add(head);
+        httpApiConfig.setHeader(headers);
+        JSONObject body=new  JSONObject();
+        KeyValueObject attackPhone=new KeyValueObject();
+        attackPhone.setType("spel");
+        attackPhone.setValue("#param.user.phoneMd5");
+        body.put("phoneMd5","#"+JSONObject.toJSONString(attackPhone));
+        //主体
+        httpApiConfig.setContent(JSONObject.toJSONString(body));
+
+        JSONObject resultObj=new  JSONObject();
+        KeyValueObject status=new KeyValueObject();
+        status.setType("spel");
+        List<FunctionObject> functionObjects = Lists.newArrayList();
+        FunctionObject functionObject = new FunctionObject();
+        functionObject.setCode("combinationCodeSuccessIsExit");
+        List<ValueObject> valueObjectList= Lists.newArrayList();
+        ValueObject valueObject = new ValueObject();
+        valueObject.setType(ValueObjectTypeEnum.SPEL.getType());
+        valueObject.setValue("#root[code]");
+        valueObjectList.add(valueObject);
+        ValueObject valueObject1 = new ValueObject();
+        valueObject1.setType(ValueObjectTypeEnum.SPEL.getType());
+        valueObject1.setValue("#root[status]");
+        valueObjectList.add(valueObject1);
+
+
+        functionObject.setArgs(valueObjectList);
+        functionObjects.add(functionObject);
+        status.setFunctions(functionObjects);
+        resultObj.put("status","#"+JSONObject.toJSONString(status));
+        httpApiConfig.setResult(JSONObject.toJSONString(resultObj));
+        String jsonString = JSONObject.toJSONString(httpApiConfig);
+        log.info("huixin api  {}",jsonString);
+        return httpApiConfig;
+    }
 }

+ 27 - 0
start/src/test/java/StartTest.java

@@ -99,6 +99,12 @@ public class StartTest {
         generateCHeckIntoHttpApiConfigService.generateYinHuaConfig(productBusinessApiInfoDos.get(0).getThreeSystemConfig());
     }
 
+    @Test
+    public void createHuiXinApiTest(){
+        List<ProductBusinessApiInfoDo> productBusinessApiInfoDos = productBusinessApiInfoService.selectByJointJonintTypeForList("Huixin");
+        generateCHeckIntoHttpApiConfigService.generateHuixinConfig(productBusinessApiInfoDos.get(1).getThreeSystemConfig());
+    }
+
 
 
     @Test
@@ -310,6 +316,27 @@ public class StartTest {
     }
 
 
+    /**
+     * @description:
+     * @author zhangyy
+     * @date 2024/9/9 11:47
+     * @version 1.0
+     */
+    @Test
+    public void huiXinApiTest(){
+        Long apiId= 441424531642944L;
+        UserInBaseInfoDto user =new UserInBaseInfoDto();
+        user.setPhoneMd5("b5500dfab55f42b340d31326561e16cb");
+        user.setCompanyCity("重庆");
+        PlanDto  plan =new PlanDto();
+        plan.setApiId(apiId);
+        plan.setBid("aff1c7b30d8b240826030235business");
+        CheckIntoParamDto checkin =new CheckIntoParamDto();
+        checkin.setPlan(plan);
+        checkin.setUser(user);
+        apiGateway.checkIntoRequest(checkin);
+    }
+
 
     @Test
     public void spel(){