瀏覽代碼

Merge remote-tracking branch 'origin/saas' into saas

zouxuan 3 年之前
父節點
當前提交
08011fa435

+ 23 - 8
cms/src/main/java/com/ym/mec/cms/interceptor/TenantInterceptor.java

@@ -3,6 +3,7 @@ package com.ym.mec.cms.interceptor;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
@@ -11,11 +12,14 @@ import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.cms.dal.entity.TenantInfo;
 import com.ym.mec.cms.service.TenantInfoService;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.tenant.TenantContextHolder;
 
 public class TenantInterceptor extends HandlerInterceptorAdapter {
 
 	private static final String DATA_SOURCE_ID = "datasourceId";
+	
+	private static final String TENANT_ID = "tenantId";
 
 	@Autowired
 	@Lazy
@@ -27,16 +31,27 @@ public class TenantInterceptor extends HandlerInterceptorAdapter {
 	@Override
 	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
 		
-		SysUser sysUser = sysUserFeignService.queryUserInfo();
-		
-		if(sysUser != null && sysUser.getId() != null){
-			TenantContextHolder.setTenantId(sysUser.getTenantId());
-			
-			TenantInfo tenantInfo = tenantInfoService.get(sysUser.getTenantId());
+		String tenantId = request.getParameter(TENANT_ID);
+
+        if (StringUtils.isBlank(tenantId)) {
+            tenantId = request.getHeader(TENANT_ID);
+        }
+
+        if (StringUtils.isBlank(tenantId)) {
+            SysUser sysUser = sysUserFeignService.queryUserInfo();
+            if (sysUser != null && sysUser.getTenantId() != null) {
+                tenantId = sysUser.getTenantId().toString();
+            }
+        }
+        if (StringUtils.isNotBlank(tenantId)) {
+            TenantContextHolder.setTenantId(Integer.parseInt(tenantId));
+            TenantInfo tenantInfo = tenantInfoService.get(Integer.parseInt(tenantId));
 			if(tenantInfo != null){
 				request.setAttribute(DATA_SOURCE_ID, tenantInfo.getDataSource());
-			}
-		}
+			} else {
+                throw new BizException("机构信息异常,请联系管理员");
+            }
+        }
 		
 		return true;
 	}

+ 6 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/SysConfigService.java

@@ -385,6 +385,12 @@ public interface SysConfigService extends BaseService<Long, SysConfig> {
     //云教练试用时间最晚截止时间
     String EXPERIENCE_MEMBERSHIP_END_TIME = "experience_membership_end_time";
 
+    //小课收入是否由平台收款
+    String IS_OPEN_SMALL_CLASS_INCOME_TO_PLATFORM = "is_open_small_class_income_to_platform";
+
+    //平台收款账户
+    String PLATFORM_PAYEE_ACCOUNT = "platform_payee_account";
+
     /**
      * @return com.ym.mec.biz.dal.entity.SysConfig
      * @params paramName

+ 112 - 88
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrderPayOpsServiceImpl.java

@@ -1,10 +1,49 @@
 package com.ym.mec.biz.service.impl;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.function.BiPredicate;
+import java.util.function.Consumer;
+import java.util.function.Function;
+
+import org.apache.commons.lang3.StringUtils;
+import org.redisson.api.RBucket;
+import org.redisson.api.RedissonClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.DigestUtils;
+
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.dao.SysConfigDao;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+import com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.biz.dal.entity.SysPaymentConfig;
+import com.ym.mec.biz.dal.entity.TenantConfig;
+import com.ym.mec.biz.dal.entity.TenantOrderRecord;
+import com.ym.mec.biz.dal.entity.TenantPaymentOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.service.*;
+import com.ym.mec.biz.service.CloudTeacherOrderService;
+import com.ym.mec.biz.service.OrderPayOpsService;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysPaymentConfigService;
+import com.ym.mec.biz.service.TenantConfigService;
+import com.ym.mec.biz.service.TenantOrderRecordService;
+import com.ym.mec.biz.service.TenantPaymentOrderService;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.WrapperUtil;
 import com.ym.mec.thirdparty.adapay.ConfigInit;
@@ -12,24 +51,6 @@ import com.ym.mec.thirdparty.adapay.Payment;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
 import com.ym.mec.util.json.JsonUtil;
-import org.apache.commons.lang3.StringUtils;
-import org.redisson.api.RBucket;
-import org.redisson.api.RedissonClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.util.DigestUtils;
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.text.SimpleDateFormat;
-import java.util.*;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeUnit;
-import java.util.function.BiPredicate;
-import java.util.function.Consumer;
-import java.util.function.Function;
 
 /**
  * @author hgw
@@ -56,6 +77,9 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
     private SysConfigService sysConfigService;
 
     @Autowired
+    private SysConfigDao sysConfigDao;
+    
+    @Autowired
     private SysPaymentConfigService sysPaymentConfigService;
 
     //支付类型
@@ -300,77 +324,77 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
         paymentParams.put("pay_amt", payParam.getAmount().setScale(2, RoundingMode.HALF_UP));
         paymentParams.put("goods_title", payParam.getOrderSubject());
         paymentParams.put("goods_desc", payParam.getOrderBody());
+        
+        TenantConfig tenantConfig = tenantConfigService.queryByTenantId(payParam.getTenantId());
+        if (tenantConfig == null) {
+            throw new BizException("机构[{}]信息找不到", payParam.getTenantId());
+        }
+        
+        if (clazz instanceof StudentPaymentOrder || clazz instanceof TenantPaymentOrder) {
+        	
+        	if (payParam.getTenantId() == 1) {
+                // 延时分账
+                paymentParams.put("pay_mode", "delay");
+            } else {
 
-        if (payParam.getTenantId() == 1) {
-            // 延时分账
-            paymentParams.put("pay_mode", "delay");
-        } else {
-            TenantConfig tenantConfig = tenantConfigService.queryByTenantId(payParam.getTenantId());
-            if (tenantConfig == null) {
-                throw new BizException("机构[{}]信息找不到", payParam.getTenantId());
-            }
-            String merNos;
-            BigDecimal amount;
-            Function<BigDecimal, BigDecimal> amountTo = (a) -> a
-                    .multiply(tenantConfig.getChargeRate())
-                    .divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP);
-
-            if (clazz instanceof StudentPaymentOrder) {
-                StudentPaymentOrder st = (StudentPaymentOrder) clazz;
-                merNos = st.getMerNos();
-                amount = amountTo.apply(st.getActualAmount());
-
-                List<Map<String, Object>> divMemberList = new ArrayList<>();
+                Function<BigDecimal, BigDecimal> amountTo = (a) -> a
+                        .multiply(tenantConfig.getChargeRate())
+                        .divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP);
+                
+            	StudentPaymentOrder st = (StudentPaymentOrder) clazz;
+            	BigDecimal amount = amountTo.apply(st.getActualAmount());
+		        
+				List<Map<String, Object>> divMemberList = new ArrayList<>();
                 // 实时分账
-                if (amount.doubleValue() > 0) {
-
-                    SysConfig config = sysConfigService.findByParamName("platform_collection_organ");
-                    if (Objects.isNull(config)) {
-                        throw new BizException("平台收款账户没有设置[platform_collection_organ]");
-                    }
-
-                    SysPaymentConfig sysPaymentConfig = sysPaymentConfigService.findPaymentConfigByOrganId(Integer.parseInt(config.getParanValue()));
-
-                    if (sysPaymentConfig == null || StringUtils.isBlank(sysPaymentConfig.getHfMerNo())) {
-                        throw new BizException("分部[{}]没有设置收款账号", config.getParanValue());
-                    }
-
-                    Map<String, Object> divMember = new HashMap<>();
-                    divMember.put("member_id", sysPaymentConfig.getHfMerNo());
-                    divMember.put("amount", amount);
-                    divMember.put("fee_flag", "Y");
-                    divMemberList.add(divMember);
-                }
-
-                Map<String, Object> divMember1 = new HashMap<>();
-                divMember1.put("member_id", merNos);
-                divMember1.put("amount", payParam.getAmount().subtract(amount));
-                divMember1.put("fee_flag", "N");
-                divMemberList.add(divMember1);
-
-                paymentParams.put("div_members", JsonUtil.toJSONString(divMemberList));
-
-            } else if (clazz instanceof TenantOrderRecord) {//向平台支付,不分账
-                TenantOrderRecord tor = (TenantOrderRecord) clazz;
-                merNos = tor.getMerNos();
-
-                List<Map<String, Object>> divMemberList = new ArrayList<>();
-                Map<String, Object> divMember = new HashMap<>();
-                divMember.put("member_id", merNos);
-                divMember.put("amount", tor.getActualAmount());
-                divMember.put("fee_flag", "Y");
-                divMemberList.add(divMember);
-
-                paymentParams.put("div_members", JsonUtil.toJSONString(divMemberList));
-
-            } /*else if (clazz instanceof TenantPaymentOrder) {
-                TenantPaymentOrder tpo = (TenantPaymentOrder) clazz;
-                merNos = tpo.getMerNos();
-                amount = amountTo.apply(tpo.getActualAmount());
-            } */ else {
-                throw new BizException("订单[{}]找不到", payParam.getOrderNo());
+    			if (amount.doubleValue() > 0) {
+    				
+    				/*SysConfig config = sysConfigService.findByParamName("platform_collection_organ");
+    		        if (Objects.isNull(config)) {
+    		            throw new BizException("平台收款账户没有设置[platform_collection_organ]");
+    		        }
+    	        	
+    	        	SysPaymentConfig sysPaymentConfig = sysPaymentConfigService.findPaymentConfigByOrganId(Integer.parseInt(config.getParanValue()));
+    	        	
+    	        	if(sysPaymentConfig == null || StringUtils.isBlank(sysPaymentConfig.getHfMerNo())){
+    	        		throw new BizException("分部[{}]没有设置收款账号", config.getParanValue());
+    	        	}*/
+    				
+    				String platformAccount = sysConfigDao.findConfigValue(SysConfigService.PLATFORM_PAYEE_ACCOUNT);
+    	        	
+    	        	if(StringUtils.isBlank(platformAccount)){
+    	        		throw new BizException("平台收款账户查询失败");
+    	        	}
+    	        	
+    				Map<String, Object> divMember = new HashMap<>();
+    				divMember.put("member_id", platformAccount);
+    				divMember.put("amount", amount);
+    				divMember.put("fee_flag", "Y");
+    				divMemberList.add(divMember);
+    			}
+
+				Map<String, Object> divMember1 = new HashMap<>();
+				divMember1.put("member_id", st.getMerNos());
+				divMember1.put("amount", payParam.getAmount().subtract(amount));
+				divMember1.put("fee_flag", "N");
+				divMemberList.add(divMember1);
+				
+				paymentParams.put("div_members", JsonUtil.toJSONString(divMemberList));
             }
-        }
+        	
+        } else if (clazz instanceof TenantOrderRecord) {//向平台支付,不分账
+        	TenantOrderRecord tor = (TenantOrderRecord) clazz;
+            
+            List<Map<String, Object>> divMemberList = new ArrayList<>();
+			Map<String, Object> divMember = new HashMap<>();
+			divMember.put("member_id", tor.getMerNos());
+			divMember.put("amount", tor.getActualAmount());
+			divMember.put("fee_flag", "Y");
+			divMemberList.add(divMember);
+
+			paymentParams.put("div_members", JsonUtil.toJSONString(divMemberList));
+        } else {
+	        throw new BizException("订单[{}]找不到", payParam.getOrderNo());
+	    }
 
         //手续费收取模式:O-商户手续费账户扣取手续费,I-交易金额中扣取手续费;值为空时,默认值为I;若为O时,分账对象列表中不支持传入手续费承担方
         //paymentParams.put("fee_mode", "I");

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

@@ -28,10 +28,12 @@ import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
 import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.dal.entity.SysPaymentConfig;
 import com.ym.mec.biz.dal.enums.FeeTypeEnum;
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.biz.service.PayService;
 import com.ym.mec.biz.service.SellOrderService;
 import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.SysPaymentConfigService;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.redis.service.RedisCache;
@@ -108,6 +110,49 @@ public class PayServiceImpl implements PayService {
             return unionPay;
         }
         
+        //如果当前是买的小课/网管课
+		if (studentPaymentOrder.getType() == OrderTypeEnum.SMALL_CLASS_TO_BUY || studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_BUY
+				|| studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_RENEW) {
+			
+			// 是否由平台收款
+			String isPlatformCollection = sysConfigDao.findConfigValue(SysConfigService.IS_OPEN_SMALL_CLASS_INCOME_TO_PLATFORM);
+			
+			if (StringUtils.equals("1", isPlatformCollection)) {
+				Date date = new Date();
+	        	
+	        	String merNo = sysConfigDao.findConfigValue(SysConfigService.PLATFORM_PAYEE_ACCOUNT);
+	        	
+	        	if(StringUtils.isBlank(merNo)){
+	        		throw new BizException("平台收款账户查询失败");
+	        	}
+	        	
+	        	StudentPaymentRouteOrder studentPaymentRouteOrder = new StudentPaymentRouteOrder();
+	            studentPaymentRouteOrder.setOrderNo(orderNo);
+	            studentPaymentRouteOrder.setRouteOrganId(organId);
+	            studentPaymentRouteOrder.setFeeFlag("Y");
+	            studentPaymentRouteOrder.setRouteAmount(amount);
+	            studentPaymentRouteOrder.setRouteBalanceAmount(balanceAmount);
+	            studentPaymentRouteOrder.setMerNo(merNo);
+	            studentPaymentRouteOrder.setSaleAmount(BigDecimal.ZERO);
+	            studentPaymentRouteOrder.setServiceAmount(amount);
+	            studentPaymentRouteOrder.setCreateTime(date);
+	            studentPaymentRouteOrder.setUpdateTime(date);
+	            studentPaymentRouteOrderDao.insert(studentPaymentRouteOrder);
+	            
+	            Map<String, Object> unionPay = new HashMap<>();
+	            Map<String, Object> payMap = Payment.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody);
+	            
+	            PaymentChannelEnum payType = PaymentChannelEnum.ADAPAY;
+
+	            unionPay.put("orderNo", orderNo);
+	            unionPay.put("type", payType.getCode());
+	            unionPay.put("payMap", payMap);
+	            unionPay.put("routingMerNos", merNo);
+	            return unionPay;
+			}
+			
+		}
+        
         String usePaymentConfig = sysConfigDao.findConfigValue("use_payment_config");// 是否用收费配置(1:使用 0:不使用)
         List<RouteScaleDto> routeScaleDtos = null;
         //使用配置开关
@@ -145,7 +190,7 @@ public class PayServiceImpl implements PayService {
 	public Map<String, Object> getPayToPlatformMap(PaymentChannelEnum paymentChannel, BigDecimal amount, BigDecimal balanceAmount, String orderNo, String notifyUrl, String returnUrl,
 			String orderSubject, String orderBody) throws Exception {
     	
-    	SysConfig config = sysConfigDao.findByParamName("platform_collection_organ");
+    	/*SysConfig config = sysConfigDao.findByParamName("platform_collection_organ");
         if (Objects.isNull(config)) {
             throw new BizException("平台收款账户没有设置[platform_collection_organ]");
         }
@@ -156,7 +201,13 @@ public class PayServiceImpl implements PayService {
     		throw new BizException("分部[{}]没有设置收款账号", config.getParanValue());
     	}
     	
-    	String payeeMerNo = sysPaymentConfig.getHfMerNo();
+    	String payeeMerNo = sysPaymentConfig.getHfMerNo();*/
+    	
+    	String payeeMerNo = sysConfigDao.findConfigValue(SysConfigService.PLATFORM_PAYEE_ACCOUNT);
+    	
+    	if(StringUtils.isBlank(payeeMerNo)){
+    		throw new BizException("平台收款账户查询失败");
+    	}
     	
         Map<String, Object> payMap = null;
         

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

@@ -184,6 +184,7 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
         student.setIsNewUser(true);
         student.setSchoolName(studentPreRegistration.getSchool());
         student.setCurrentGradeNum(studentPreRegistration.getCurrentGradeNum());
+        student.setSubjectIdList(studentPreRegistration.getSelectionSubjectId().toString());
         student.setCurrentClass(studentPreRegistration.getCurrentClass());
         student.setRemark(studentPreRegistration.getRemake());
         student.setUnitName(studentPreRegistration.getUnitName());

+ 0 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -503,10 +503,6 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
      * @param val      购买周期
      */
     public Map<String, Object> tenantRenewPay(Integer tenantId, Integer val) throws Exception {
-        SysConfig config = sysConfigService.findByParamName("platform_collection_organ");
-        if (Objects.isNull(config)) {
-            throw new BizException("未查询到机构收款分部信息!");
-        }
 
         TenantOrderRecordEnum tenantEnum = TenantOrderRecordEnum.TENANT_RENEW;
         Map<String, Object> result = new HashMap<>();

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

@@ -8,6 +8,7 @@ import com.ym.mec.biz.dal.dao.TenantOrderRecordDao;
 import com.ym.mec.biz.dal.dto.TenantOrderRecordDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.biz.dal.enums.TenantOrderRecordEnum;
 import com.ym.mec.biz.service.*;
@@ -16,6 +17,7 @@ import com.ym.mec.common.page.PageUtil;
 import com.ym.mec.common.page.WrapperUtil;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.adapay.Payment;
+import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.joda.time.LocalDateTime;
@@ -54,7 +56,8 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
     private TenantAssetsInfoService assetsInfoService;
     @Autowired
     private TenantConfigService tenantConfigService;
-
+    @Autowired
+    private SysMessageService sysMessageService;
     //订单不存在
     private static final String PAYMENT_ID_NOT_EXISTS = "payment_id_not_exists";
 
@@ -263,6 +266,26 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
         // 更新 tenantAssetsInfo
         log.info("checkRechargeCheck  updateAmount>>>>>");
         int ret = assetsInfoService.updateAmount(record.getTenantId(), record.getExpectAmount());
+        // 取余额
+        TenantAssetsInfo assets = assetsInfoService.getOne(new WrapperUtil<TenantAssetsInfo>().hasEq("tenant_id_", record.getTenantId()).queryWrapper());
+        TenantInfo tenantInfo = tenantInfoService.getOne(new WrapperUtil<TenantInfo>().hasEq("tenant_id_", record.getTenantId()).queryWrapper());
+        Integer receiveUserId = tenantInfo.getUserId();
+        String email = tenantInfo.getEmail();
+
+
+        Object[] objs = {tenantInfo.getName(), record.getActualAmount(), assets.getBalance()};
+
+        // 发邮件, 发短信
+        Map<Integer, String> sendPar = new HashMap<>();
+        sendPar.put(receiveUserId, email);
+        log.info("platformSendToAll 充值成功发送邮件  >>> receiveUserId {} email {} objs {} sendPar {}", receiveUserId, email, objs, sendPar);
+        sysMessageService.batchSendMessage(-1, MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.SMS_TENANT_RECHARGE, sendPar, null, 0, null, "SYSTEM", objs);
+
+        Map<Integer, String> sendPar2 = new HashMap<>();
+        sendPar2.put(receiveUserId, email);
+        log.info("platformSendToAll 充值成功发送邮件分发器  >>> receiveUserId {} email {} objs {} sendPar {}", receiveUserId, email, objs, sendPar2);
+        sysMessageService.batchSendMessage(-1, MessageSenderPluginContext.MessageSender.EMAIL, MessageTypeEnum.EMAIL_TENANT_RECHARGE, sendPar2, null, 0, null, "SYSTEM", objs);
+
         if (ret != 1) {
             throw new Exception("更新支付失败");
         }

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/TeacherMapper.xml

@@ -942,7 +942,7 @@
         <include refid="queryPageNameSql"/>
     </select>
     <sql id="queryPageNameSql">
-    	t.tenant_id_ = #{tenantId}
+        AND t.tenant_id_ = #{tenantId}
         <if test="organId != null and includeFlowOrgan==null">
             AND FIND_IN_SET(t.organ_id_,#{organId})
         </if>

+ 14 - 0
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/message/provider/CommEmailPlugin.java

@@ -90,6 +90,20 @@ public class CommEmailPlugin implements MessageSenderPlugin, InitializingBean {
 		return true;
 	}
 
+	public static void main(String[] args) throws Exception {
+		CommEmailPlugin cep = new CommEmailPlugin();
+		cep.setUserName("lexiaoyavip@163.com");
+		cep.setHostName("smtp.163.com");
+		cep.setSmtpPort(465);
+		cep.setPassword("HMBJPGYXFOLEBGIP");
+		cep.setFrom("lexiaoyavip@163.com");
+		cep.setFromName("乐小雅");
+		cep.send("测试邮件",
+				 "<b style='color:red'>测试邮件内容</b>",
+				 "yanite1234@sina.com",
+				 null, null, null, null);
+	}
+
 	@Override
 	public boolean send(String subject, String content, String receiver, String url, String jpushType, String sound, String channelId) throws Exception {
 		if (hostName == null || hostName.equals("")) {