Browse Source

商城代码,上线测试缺陷修复

chenguo 5 days ago
parent
commit
44a285b473

+ 2 - 0
fs-service/src/main/java/com/fs/course/config/RedPacketConfig.java

@@ -50,6 +50,8 @@ public class RedPacketConfig implements Serializable {
 
     private String notifyUrl;
 
+    private String notifyUrlScrm;
+
     private Integer isNew;//0:老商户 商家转账到零钱 1:新商户 商家转账
 
 }

+ 23 - 3
fs-service/src/main/java/com/fs/his/utils/ConfigUtil.java

@@ -1,16 +1,15 @@
 package com.fs.his.utils;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.fs.his.config.FsSysConfig;
 import com.fs.hisStore.config.FsErpConfig;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.mapper.SysConfigMapper;
-import com.qcloud.cos.model.GetBucketLifecycleConfigurationRequest;
-import com.qiniu.util.Json;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.Map;
 
 @Service
 public class ConfigUtil {
@@ -43,4 +42,25 @@ public class ConfigUtil {
             return this.fsErpConfig ;
         }
     }
+
+    public <T> T generateConfigByKey(String key, Class<T> clazz){
+        SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey(key);
+        String configValue = sysConfig.getConfigValue();
+        return JSON.parseObject(configValue, clazz);
+    }
+
+    public JSONObject generateConfigByKey(String key){
+        SysConfig sysConfig = sysConfigMapper.selectConfigByConfigKey(key);
+        String configValue = sysConfig.getConfigValue();
+        if(configValue != null && configValue.trim().startsWith("[")){
+            JSONArray array = JSON.parseArray(configValue);
+            if (array.size() > 0) {
+                return array.getJSONObject(0); // 取第一个元素
+            }
+            return new JSONObject();
+        }
+        return JSONObject.parseObject(configValue);
+    }
+
+
 }

+ 97 - 0
fs-service/src/main/java/com/fs/hisStore/enums/SysConfigEnum.java

@@ -0,0 +1,97 @@
+package com.fs.hisStore.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.stream.Stream;
+
+@Getter
+@AllArgsConstructor
+public enum SysConfigEnum {
+
+    //根据sys_config表的config_key字段的值来获取对应的枚举值
+    //主框架页-默认皮肤样式名称,sys.index.skinName
+    SYS_INDEX_SKIN_NAME("sys.index.skinName", "主框架页-默认皮肤样式名称"),
+    //用户管理-账号初始密码,sys.user.initPassword
+    SYS_USER_INIT_PASSWORD("sys.user.initPassword", "用户管理-账号初始密码"),
+    //主框架页-侧边栏主题,sys.index.sideTheme
+    SYS_INDEX_SIDE_THEME("sys.index.sideTheme", "主框架页-侧边栏主题"),
+    //账号自助-验证码开关,sys.account.captchaOnOff
+    SYS_ACCOUNT_CAPTCHA_ON_OFF("sys.account.captchaOnOff", "账号自助-验证码开关"),
+    //账号自助-是否开启用户注册功能,sys.account.registerUser
+    SYS_ACCOUNT_REGISTER_USER("sys.account.registerUser", "账号自助-是否开启用户注册功能"),
+    //oss存储配置,sys.oss.cloudStorage
+    SYS_OSS_CLOUD_STORAGE("sys.oss.cloudStorage", "oss存储配置"),
+    //问诊配置,his.inquiryConfig
+    HIS_INQUIRY_CONFIG("his.inquiryConfig", "问诊配置"),
+    //协议配置,his.agreementConfig
+    HIS_AGREEMENT_CONFIG("his.agreementConfig", "协议配置"),
+    //资质证书,his.certs
+    HIS_CERTS("his.certs", "资质证书"),
+    //佣金配置,his.brokerage
+    HIS_BROKERAGE("his.brokerage", "佣金配置"),
+    //优惠劵配置,his.coupon
+    HIS_COUPON("his.coupon", "优惠劵配置"),
+    //商城配置,his.store
+    HIS_STORE("his.store", "商城配置"),
+    //套餐包配置,his.package
+    HIS_PACKAGE("his.package", "套餐包配置"),
+    //支付配置,his.pay
+    HIS_PAY("his.pay", "支付配置"),
+    //布局配置,his.appShow
+    HIS_APP_SHOW("his.appShow", "布局配置"),
+    //积分配置,his.integral
+    HIS_INTEGRAL("his.integral", "积分配置"),
+    //签到配置,his.sign
+    HIS_SIGN("his.sign", "签到配置"),
+    //系统配置,his.config
+    HIS_CONFIG("his.config", "系统配置"),
+    //短信配置,his.sms
+    HIS_SMS("his.sms", "短信配置"),
+    //企微客服配置,qw:config
+    QW_CONFIG("qw:config", "企微客服配置"),
+    //小程序商城配置,store.config
+    STORE_CONFIG("store.config", "小程序商城配置"),
+    //课堂配置,course.config
+    COURSE_CONFIG("course.config", "课堂配置"),
+    //红包配置,redPacket.config
+    RED_PACKET_CONFIG("redPacket.config", "红包配置"),
+    //个微添加限制数量,add.wx
+    ADD_WX("add.wx", "个微添加限制数量"),
+    //广告配置,his.ad
+    HIS_AD("his.ad", "广告配置"),
+    //企微Sop客户评级配置,qwRating:config
+    QW_RATING_CONFIG("qwRating:config", "企微Sop客户评级配置"),
+    //app配置,app.config
+    APP_CONFIG("app.config", "app配置"),
+    //点播小程序配置,courseMa.config
+    COURSE_MA_CONFIG("courseMa.config", "点播小程序配置"),
+    //统计配置,statis.config
+    STATIS_CONFIG("statis.config", "统计配置"),
+    //企业理念配置,store.concept
+    STORE_CONCEPT("store.concept", "企业理念配置"),
+    //erp配置,erp.config
+    ERP_CONFIG("erp.config", "erp配置"),
+    //客服电话,customer.phone
+    CUSTOMER_PHONE("customer.phone", "客服电话"),
+    //erp推送默认电话,erp.phone
+    ERP_PHONE("erp.phone", "erp推送默认电话"),
+    //公司销售角色默认生成配置,companymenu.config
+    COMPANY_MENU_CONFIG("companymenu.config", "公司销售角色默认生成配置"),
+    //注册配置,his.login
+    REGISTER_CONFIG("his.login", "注册配置"),
+    //直播配置,living.config
+    LIVING_CONFIG("living.config", "直播配置"),
+    //红包流量,joinTime.switch.config
+    JOIN_TIME_SWITCH_CONFIG("joinTime.switch.config", "红包流量"),
+    //签到配置,store.sign
+    SIGN_CONFIG("store.sign", "签到配置"),
+    //商城支付配置,store.pay
+    STORE_PAY_CONFIG("store.pay", "商城支付配置");
+
+    private final String key;
+    private final String name;
+
+
+
+}

+ 4 - 0
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreCartScrmServiceImpl.java

@@ -222,6 +222,10 @@ public class FsStoreCartScrmServiceImpl implements IFsStoreCartScrmService
     @Override
     public void checkProductStock(Long productId, Long productAttrValueId) {
         IErpGoodsService goodsService = getErpService();
+        if(goodsService == null){
+            log.info("未找到erp服务");
+            throw new CustomException("未找到erp服务");
+        }
         log.info("检查库存 {} {}",productId,productAttrValueId);
         FsStoreProductAttrValueScrm productAttrValue=valueMapper.selectFsStoreProductAttrValueById(productAttrValueId);
         if(StringUtils.isEmpty(productAttrValue.getGroupBarCode())){

+ 12 - 4
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStoreOrderScrmServiceImpl.java

@@ -1530,13 +1530,17 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService
     @Override
     public R createOmsOrder(Long orderId) throws ParseException {
         FsStoreOrderScrm order=fsStoreOrderMapper.selectFsStoreOrderById(orderId);
-        FsSysConfig erpConfig = configUtil.getSysConfig();
+        FsSysConfig erpConfig = configUtil.generateConfigByKey(SysConfigEnum.HIS_CONFIG.getKey(), FsSysConfig.class);
         List<Long> noErpCompany = erpConfig.getNoErpCompany();
         if (noErpCompany.contains(order.getCompanyId())) {
             log.info("订单:{},相关公司不推送erp", order.getOrderCode());
             return R.error("订单:" + order.getOrderCode() +",相关公司不推送erp");
         }
         IErpOrderService erpOrderService = getErpService();
+        if(erpOrderService == null){
+            log.info("未启用erp");
+            return R.error("暂未启用erp");
+        }
         if(!StringUtils.isEmpty(order.getExtendOrderId())&&order.getStatus()!=1){
             return R.error("订单:" + order.getOrderCode() +",已推送erp/订单状态不正确");
         }
@@ -1559,7 +1563,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService
 
     @Override
     public ErpOrder getErpOrder(FsStoreOrderScrm order) throws ParseException {
-        FsSysConfig erpConfig = configUtil.getSysConfig();
+        FsSysConfig erpConfig = configUtil.generateConfigByKey("his.config",FsSysConfig.class);
         ErpOrder erpOrder=new ErpOrder();
         if (order.getCompanyId()!=null){
             erpOrder.setVip_code(order.getUserId().toString()+ order.getCompanyId().toString());
@@ -1826,7 +1830,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService
             request.setTid(order.getOrderCode());
             request.setOid(order.getOrderCode());
             request.setRefund_state(1);
-            BaseResponse response=erpOrderService.refundUpdate(request);
+            //BaseResponse response=erpOrderService.refundUpdate(request);
 //            if(response.getSuccess()){
 //            }
 //            else{
@@ -1937,11 +1941,15 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService
             return R.ok("订单:"+ order.getOrderCode()+"相关公司不推送erp");
         }
         IErpOrderService erpOrderService = getErpService();
+        if(erpOrderService == null){
+            log.info("未启用erp");
+            return R.error("暂未启用erp");
+        }
         if(order.getStatus()!=1){
             return R.error("只有待发货状态可以同步");
         }
         if(order.getExtendOrderId()==null){
-            return R.error("未生成管易云订单");
+            return R.error("未生成erp订单");
         }
         ErpOrderQueryRequert request = new ErpOrderQueryRequert();
         request.setCode(order.getExtendOrderId());

+ 9 - 4
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStorePaymentScrmServiceImpl.java

@@ -28,6 +28,8 @@ import com.fs.course.mapper.FsCourseRedPacketLogMapper;
 import com.fs.course.service.IFsCourseRedPacketLogService;
 import com.fs.his.domain.FsUserWx;
 import com.fs.his.service.IFsUserWxService;
+import com.fs.his.utils.ConfigUtil;
+import com.fs.hisStore.enums.SysConfigEnum;
 import com.fs.pay.pay.config.PayConfig;
 import com.fs.pay.pay.dto.WxJspayDTO;
 import com.fs.hisStore.param.FsStoreStatisticsParam;
@@ -93,6 +95,8 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
     @Autowired
     IPayService ybPayService;
     @Autowired
+    private ConfigUtil configUtil;
+    @Autowired
     private ISysConfigService configService;
 
     @Autowired
@@ -227,7 +231,8 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
         p.setLowOrderId("payment-"+storePayment.getPayCode());
         p.setBody("超重/肥胖/气血/代谢/美乳/慢病医学管理方案服务");
         p.setIsMinipg("1");
-        p.setReturnUrl(PayConfig.notifyUrl);
+        //p.setReturnUrl(PayConfig.notifyUrl);
+        p.setReturnUrl(configUtil.generateConfigByKey(SysConfigEnum.RED_PACKET_CONFIG.getKey()).getString("notifyUrlScrm"));
         p.setOpenId(user.getMaOpenId());
         p.setAttach("");
         p.setStoreid("0");
@@ -417,7 +422,7 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
         request.setTransferAmount(amount);
         request.setTransferRemark("活动奖励");
         request.setUserRecvPerception("活动奖励");
-        request.setNotifyUrl(config.getNotifyUrl());
+        request.setNotifyUrl(config.getNotifyUrlScrm());
         request.setTransferSceneId("1000");
 
         // 设置场景信息
@@ -465,7 +470,7 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
         Integer amount = WxPayUnifiedOrderRequest.yuanToFen(param.getAmount().toString());
         request.setTotalAmount(amount);
         request.setTotalNum(1);
-        request.setNotifyUrl(config.getNotifyUrl());
+        request.setNotifyUrl(config.getNotifyUrlScrm());
 
         ArrayList<TransferBatchesRequest.TransferDetail> transferDetailList = new ArrayList<>();
         TransferBatchesRequest.TransferDetail transferDetail = new TransferBatchesRequest.TransferDetail();
@@ -576,7 +581,7 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
         Integer amount = WxPayUnifiedOrderRequest.yuanToFen(param.getAmount().toString());
         request.setTotalAmount(amount);
         request.setTotalNum(1);
-        request.setNotifyUrl(config.getNotifyUrl());
+        request.setNotifyUrl(config.getNotifyUrlScrm());
 
         ArrayList<TransferBatchesRequest.TransferDetail> transferDetailList = new ArrayList<>();
         TransferBatchesRequest.TransferDetail transferDetail = new TransferBatchesRequest.TransferDetail();

+ 14 - 4
fs-user-app/src/main/java/com/fs/app/controller/store/WxUserScrmController.java

@@ -5,6 +5,8 @@ import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
 import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
 import cn.binarywang.wx.miniapp.bean.WxMaUserInfo;
 import cn.hutool.core.date.DateTime;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.fs.app.annotation.Login;
 import com.fs.app.controller.AppBaseController;
 import com.fs.app.utils.JwtUtils;
@@ -14,7 +16,9 @@ import com.fs.common.exception.CustomException;
 import com.fs.common.utils.IpUtil;
 import com.fs.core.config.WxMaConfiguration;
 import com.fs.core.config.WxMpProperties;
+import com.fs.his.utils.ConfigUtil;
 import com.fs.hisStore.domain.FsUserScrm;
+import com.fs.hisStore.enums.SysConfigEnum;
 import com.fs.hisStore.param.LoginMpWxParam;
 import com.fs.hisStore.param.LoginWxParam;
 import com.fs.hisStore.service.IFsUserScrmService;
@@ -59,6 +63,9 @@ public class WxUserScrmController extends AppBaseController {
     @Autowired
     JwtUtils jwtUtils;
 
+    @Autowired
+    private ConfigUtil configUtil;
+
     /**
      * 登陆接口
      */
@@ -253,7 +260,9 @@ public class WxUserScrmController extends AppBaseController {
         if (StringUtils.isBlank(param.getCode())) {
             return R.error("code不存在");
         }
-        final WxMaService wxService = WxMaConfiguration.getMaService(maProperties.getConfigs().get(3).getAppid());
+        final WxMaService wxService = WxMaConfiguration.getMaService(
+                configUtil.generateConfigByKey(SysConfigEnum.COURSE_MA_CONFIG.getKey()).getString("appid")
+        );
         try {
             WxMaJscode2SessionResult session = wxService.getUserService().getSessionInfo(param.getCode());
             // 解密
@@ -270,10 +279,10 @@ public class WxUserScrmController extends AppBaseController {
                     userMap.setUserId(user.getUserId());
                     userMap.setPhone(phoneNoInfo.getPhoneNumber());
                     userMap.setUpdateTime(new DateTime());
-                    userMap.setIsShow(0);
-                    user.setMaOpenId(session.getOpenid());
+                    userMap.setIsShow(1);
+                    userMap.setMaOpenId(session.getOpenid());
                     if(StringUtils.isNotEmpty(session.getUnionid())){
-                        user.setUnionId(session.getUnionid());
+                        userMap.setUnionId(session.getUnionid());
                     }
                     userMap.setLastIp(ip);
                     userService.updateFsUser(userMap);
@@ -294,6 +303,7 @@ public class WxUserScrmController extends AppBaseController {
                     user.setStatus(1);
                     user.setMaOpenId(session.getOpenid());
                     user.setLastIp(ip);
+                    user.setIsShow(1);
                     user.setIsWeixinAuth(0);
                     user.setCreateTime(new Date());
                     if(StringUtils.isNotEmpty(session.getUnionid())){