Przeglądaj źródła

领取理疗红包业务调整

wjj 3 dni temu
rodzic
commit
dddad5271c

+ 18 - 5
fs-service/src/main/java/com/fs/patient/service/impl/FsPatientBaseInfoServiceImpl.java

@@ -35,6 +35,7 @@ import com.fs.patient.mapper.FsProjectRedPacketRecordMapper;
 import com.fs.patient.param.BindPatientParam;
 import com.fs.patient.param.FsProjectSendRewardUParam;
 import com.fs.patient.vo.PatientBaseInfoVO;
+import com.fs.qw.mapper.QwExternalContactMapper;
 import com.fs.system.oss.CloudStorageService;
 import com.fs.system.oss.OSSFactory;
 import com.fs.system.service.ISysConfigService;
@@ -93,6 +94,9 @@ public class FsPatientBaseInfoServiceImpl extends ServiceImpl<FsPatientBaseInfoM
 
     @Autowired
     private IFsStorePaymentService fsStorePaymentService;
+
+    @Autowired
+    private QwExternalContactMapper qwExternalContactMapper;
     /**
      * 查询患者基本信息
      * 
@@ -423,6 +427,20 @@ public class FsPatientBaseInfoServiceImpl extends ServiceImpl<FsPatientBaseInfoM
         if (fsProject == null) {
             return R.error("理疗信息错误,领取失败");
         }
+
+        // 获取用户信息
+        FsUser user = userMapper.selectFsUserByUserId(param.getUserId());
+        if (user == null) {
+            return R.error("用户信息缺失,无法领取");
+        }
+        if (user.getStatus() == 0){
+            return R.error("会员被停用,无权限,请联系客服!");
+        }
+        //当前用户是否添加企微
+        Long qwCount = qwExternalContactMapper.selectCountByUnionId(user.getUnionId());
+        if (qwCount < 1) {
+            return R.error("请添加企微后领取");
+        }
         //获取今日理疗红包记录
         FsProjectRedPacketRecord redPacketRecord = projectRedPacketRecordMapper.selectTodayFsProjectRedPacketRecordByUserId(param.getUserId());
         if (!ObjectUtils.isEmpty(redPacketRecord)) {
@@ -435,11 +453,6 @@ public class FsPatientBaseInfoServiceImpl extends ServiceImpl<FsPatientBaseInfoM
                 }
             }
         }
-        // 获取用户信息
-        FsUser user = userMapper.selectFsUserByUserId(param.getUserId());
-        if (user != null && user.getStatus()==0){
-            return R.error("会员被停用,无权限,请联系客服!");
-        }
 
         FsProjectRedPacketRecord record = projectRedPacketRecordMapper.selectFsProjectRedPacketByUserIdAndProjectId(param.getUserId(), param.getProjectId());
         if (record != null && record.getCollectType() == 1) {