Преглед изворни кода

修改客户信息表增加根据手机号后4位领取+商城制单小程序增加动态配置

cgp пре 5 дана
родитељ
комит
bf102dfcf0

+ 19 - 3
fs-company/src/main/java/com/fs/company/controller/qw/FsCompanyCustomerController.java

@@ -1,5 +1,7 @@
 package com.fs.company.controller.qw;
 
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
 import com.alibaba.fastjson.JSON;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.AjaxResult;
@@ -28,9 +30,11 @@ import com.fs.hisStore.vo.FsUserInformationCollectionOverviewVo;
 import com.fs.qw.domain.FsCompanyCustomer;
 import com.fs.qw.service.IFsCompanyCustomerService;
 import com.fs.qw.vo.CompanyUserAndDoctorVO;
+import com.fs.system.service.ISysConfigService;
 import com.github.pagehelper.PageHelper;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.dao.DuplicateKeyException;
 import org.springframework.web.bind.annotation.*;
@@ -74,6 +78,9 @@ public class FsCompanyCustomerController extends BaseController {
     @Autowired
     private IFsUserInformationCollectionService informationCollectionService;
 
+    @Autowired
+    private ISysConfigService sysConfigService;
+
     /**
      * 查询客户列表
      */
@@ -381,9 +388,18 @@ public class FsCompanyCustomerController extends BaseController {
      * */
     @GetMapping("/getQRCode/{orderId}")
     public R getQRCode(@PathVariable("orderId") Long orderId){
-        //TODO appId后续从配置获取
-//        String appId="wx50bcb040b4963a7e";//营口
-        String appId="wx77eb4fff8ea1384b";//久运天天
+        String configValue = sysConfigService.selectConfigByKey("appStore.appId.config");
+        String appId = null;
+        if (StringUtils.isNotEmpty(configValue)) {
+            // 解析JSON
+            JSONObject json = JSONUtil.parseObj(configValue);
+            appId = json.getStr("appId");
+        }
+        // 如果配置不存在或解析失败,使用默认值
+        if (StringUtils.isEmpty(appId)) {
+            log.error("未配置制单小程序appId");
+            appId = "wx50bcb040b4963a7e";//默认为营口市小程序;
+        }
         return informationCollectionService.getCustomerGenerateQRCode(orderId,appId);
     }
 

+ 8 - 3
fs-service/src/main/java/com/fs/qw/service/impl/FsCompanyCustomerServiceImpl.java

@@ -239,11 +239,16 @@ public class FsCompanyCustomerServiceImpl implements IFsCompanyCustomerService {
     public int claimCustomer(FsCompanyCustomer fsCompanyCustomer, CompanyUser companyUser) {
         // 使用行锁查询客户信息(阻塞直到获得锁)
         FsCompanyCustomer oldCustomer = fsCompanyCustomerMapper.selectByIdForUpdate(fsCompanyCustomer.getId());
-        //校验认领号码与客户号码是否一致
+        //校验认领号码与客户号码是否一致(优先匹配完整号码,其次匹配号码后4位,满足一个即可)
         if (!fsCompanyCustomer.getClaimPhone().equals(oldCustomer.getPhone())){
-            log.error("认领号码:{},客户号码:{}",fsCompanyCustomer.getClaimPhone(),oldCustomer.getPhone());
-            throw new CustomException("认领号码与客户号码不一致,请重试");
+            String oldFourNumber = oldCustomer.getPhone().substring(7);
+            String newFourNumber = fsCompanyCustomer.getClaimPhone().substring(fsCompanyCustomer.getClaimPhone().length()-4);
+            if (!oldFourNumber.equals(newFourNumber)){
+                log.error("认领号码:{},客户号码:{}",fsCompanyCustomer.getClaimPhone(),oldCustomer.getPhone());
+                throw new CustomException("认领号码与客户号码不一致,请重试");
+            }
         }
+
         //校验加微状态
         if (fsCompanyCustomer.getKdzlAddWechatStatus()==null){
             throw new CustomException("未选择加微,请选择");