Browse Source

修改发送,校验验证码

xuefy 3 năm trước cách đây
mục cha
commit
f19ee98fd9

+ 55 - 44
sc-service/src/main/java/com/huyi/service/credit/controller/OwnCfcaProjectController.java

@@ -154,21 +154,26 @@ public class OwnCfcaProjectController extends BaseController {
 
         //发送短信验证码
         JSONObject jsonObject = AxqCommonUtil.sendSms(userId,projectCode,new HttpConnector(jksPath,keyStorePassword, channel,platId));
-        String  retCode = jsonObject.getString("retCode");
+        Boolean  isHave = jsonObject.has("retCode");
         //成功
-        if("60000000".equals(retCode)){
-            //手机号掩码
-            String newIphone = iphone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
-            Map<String,String > map = new HashMap<>();
-            //结果
-            map.put("result",retCode);
-            //掩码后的手机号
-            map.put("newIphone",newIphone);
-            //项目编号
-            map.put("projectCode",projectCode);
-            return R.ok(map);
+        if(isHave){
+            String  retCode = jsonObject.getString("retCode");
+            if("60000000".equals(retCode)){
+                //手机号掩码
+                String newIphone = iphone.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
+                Map<String,String > map = new HashMap<>();
+                //结果
+                map.put("result",retCode);
+                //掩码后的手机号
+                map.put("newIphone",newIphone);
+                //项目编号
+                map.put("projectCode",projectCode);
+                return R.ok(map);
+            }else{
+                return R.fail(jsonObject.getString("retMessage"));
+            }
         }else{
-            return R.fail(jsonObject.getString("retMessage"));
+            return R.fail(jsonObject.getString("errorMessage"));
         }
     }
 
@@ -210,39 +215,45 @@ public class OwnCfcaProjectController extends BaseController {
         }
         String userId = currentCompany.getScyCfcaUserId();
         JSONObject   jsonObject =  AxqCommonUtil.checkSmsCode(userId,projectCode,code,new HttpConnector(jksPath,keyStorePassword, channel,platId));
-        String retCode = jsonObject.getString("retCode");
-        //成功
-        if ("60000000".equals(retCode)) {
-            Map<String,String> map = new HashMap<>();
-            //获取结果
-            map.put("verification",retCode);
-            //存入项目授权编号
-            SysCompany cp = new SysCompany();
-            //公司
-            cp.setScyId(companyId);
-            //项目授权编号
-            cp.setScyCfcaAuthNumber(projectCode);
-            //修改时间
-            cp.setUpdateTime(DateUtils.getNowDate());
-            //修改人
-            cp.setUpdateBy(CommonUtil.objToString(use.getUserId()));
-            companyService.updateById(cp);
-            //更改系统参数项目编号的值
-            String cfcaMessage = configService.selectConfigByKey("ZCYL-CFCA").getMsg();
-            cfcaMessage = AmtUtil.add(cfcaMessage,"1",0);
-            SysConfig sysConfig = new SysConfig();
-            sysConfig.setConfigKey("ZCYL-CFCA");
-            List<SysConfig>    configList =     sysConfigService.selectConfigList(sysConfig);
-            if(configList.size() < 1){
-                throw  new Exception("参数配置错误");
+        Boolean  isHave = jsonObject.has("retCode");
+        if(isHave){
+            String retCode = jsonObject.getString("retCode");
+            //成功
+            if ("60000000".equals(retCode)) {
+                Map<String,String> map = new HashMap<>();
+                //获取结果
+                map.put("verification",retCode);
+                //存入项目授权编号
+                SysCompany cp = new SysCompany();
+                //公司
+                cp.setScyId(companyId);
+                //项目授权编号
+                cp.setScyCfcaAuthNumber(projectCode);
+                //修改时间
+                cp.setUpdateTime(DateUtils.getNowDate());
+                //修改人
+                cp.setUpdateBy(CommonUtil.objToString(use.getUserId()));
+                companyService.updateById(cp);
+                //更改系统参数项目编号的值
+                String cfcaMessage = configService.selectConfigByKey("ZCYL-CFCA").getMsg();
+                cfcaMessage = AmtUtil.add(cfcaMessage,"1",0);
+                SysConfig sysConfig = new SysConfig();
+                sysConfig.setConfigKey("ZCYL-CFCA");
+                List<SysConfig>    configList =     sysConfigService.selectConfigList(sysConfig);
+                if(configList.size() < 1){
+                    throw  new Exception("参数配置错误");
+                }
+                SysConfig  config = configList.get(0);
+                config.setConfigValue(cfcaMessage);
+                sysConfigService.updateConfig(config);
+                return AjaxResult.success(map);
+            } else {
+                return AjaxResult.error(jsonObject.getString("retMessage"));
             }
-            SysConfig  config = configList.get(0);
-            config.setConfigValue(cfcaMessage);
-            sysConfigService.updateConfig(config);
-            return AjaxResult.success(map);
-        } else {
-            return AjaxResult.error(jsonObject.getString("retMessage"));
+        }else{
+            return AjaxResult.error(jsonObject.getString("errorMessage"));
         }
+
     }