yonge 3 éve
szülő
commit
3a43f3de97

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysPaymentConfigDao.java

@@ -31,12 +31,12 @@ public interface SysPaymentConfigDao extends BaseDAO<Integer, SysPaymentConfig>
      * @param payType
      * @return
      */
-    List<SysPaymentConfig> getPaymentConfigs(@Param("payType") PaymentChannelEnum payType);
+    List<SysPaymentConfig> getPaymentConfigs(@Param("payType") PaymentChannelEnum payType, @Param("tenantId") Integer tenantId);
 
     /**
      * @return
      */
-    List<SysPaymentConfig> getOutAccounts(@Param("payType") PaymentChannelEnum payType);
+    List<SysPaymentConfig> getOutAccounts(@Param("payType") PaymentChannelEnum payType, @Param("tenantId") Integer tenantId);
 
     /**
      * 根据汇付账户获取配置

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/SysPaymentConfigService.java

@@ -29,7 +29,7 @@ public interface SysPaymentConfigService extends BaseService<Integer, SysPayment
      * @param payType
      * @return
      */
-    List<SysPaymentConfig> getPaymentConfigs(PaymentChannelEnum payType);
+    List<SysPaymentConfig> getPaymentConfigs(PaymentChannelEnum payType, Integer tenantId);
 
 
     /**
@@ -38,7 +38,7 @@ public interface SysPaymentConfigService extends BaseService<Integer, SysPayment
      * @param merNos
      * @return
      */
-    AccountType checkAccountType(PaymentChannelEnum payType, String merNos);
+    AccountType checkAccountType(PaymentChannelEnum payType, String merNos, Integer tenantId);
 
     /**
      * 根据汇付获取配置

+ 63 - 21
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentActivityServiceImpl.java

@@ -1,42 +1,84 @@
 package com.ym.mec.biz.service.impl;
 
-import ch.qos.logback.core.util.StringCollectionUtil;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
-import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dao.CooperationOrganDao;
+import com.ym.mec.biz.dal.dao.GoodsDao;
+import com.ym.mec.biz.dal.dao.QuestionnaireQuestionDao;
+import com.ym.mec.biz.dal.dao.QuestionnaireQuestionItemDao;
+import com.ym.mec.biz.dal.dao.QuestionnaireTopicDao;
+import com.ym.mec.biz.dal.dao.QuestionnaireUserResultDao;
+import com.ym.mec.biz.dal.dao.ReplacementInstrumentActivityDao;
+import com.ym.mec.biz.dal.dao.ReplacementInstrumentCooperationDao;
+import com.ym.mec.biz.dal.dao.SellOrderDao;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityDto;
 import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
 import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatHead;
 import com.ym.mec.biz.dal.dto.ReplacementPayDto;
-import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.*;
+import com.ym.mec.biz.dal.entity.CooperationOrgan;
+import com.ym.mec.biz.dal.entity.Goods;
+import com.ym.mec.biz.dal.entity.QuestionnaireQuestion;
+import com.ym.mec.biz.dal.entity.QuestionnaireQuestionItem;
+import com.ym.mec.biz.dal.entity.QuestionnaireTopic;
+import com.ym.mec.biz.dal.entity.QuestionnaireUserResult;
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
+import com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation;
+import com.ym.mec.biz.dal.entity.SellOrder;
+import com.ym.mec.biz.dal.entity.Student;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.SysUserCashAccount;
+import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
+import com.ym.mec.biz.dal.enums.AccountType;
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.GoodsType;
+import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
+import com.ym.mec.biz.dal.enums.PayStatus;
+import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
+import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
+import com.ym.mec.biz.dal.enums.QuestionnaireActiveTypeEnum;
+import com.ym.mec.biz.dal.enums.SellTypeEnum;
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.ReplacementInstrumentActivityQueryInfo;
-import com.ym.mec.biz.dal.page.ReplacementInstrumentQueryInfo;
-import com.ym.mec.biz.service.*;
+import com.ym.mec.biz.service.ContractService;
+import com.ym.mec.biz.service.CooperationOrganService;
+import com.ym.mec.biz.service.GoodsService;
+import com.ym.mec.biz.service.PayService;
+import com.ym.mec.biz.service.ReplacementInstrumentActivityService;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.StudentPaymentRouteOrderService;
+import com.ym.mec.biz.service.StudentService;
+import com.ym.mec.biz.service.SysCouponCodeService;
+import com.ym.mec.biz.service.SysMessageService;
+import com.ym.mec.biz.service.SysPaymentConfigService;
+import com.ym.mec.biz.service.SysUserCashAccountDetailService;
+import com.ym.mec.biz.service.SysUserCashAccountService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
-import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
-import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
 
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.stream.Collectors;
-
 @Service
 public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<Integer, ReplacementInstrumentActivity> implements ReplacementInstrumentActivityService {
 
@@ -531,7 +573,7 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
         BigDecimal goodsTotalPrice = goodies.stream().map(Goods::getGroupPurchasePrice).reduce(BigDecimal.ZERO, BigDecimal::add);
         Map<Integer, GoodsType> goodsTypeMap = goodies.stream().collect(Collectors.toMap(Goods::getId, Goods::getType));
 
-        AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(order.getPaymentChannel()), order.getMerNos());
+        AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(order.getPaymentChannel()), order.getMerNos(), order.getTenantId());
 
         List<Integer> goodsIds = new ArrayList<>();
         goodsIds.add(goods.getId());

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SellOrderServiceImpl.java

@@ -93,7 +93,7 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
         BigDecimal goodsTotalBalance = totalAmount.compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO : goodsTotalPrice.multiply(balance).divide(totalAmount, 2, BigDecimal.ROUND_DOWN);
         //商品占用的总现金
         BigDecimal goodsTotalActualAmount = totalAmount.compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO : goodsTotalPrice.multiply(totalActualAmount).divide(totalAmount, 2, BigDecimal.ROUND_DOWN);
-        AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(order.getPaymentChannel()), order.getMerNos());
+        AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(order.getPaymentChannel()), order.getMerNos(), order.getTenantId());
 
         List<SellOrder> sellOrderList = goodsService.subtractStock(goodsIds, accountType);
         BigDecimal freeCouponRemitFee = couponRemitFee;
@@ -251,7 +251,7 @@ public class SellOrderServiceImpl extends BaseServiceImpl<Integer, SellOrder> im
         int i = 1;
         BigDecimal detailRouteBalance = BigDecimal.ZERO;
 
-        AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(studentPaymentOrder.getPaymentChannel()), studentPaymentOrder.getMerNos());
+        AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(studentPaymentOrder.getPaymentChannel()), studentPaymentOrder.getMerNos(), tenantId);
 
         for (StudentPaymentOrderDetail orderDetail : orderDetails) {
             BigDecimal detailBalance = orderDetail.getPrice().compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO :

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -836,7 +836,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         });
         AccountType accountType = AccountType.INTERNAL;
         if (StringUtils.isNotEmpty(orderByOrderNo.getPaymentChannel())) {
-            accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(orderByOrderNo.getPaymentChannel()), orderByOrderNo.getMerNos());
+            accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(orderByOrderNo.getPaymentChannel()), orderByOrderNo.getMerNos(), orderByOrderNo.getTenantId());
         }
         //实际扣减的库存商品
         List<SellOrder> sellOrderList = goodsService.subtractStock(goodsIds, accountType);

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java

@@ -800,7 +800,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         BigDecimal hasRouteBalance = BigDecimal.ZERO;
         BigDecimal hasRouteExpectAmount = BigDecimal.ZERO;
 
-        AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(order.getPaymentChannel()), order.getMerNos());
+        AccountType accountType = sysPaymentConfigService.checkAccountType(PaymentChannelEnum.valueOf(order.getPaymentChannel()), order.getMerNos(), order.getTenantId());
         List<SellOrder> sellOrderList = goodsService.subtractStock(goodsIds, accountType);
 
         for (Integer goodsId : goodsIds) {

+ 5 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysPaymentConfigServiceImpl.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.biz.service.SysPaymentConfigService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -34,16 +35,16 @@ public class SysPaymentConfigServiceImpl extends BaseServiceImpl<Integer, SysPay
     }
 
     @Override
-    public List<SysPaymentConfig> getPaymentConfigs(PaymentChannelEnum payType) {
-        return sysPaymentConfigDao.getPaymentConfigs(payType);
+    public List<SysPaymentConfig> getPaymentConfigs(PaymentChannelEnum payType, Integer tenantId) {
+        return sysPaymentConfigDao.getPaymentConfigs(payType,tenantId);
     }
 
     @Override
-    public AccountType checkAccountType(PaymentChannelEnum payType, String merNos) {
+    public AccountType checkAccountType(PaymentChannelEnum payType, String merNos, Integer tenantId) {
         if (payType == null || (!payType.equals(PaymentChannelEnum.ADAPAY) && !payType.equals(PaymentChannelEnum.YQPAY)) || StringUtils.isBlank(merNos)) {
             return AccountType.INTERNAL;
         }
-        List<SysPaymentConfig> accounts = sysPaymentConfigDao.getOutAccounts(payType);
+        List<SysPaymentConfig> accounts = sysPaymentConfigDao.getOutAccounts(payType,tenantId);
         String[] merNoArr = merNos.split(",");
         AccountType accountType = AccountType.INTERNAL;
         NODE1:

+ 3 - 2
mec-biz/src/main/resources/config/mybatis/SysPaymentConfigMapper.xml

@@ -205,8 +205,9 @@
         FROM sys_payment_config spc
         LEFT JOIN organization o on spc.organ_id_ = o.id_
         <where>
+        	spc.tenant_id_ = #{tenantId}
             <if test="payType == null">
-                pay_type_ IS NOT NULL
+                and pay_type_ IS NOT NULL
                 AND (spc.yq_mer_no_ !='' OR spc.hf_mer_no_ !='')
             </if>
             <if test="payType != null">
@@ -223,7 +224,7 @@
 
     <!-- 获取所有账户类型为外部的账户 -->
     <select id="getOutAccounts" resultMap="SysPaymentConfig">
-        SELECT * FROM sys_payment_config WHERE account_type_ = 1
+        SELECT * FROM sys_payment_config WHERE account_type_ = 1 and tenant_id_ = #{tenantId}
         <if test="payType != null">
             AND pay_type_ = #{payType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
         </if>

+ 26 - 9
mec-web/src/main/java/com/ym/mec/web/controller/SysPaymentConfigController.java

@@ -1,19 +1,29 @@
 package com.ym.mec.web.controller;
 
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+
+import java.util.Date;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.SysPaymentConfig;
-import com.ym.mec.biz.dal.enums.AccountType;
 import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.biz.dal.page.SysPaymentConfigQueryInfo;
 import com.ym.mec.biz.service.SysPaymentConfigService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
-import io.swagger.annotations.*;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Date;
 
 @RequestMapping("paymentConfig")
 @Api(tags = "支付设置服务")
@@ -22,6 +32,9 @@ public class SysPaymentConfigController extends BaseController {
 
     @Autowired
     private SysPaymentConfigService sysPaymentConfigService;
+    
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
 
     @ApiOperation(value = "新增支付配置")
     @PostMapping("/add")
@@ -96,7 +109,11 @@ public class SysPaymentConfigController extends BaseController {
     @GetMapping("/getPaymentConfigs")
     @PreAuthorize("@pcs.hasPermissions('paymentConfig/getPaymentConfigs')")
     public HttpResponseResult getPaymentConfigs(PaymentChannelEnum payType) {
-        return succeed(sysPaymentConfigService.getPaymentConfigs(payType));
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null || sysUser.getId() == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        return succeed(sysPaymentConfigService.getPaymentConfigs(payType, sysUser.getTenantId()));
     }