Procházet zdrojové kódy

1、解决前端空对象为null问题,改为返回为空对象,追加赋值

ligang134 před 3 roky
rodič
revize
7d3a201373

+ 13 - 11
src/main/java/com/ydtech/modules/admin/controller/SysUserController.java

@@ -43,6 +43,8 @@ import java.util.Date;
 import java.util.List;
 import java.util.stream.Collectors;
 
+import static com.ydtech.constants.RedisConstant.PHONE_VERIFICATION_CODE_KEY;
+
 
 /**
  * 用户控制器
@@ -486,18 +488,18 @@ public class SysUserController extends BaseController {
         String resultStr = "";
 
         String phoneMsg = dto.getMobileMsg();
-//        if (StringUtils.isNullOrEmpty(phoneMsg)) {
-//            return HttpResult.error("短信验证码不能为空");
-//        }
-//        //从数据库获取最新验证码
-//        String msg = stringRedisTemplate.opsForValue().get(PHONE_VERIFICATION_CODE_KEY + dto.getMobile());
+        if (StringUtils.isNullOrEmpty(phoneMsg)) {
+            return HttpResult.error("短信验证码不能为空");
+        }
+        //从数据库获取最新验证码
+        String msg = stringRedisTemplate.opsForValue().get(PHONE_VERIFICATION_CODE_KEY + dto.getMobile());
 //
-//        if (msg == null || msg.length() == 0) {
-//            return HttpResult.error("短信验证码发送失败");
-//        }
-//        if (!phoneMsg.equals(msg)) {
-//            return HttpResult.error("短信验证码不正确");
-//        }
+        if (msg == null || msg.length() == 0) {
+            return HttpResult.error("短信验证码发送失败");
+        }
+        if (!phoneMsg.equals(msg)) {
+            return HttpResult.error("短信验证码不正确");
+        }
         String recommenderid = dto.getReferrerId();
         if (StringUtils.isNullOrEmpty(recommenderid)) {
             return HttpResult.error("推荐人ID不能为空");

+ 10 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ydtech.modules.protocol.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -158,6 +159,15 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         //2023-08-28 lig 增加  解决前端空对象为null问题,改为返回为空对象
         if(null == ptlAgreementAttribution){
             ptlAgreementAttribution = new PtlAgreementAttribution();
+            ptlAgreementAttribution.setId("");
+            ptlAgreementAttribution.setInsCompanyId("");
+            ptlAgreementAttribution.setInsCompanyName("");
+            ptlAgreementAttribution.setTemplateId("");
+            ptlAgreementAttribution.setApiType(1);
+            ptlAgreementAttribution.setFields(new JSONArray());
+            ptlAgreementAttribution.setUsername("");
+            ptlAgreementAttribution.setPassword("");
+
         }
         // 授权查询
         List<PtlAgreementDept> deptList = ptlAgreementDeptService.getByAgreementId(agreementId);