Переглянути джерело

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

zouxuan 3 роки тому
батько
коміт
d9d89fa67e
24 змінених файлів з 445 додано та 193 видалено
  1. 2 0
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/handler/BaseAuthenticationSuccessEventHandler.java
  2. 5 5
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Student.java
  3. 3 3
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPreRegistration.java
  4. 0 8
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysUserTsign.java
  5. 12 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/page/CloudTeacherOrderQueryInfo.java
  6. 33 15
      mec-biz/src/main/java/com/ym/mec/biz/service/PayService.java
  7. 3 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java
  8. 98 8
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java
  9. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/IndexBaseMonthDataServiceImpl.java
  10. 98 35
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrderPayOpsServiceImpl.java
  11. 107 14
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java
  12. 3 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java
  13. 17 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java
  14. 10 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java
  15. 9 21
      mec-biz/src/main/resources/config/contracts/product2.ftl
  16. 5 17
      mec-biz/src/main/resources/config/contracts/product3.ftl
  17. 5 17
      mec-biz/src/main/resources/config/contracts/product4.ftl
  18. 12 11
      mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml
  19. 1 1
      mec-biz/src/main/resources/config/mybatis/IndexErrDataRecordMapper.xml
  20. 2 2
      mec-biz/src/main/resources/config/mybatis/StudentMapper.xml
  21. 1 0
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  22. 1 1
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/Payment.java
  23. 9 4
      mec-web/src/main/java/com/ym/mec/web/controller/CloudTeacherOrderController.java
  24. 8 8
      mec-web/src/main/resources/bootstrap-dev.properties

+ 2 - 0
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/core/handler/BaseAuthenticationSuccessEventHandler.java

@@ -102,6 +102,7 @@ public class BaseAuthenticationSuccessEventHandler extends SavedRequestAwareAuth
 			userLogin.setLastLoginIp(request.getRemoteAddr());
 			userLogin.setUserId(sysUser.getId());
 			userLogin.setLoginCount(1);
+			userLogin.setTenantId(sysUser.getTenantId());
 			sysUserLoginService.insert(setUserLogin(userLogin,date));
 		}else {
 			userLogin.setLastLoginIp(request.getRemoteAddr());
@@ -113,6 +114,7 @@ public class BaseAuthenticationSuccessEventHandler extends SavedRequestAwareAuth
 		sysUserLoginLog.setLoginTime(date);
 		sysUserLoginLog.setLoginIp(request.getRemoteAddr());
 		sysUserLoginLog.setUserId(sysUser.getId());
+		sysUserLoginLog.setTenantId(sysUser.getTenantId());
 		sysUserLoginLogService.insert(sysUserLoginLog);
 		
 		try {

+ 5 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/Student.java

@@ -84,7 +84,7 @@ public class Student extends SysUser {
 	private String parentName;
 
 	@ApiModelProperty(value = "备注")
-	private String remake;
+	private String remark;
 
 	@ApiModelProperty(value = "单位名称")
 	private String unitName;
@@ -326,12 +326,12 @@ public class Student extends SysUser {
 		this.parentName = parentName;
 	}
 
-	public String getRemake() {
-		return remake;
+	public String getRemark() {
+		return remark;
 	}
 
-	public void setRemake(String remake) {
-		this.remake = remake;
+	public void setRemark(String remark) {
+		this.remark = remark;
 	}
 
 	public String getUnitName() {

+ 3 - 3
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/StudentPreRegistration.java

@@ -43,7 +43,7 @@ public class StudentPreRegistration extends BaseStudentDto {
 	private String parentName;
 
 	/** 备注 */
-	private String remake;
+	private String remark;
 
 	/** 单位名称 */
 	private String unitName;
@@ -158,11 +158,11 @@ public class StudentPreRegistration extends BaseStudentDto {
 	}
 
 	public String getRemake() {
-		return remake;
+		return remark;
 	}
 
 	public void setRemake(String remake) {
-		this.remake = remake;
+		this.remark = remark;
 	}
 
 	public String getUnitName() {

+ 0 - 8
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysUserTsign.java

@@ -31,14 +31,6 @@ public class SysUserTsign extends BaseEntity {
 		// TODO Auto-generated constructor stub
 	}
 
-    public SysUserTsign(Integer userId, String accountId, String sealData, String name, String cardNo) {
-        this.userId = userId;
-        this.accountId = accountId;
-        this.sealData = sealData;
-        this.name = name;
-        this.cardNo = cardNo;
-    }
-
     public SysUserTsign(Integer userId, String accountId, String sealData, String name, String cardNo,Integer tenantId) {
         this.userId = userId;
         this.accountId = accountId;

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/CloudTeacherOrderQueryInfo.java

@@ -6,6 +6,7 @@ import com.ym.mec.common.page.QueryInfo;
 import org.joda.time.DateTime;
 
 import java.util.Date;
+import java.util.List;
 
 public class CloudTeacherOrderQueryInfo extends QueryInfo {
 
@@ -31,6 +32,9 @@ public class CloudTeacherOrderQueryInfo extends QueryInfo {
 	@ApiModelProperty(value = "开始时间")
 	private Date startTime;
 
+	@ApiModelProperty(value = "分部")
+	private String organIds;
+
 	public Date getStartTime() {
 		return startTime;
 	}
@@ -97,4 +101,12 @@ public class CloudTeacherOrderQueryInfo extends QueryInfo {
 	public void setMusicGroupId(String musicGroupId) {
 		this.musicGroupId = musicGroupId;
 	}
+
+	public String getOrganIds() {
+		return organIds;
+	}
+
+	public void setOrganIds(String organIds) {
+		this.organIds = organIds;
+	}
 }

+ 33 - 15
mec-biz/src/main/java/com/ym/mec/biz/service/PayService.java

@@ -1,26 +1,44 @@
 package com.ym.mec.biz.service;
 
-
 import java.math.BigDecimal;
 import java.util.Map;
 
+import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
+
 /**
  * 支付服务类
  */
 
 public interface PayService {
-    /**
-     *
-     * @param amount 支付金额
-     * @param orderNo 订单编号
-     * @param notifyUrl 回调地址
-     * @param returnUrl 返回地址
-     * @param orderSubject 订单主题
-     * @param orderBody 订单内容
-     * @param organId 分部编号
-     * @param receiver 指定接收
-     * @return
-     * @throws Exception
-     */
-    Map<String, Object> getPayMap(BigDecimal amount,BigDecimal balanceAmount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody,Integer organId,String receiver) throws Exception;
+	/**
+	*
+	* @param amount 支付金额
+	* @param orderNo 订单编号
+	* @param notifyUrl 回调地址
+	* @param returnUrl 返回地址
+	* @param orderSubject 订单主题
+	* @param orderBody 订单内容
+	* @param organId 分部编号
+	* @param receiver 指定接收
+	* @return
+	* @throws Exception
+	*/
+	Map<String, Object> getPayMap(BigDecimal amount, BigDecimal balanceAmount, String orderNo, String notifyUrl, String returnUrl, String orderSubject,
+			String orderBody, Integer organId, String receiver) throws Exception;
+
+	/**
+	 *
+	 * @param paymentChannel 支付渠道
+	 * @param payeeMerNo 收款商户号
+	 * @param amount 支付金额
+	 * @param orderNo 订单编号
+	 * @param notifyUrl 回调地址
+	 * @param returnUrl 返回地址
+	 * @param orderSubject 订单主题
+	 * @param orderBody 订单内容
+	 * @return
+	 * @throws Exception
+	 */
+	Map<String, Object> getPayToPlatformMap(PaymentChannelEnum paymentChannel, BigDecimal amount, BigDecimal balanceAmount, String orderNo,
+			String notifyUrl, String returnUrl, String orderSubject, String orderBody) throws Exception;
 }

+ 3 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java

@@ -213,16 +213,15 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
         int orderState = 0;
         //消费大于0元则拉起支付
         if (payAmount.compareTo(BigDecimal.ZERO) > 0) {
-            payMap = payService.getPayMap(
+            payMap = payService.getPayToPlatformMap(
+                    PaymentChannelEnum.ADAPAY,
                     payAmount,
                     BigDecimal.ZERO,
                     orderNo,
                     null,
                     null,
                     tenantEnum.getMsg(),
-                    tenantEnum.getMsg(),
-                    1,//临时写死
-                    tenantEnum.getCode()
+                    tenantEnum.getMsg()
             );
         } else { // 消费大于 0 元 已支付 直接激活
             orderState = 1;

+ 98 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -108,6 +108,12 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
     @Autowired
     private EmployeeDao employeeDao;
+    
+    @Autowired
+    private TenantInfoService tenantInfoService;
+    
+    @Autowired
+    private TenantConfigService tenantConfigService;
 
     @Value("${contract.baseDir:/var/pdf}")
     private String contractBaseDir;
@@ -198,7 +204,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
                 }
             }
 
-            sysUserTsign = new SysUserTsign(userId, accountId, sealData, realName, idCardNo);
+            sysUserTsign = new SysUserTsign(userId, accountId, sealData, realName, idCardNo, user.getTenantId());
 
             sysUserTsignService.insert(sysUserTsign);
 
@@ -905,6 +911,29 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
         if (!CollectionUtils.isEmpty(userContracts)) {
             return;
         }
+        
+		TenantInfo tenantInfo = tenantInfoService.get(studentInfo.getTenantId());
+		if(tenantInfo == null){
+			throw new BizException("机构信息不存在");
+		}
+		
+		TenantConfig tenantConfig = tenantConfigService.queryByTenantId(studentInfo.getTenantId());
+		if(tenantConfig == null){
+			throw new BizException("机构配置信息查询失败");
+		}
+		
+		params.put("compayName", tenantInfo.getName());
+		params.put("sealPicture", tenantConfig.getCorporateChops());
+        
+		if (studentInfo.getTenantId() == 1) {
+			if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
+				params.put("compayName", "深圳大雅乐盟网络教育股份有限公司");
+				params.put("sealPicture", "https://daya-online.oss-cn-beijing.aliyuncs.com/website/cachet.png");
+			} else {
+				params.put("compayName", "武汉长乐长风乐器销售有限公司");
+				params.put("sealPicture", "https://daya-online.oss-cn-beijing.aliyuncs.com/website/clcf.png");
+			}
+		}
 
         templateEngine.render(params, "product" + ownershipType.getContractVersion() + ".ftl", srcFile);
 
@@ -918,11 +947,16 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
 
         String organCode = "";
-        if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
-            organCode = "91440300326364429H";
-        } else {
-            organCode = "91420106333619290A";
-        }
+        
+		if (user.getTenantId() == 1) {
+			if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
+				organCode = "91440300326364429H";
+			} else {
+				organCode = "91420106333619290A";
+			}
+		} else {
+			organCode = tenantInfo.getTsignCode();
+		}
         SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
         if (organTsign == null) {
             logger.error("甲方未创建签章");
@@ -982,7 +1016,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
         Map<String, Object> result = new HashMap<>();
         result.put("courseViewType", CourseViewTypeEnum.COURSE_FEE);
         CourseViewTypeEnum ownershipType = CourseViewTypeEnum.COURSE_FEE;
-
+		
         if (StringUtils.isBlank(musicGroupId)) {
             params.put("ownershipType", "OWN");
             MusicGroup userLastNormalMusicGroup = studentRegistrationDao.getUserLastNormalMusicGroup(userId);
@@ -1003,6 +1037,29 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
         if (Objects.nonNull(courseViewType)) {
             ownershipType = courseViewType;
         }
+        
+		TenantInfo tenantInfo = tenantInfoService.get(studentInfo.getTenantId());
+		if(tenantInfo == null){
+			throw new BizException("机构信息不存在");
+		}
+		
+		TenantConfig tenantConfig = tenantConfigService.queryByTenantId(studentInfo.getTenantId());
+		if(tenantConfig == null){
+			throw new BizException("机构配置信息查询失败");
+		}
+		
+		params.put("compayName", tenantInfo.getName());
+		params.put("sealPicture", tenantConfig.getCorporateChops());
+        
+		if (studentInfo.getTenantId() == 1) {
+			if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
+				params.put("compayName", "深圳大雅乐盟网络教育股份有限公司");
+				params.put("sealPicture", "https://daya-online.oss-cn-beijing.aliyuncs.com/website/cachet.png");
+			} else {
+				params.put("compayName", "武汉长乐长风乐器销售有限公司");
+				params.put("sealPicture", "https://daya-online.oss-cn-beijing.aliyuncs.com/website/clcf.png");
+			}
+		}
 
         templateEngine.render(params, "product" + ownershipType.getContractVersion() + ".ftl", srcFile);
 
@@ -1074,6 +1131,29 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 
         CourseViewTypeEnum courseViewType = CourseViewTypeEnum.COURSE_FEE;
         params.put("ownershipType", "OWN");
+        
+		TenantInfo tenantInfo = tenantInfoService.get(studentInfo.getTenantId());
+		if(tenantInfo == null){
+			throw new BizException("机构信息不存在");
+		}
+		
+		TenantConfig tenantConfig = tenantConfigService.queryByTenantId(studentInfo.getTenantId());
+		if(tenantConfig == null){
+			throw new BizException("机构配置信息查询失败");
+		}
+		
+		params.put("compayName", tenantInfo.getName());
+		params.put("sealPicture", tenantConfig.getCorporateChops());
+        
+		if (studentInfo.getTenantId() == 1) {
+			if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
+				params.put("compayName", "深圳大雅乐盟网络教育股份有限公司");
+				params.put("sealPicture", "https://daya-online.oss-cn-beijing.aliyuncs.com/website/cachet.png");
+			} else {
+				params.put("compayName", "武汉长乐长风乐器销售有限公司");
+				params.put("sealPicture", "https://daya-online.oss-cn-beijing.aliyuncs.com/website/clcf.png");
+			}
+		}
 
         List<SysUserContracts> userContracts = sysUserContractsService.getUserContractWithType(userId, ContractType.PRODUCT, 2);
         if (!CollectionUtils.isEmpty(userContracts)) {
@@ -1090,7 +1170,17 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
             return BaseController.failed("生成产品协议失败");
         }
 
-        String organCode = "91440300326364429H";
+        String organCode = "";
+        
+		if (user.getTenantId() == 1) {
+			if (OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
+				organCode = "91440300326364429H";
+			} else {
+				organCode = "91420106333619290A";
+			}
+		} else {
+			organCode = tenantInfo.getTsignCode();
+		}
 
         SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
         if (organTsign == null) {

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

@@ -145,7 +145,7 @@ public class IndexBaseMonthDataServiceImpl extends BaseServiceImpl<Long, IndexBa
 
 		Map<IndexDataType, List<IndexBaseMonthData>> typeDateMap = indexBaseDatas.stream().filter(d->Objects.nonNull(d.getDataType())).collect(Collectors.groupingBy(IndexBaseMonthData::getDataType));
 
-		if(CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(FINANCE_PAY.getCode())||dataTypes.contains(FINANCE_BALANCE_AMOUNT.getCode())||dataTypes.contains(FINANCE_AMOUNT.getCode())){
+		if(CollectionUtils.isEmpty(dataTypes)||dataTypes.contains(FINANCE_PAY.getCode())||dataTypes.contains(FINANCE_BALANCE_AMOUNT.getCode())||dataTypes.contains(FINANCE_AMOUNT.getCode()) && organIds != null){
 			List<IndexBaseMonthData> financePayDataWithTimely = indexBaseMonthDataDao.getFinancePayDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId());
 			typeDateMap.put(IndexDataType.FINANCE_PAY,financePayDataWithTimely);
 			typeDateMap.put(IndexDataType.FINANCE_BALANCE_AMOUNT,indexBaseMonthDataDao.getFinanceBalanceDataWithTimely(startDate.toString(), endDate.toString(), new ArrayList<>(organIds),queryInfo.getTenantId()));

+ 98 - 35
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrderPayOpsServiceImpl.java

@@ -1,13 +1,48 @@
 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.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;
@@ -15,23 +50,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.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
@@ -53,6 +71,12 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
     private CloudTeacherOrderService cloudTeacherOrderService;
     @Autowired
     private TenantConfigService tenantConfigService;
+    
+    @Autowired
+    private SysConfigService sysConfigService;
+    
+    @Autowired
+    private SysPaymentConfigService sysPaymentConfigService;
 
     //支付类型
     private static final Map<String, Function<PaymentParam, Map<String, Object>>> checkOrderType = new HashMap<>();
@@ -80,12 +104,15 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
         checkSing(payParam);
 
         Map<String, Object> payment = new HashMap<>();
-        if (platform != null) {
+        if (StringUtils.isBlank(platform)) {
             //根据传入platform 来判断执行哪个操作
             Function<PaymentParam, Map<String, Object>> function = checkOrderType.get(platform);
             //如果以上操作都没有 则应该是这一个,因为老代码就是这样写的。
             if (Objects.isNull(function)) {
                 StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findOrderByOrderNo(payParam.getOrderNo());
+                if (Objects.isNull(studentPaymentOrder)) {
+                    throw new BizException("订单不存在");
+                }
                 payParam.setTenantId(studentPaymentOrder.getTenantId());
                 payment = checkOrderAndGetParam(payParam,
                         studentPaymentOrder,
@@ -105,6 +132,9 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
     private Map<String, Object> teacher(PaymentParam payParam) {
         Map<String, Object> payment;
         TenantPaymentOrder tenantPaymentOrder = tenantPaymentOrderService.queryByOrderNo(payParam.getOrderNo());
+        if (Objects.isNull(tenantPaymentOrder)) {
+            throw new BizException("订单不存在");
+        }
         payParam.setTenantId(1);
         try {
             payment = checkOrderAndGetParam(payParam,
@@ -151,8 +181,12 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
 
     //查询订单
     private TenantOrderRecord getTenantOrderRecord(String orderNo) {
-        return tenantOrderRecordService.getOne(new WrapperUtil<TenantOrderRecord>()
+        TenantOrderRecord orderRecord = tenantOrderRecordService.getOne(new WrapperUtil<TenantOrderRecord>()
                 .hasEq("order_no_", orderNo).queryWrapper());
+        if (Objects.isNull(orderRecord)) {
+            throw new BizException("订单不存在");
+        }
+        return orderRecord;
     }
 
     //获取支付数据
@@ -295,28 +329,57 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
                 StudentPaymentOrder st = (StudentPaymentOrder) clazz;
                 merNos = st.getMerNos();
                 amount = amountTo.apply(st.getActualAmount());
-            } else if (clazz instanceof TenantOrderRecord) {
+		        
+				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();
-                amount = amountTo.apply(tor.getActualAmount());
-            } 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) {
-				List<Map<String, Object>> divMemberList = new ArrayList<>();
+                
+                List<Map<String, Object>> divMemberList = new ArrayList<>();
 				Map<String, Object> divMember = new HashMap<>();
 				divMember.put("member_id", merNos);
-				divMember.put("amount", amount);
+				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());
+            }
         }
 
         //手续费收取模式:O-商户手续费账户扣取手续费,I-交易金额中扣取手续费;值为空时,默认值为I;若为O时,分账对象列表中不支持传入手续费承担方

+ 107 - 14
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java

@@ -1,31 +1,44 @@
 package com.ym.mec.biz.service.impl;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
 import com.alibaba.fastjson.JSON;
 import com.ym.mec.biz.dal.dao.HfMemberDao;
 import com.ym.mec.biz.dal.dao.StudentPaymentRouteOrderDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.AmountChannelDto;
 import com.ym.mec.biz.dal.dto.RouteScaleDto;
-import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.entity.HfMember;
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
+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.PaymentChannelEnum;
-import com.ym.mec.biz.service.*;
+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.SysPaymentConfigService;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.redis.service.RedisCache;
 import com.ym.mec.thirdparty.adapay.ConfigInit;
 import com.ym.mec.thirdparty.adapay.Payment;
 import com.ym.mec.thirdparty.yqpay.YqPayUtil;
 import com.ym.mec.util.date.DateUtil;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.core.ValueOperations;
-import org.springframework.stereotype.Service;
-
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
 
 /**
  * 支付服务类
@@ -49,6 +62,52 @@ public class PayServiceImpl implements PayService {
 
     @Override
     public Map<String, Object> getPayMap(BigDecimal amount, BigDecimal balanceAmount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, Integer organId, String receiver) throws Exception {
+
+        StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findOrderByOrderNo(orderNo);
+        
+        if(studentPaymentOrder == null){
+        	throw new BizException("订单[{}]查询失败", orderNo);
+        }
+        
+        Integer tenantId = studentPaymentOrder.getTenantId();
+        
+        if(tenantId != 1){//非大雅机构
+        	
+        	SysPaymentConfig sysPaymentConfig = sysPaymentConfigService.findPaymentConfigByOrganId(organId);
+        	
+        	if(sysPaymentConfig == null || StringUtils.isBlank(sysPaymentConfig.getHfMerNo())){
+        		throw new BizException("分部[{}]没有设置收款账号", organId);
+        	}
+        	
+        	Date date = new Date();
+        	
+        	String merNo = sysPaymentConfig.getHfMerNo();
+        	
+        	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;
         //使用配置开关
@@ -82,7 +141,41 @@ public class PayServiceImpl implements PayService {
         return getPayRoute(amount, balanceAmount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routeScaleDtos);
     }
 
-    private List<RouteScaleDto> noUsePaymentConfig(BigDecimal amount) {
+    @Override
+	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");
+        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 payeeMerNo = sysPaymentConfig.getHfMerNo();
+    	
+        Map<String, Object> payMap = null;
+        
+    	if (paymentChannel.equals(PaymentChannelEnum.YQPAY)) {
+            payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, YqPayUtil.merNo, payeeMerNo);
+        } else {
+            payMap = Payment.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody);
+        }
+        
+        Map<String, Object> unionPay = new HashMap<>();
+        unionPay.put("orderNo", orderNo);
+        unionPay.put("type", paymentChannel.getCode());
+        unionPay.put("payMap", payMap);
+        unionPay.put("routingMerNos", payeeMerNo);
+        
+		return unionPay;
+	}
+
+	private List<RouteScaleDto> noUsePaymentConfig(BigDecimal amount) {
         String paymentChannel = sysConfigDao.findConfigValue("payment_channel");
         List<RouteScaleDto> routeScaleDtos = new ArrayList<>();
         RouteScaleDto routeScaleDto = new RouteScaleDto();
@@ -399,7 +492,7 @@ public class PayServiceImpl implements PayService {
             }
             payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, YqPayUtil.merNo, tempRoutingList);
         } else {
-            payMap = Payment.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, ConfigInit.merNo, tempRoutingList);
+            payMap = Payment.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody);
         }
         String routingMerNos = String.join(",", routingMerNoSet);
 

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

@@ -234,6 +234,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         if (couponIdList != null && couponIdList.size() > 0) {
             studentGoodsSell.setCouponIds(StringUtils.join(couponIdList, ","));
         }
+        studentGoodsSell.setTenantId(student.getTenantId());
         studentGoodsSellDao.insert(studentGoodsSell);
 
         if (studentGoodsSell.getType() == 1) {
@@ -249,6 +250,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentPaymentOrder.setStatus(DealStatusEnum.ING);
         studentPaymentOrder.setOrganId(student.getOrganId());
         studentPaymentOrder.setRoutingOrganId(student.getOrganId());
+        studentPaymentOrder.setTenantId(student.getTenantId());
         studentPaymentOrderService.insert(studentPaymentOrder);
 
         studentPaymentOrder.setVersion(0);
@@ -367,6 +369,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentPaymentOrder.setStatus(DealStatusEnum.ING);
         studentPaymentOrder.setOrganId(studentGoodsSell.getOrganId());
         studentPaymentOrder.setRoutingOrganId(studentGoodsSell.getOrganId());
+        studentPaymentOrder.setTenantId(studentGoodsSell.getTenantId());
         studentPaymentOrderService.insert(studentPaymentOrder);
 
         studentPaymentOrder.setVersion(0);

+ 17 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -147,14 +147,28 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
         		throw new BizException("您已注册,请直接下载APP!");
         	}
         	userId = user.getId();
-        	user.setOrganId(studentPreRegistration.getOrganId());
+            if (studentPreRegistration.getOrganId() != null) {
+                user.setOrganId(studentPreRegistration.getOrganId());
+            }
+            if (studentPreRegistration.getParentName() != null) {
+                user.setRealName(studentPreRegistration.getParentName());
+            }
+            if (studentPreRegistration.getUserName() != null) {
+                user.setUsername(studentPreRegistration.getUserName());
+            }
+            if (user.getUserType() == null) {
+                user.setUserType("STUDENT");
+            } else if (!user.getUserType().contains("STUDENT")) {
+                user.setUserType(user.getUserType() + ",STUDENT");
+            }
             user.setUpdateTime(date);
             teacherDao.updateUser(user);
         }else{
         	user = new SysUser();
             user.setPhone(studentPreRegistration.getPhone());
-            user.setUsername(studentPreRegistration.getUserName());
             user.setOrganId(studentPreRegistration.getOrganId());
+            user.setRealName(studentPreRegistration.getParentName());
+            user.setUsername(studentPreRegistration.getUserName());
             user.setUserType("STUDENT");
             user.setCreateTime(date);
             user.setUpdateTime(date);
@@ -173,9 +187,7 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
         student.setSchoolName(studentPreRegistration.getSchool());
         student.setCurrentGradeNum(studentPreRegistration.getCurrentGradeNum());
         student.setCurrentClass(studentPreRegistration.getCurrentClass());
-        student.setOrganId(studentPreRegistration.getOrganId());
-        student.setParentName(studentPreRegistration.getParentName());
-        student.setRemake(studentPreRegistration.getRemake());
+        student.setRemark(studentPreRegistration.getRemake());
         student.setUnitName(studentPreRegistration.getUnitName());
         studentDao.insert(student);
         TenantContextHolder.clearTenantId();

+ 10 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java

@@ -349,7 +349,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         Lists.partition(collectMenuId, 50)
                 .forEach(idList -> employeeService.batchInsertRoleMenu(roleId, idList, tenantId));
         //添加签章信息
-        contractService.addTsign(tenantInfo.getUserId(),tenantInfo.getTsignCode(), tenantInfo.getTsignName(), tenantId);
+        contractService.addTsign(tenantInfo.getUserId(), tenantInfo.getTsignCode(), tenantInfo.getTsignName(), tenantId);
 
         Date now = new Date();
 
@@ -476,16 +476,15 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         int orderState = 0;
         //消费大于0元则拉起支付
         if (productInfo.getPayAmount().compareTo(BigDecimal.ZERO) > 0) {
-            result = payService.getPayMap(
+            result = payService.getPayToPlatformMap(
+                    PaymentChannelEnum.ADAPAY,
                     productInfo.getPayAmount(),
                     BigDecimal.ZERO,
                     orderNo,
                     null,
                     null,
                     tenantEnum.getMsg(),
-                    tenantEnum.getMsg(),
-                    config.getParanValue(Integer.class),
-                    tenantEnum.getCode()
+                    tenantEnum.getMsg()
             );
         } else {
             //已支付
@@ -524,16 +523,15 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         int orderState = 0;
         //消费大于0元则拉起支付
         if (amount.compareTo(BigDecimal.ZERO) > 0) {
-            result = payService.getPayMap(
+            result = payService.getPayToPlatformMap(
+                    PaymentChannelEnum.ADAPAY,
                     amount,
                     BigDecimal.ZERO,
                     orderNo,
                     null,
                     null,
                     tenantEnum.getMsg(),
-                    tenantEnum.getMsg(),
-                    config.getParanValue(Integer.class),
-                    tenantEnum.getCode()
+                    tenantEnum.getMsg()
             );
             //操作续费信息,把续费周期存起来
             opsRenewInfo(tenantId).set(val, 1, TimeUnit.HOURS);
@@ -739,16 +737,15 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         int orderState = 0;
         //消费大于0元则拉起支付
         if (amount.compareTo(BigDecimal.ZERO) > 0) {
-            result = payService.getPayMap(
+            result = payService.getPayToPlatformMap(
+                    PaymentChannelEnum.ADAPAY,
                     amount,
                     BigDecimal.ZERO,
                     orderNo,
                     null,
                     null,
                     tenantEnum.getMsg(),
-                    tenantEnum.getMsg(),
-                    config.getParanValue(Integer.class),
-                    tenantEnum.getCode()
+                    tenantEnum.getMsg()
             );
         } else {
             orderState = 1;

+ 9 - 21
mec-biz/src/main/resources/config/contracts/product2.ftl

@@ -87,13 +87,13 @@
 <body style="font-family:'SimSun'">
 <div class="container">
     <h1>《产品与服务协议》</h1>
-    <!-- 甲方:深圳大雅乐盟网络教育股份有限公司 <br/> -->
-    <#if ownershipType == 'OWN'>
+        甲方:${compayName}<br/>
+    <!-- <#if ownershipType == 'OWN'>
         甲方:深圳大雅乐盟网络教育股份有限公司
     <#else>
         甲方:武汉长乐长风乐器销售有限公司
     </#if>
-    <br/>
+    <br/> -->
     <div style="display: flex;">乙方:
         <div style="flex: 1 auto;">
             <div class="iInfo">
@@ -181,28 +181,16 @@
 
     <div class="signature">
         <#if isShowVisualSeal>
-            <#if ownershipType == 'OWN'>
-                <div class="sign">甲方签章:深圳大雅乐盟网络教育股份有限公司<img class="cachet" src="https://daya-online.oss-cn-beijing.aliyuncs.com/website/cachet.png" alt="" />
-                    <span>日期:${.now?string("yyyy年MM月dd日")}</span>
-                </div>
-            <#else>
-                <div class="sign">甲方签章:武汉长乐长风乐器销售有限公司<img class="cachet" src="https://daya-online.oss-cn-beijing.aliyuncs.com/website/clcf.png" alt="" />
-                    <span>日期:${.now?string("yyyy年MM月dd日")}</span>
-                </div>
-            </#if>
+            <div class="sign">甲方签章:${compayName}<img class="cachet" src="${sealPicture!}" alt="" />
+                <span>日期:${.now?string("yyyy年MM月dd日")}</span>
+            </div>
             <div class="sign">乙方签章:${studentInfo.realName!}
                 <span>日期:${.now?string("yyyy年MM月dd日")} </span>
             </div>
         <#else>
-            <#if ownershipType == 'OWN'>
-                <div class="sign">甲方签章:深圳大雅乐盟网络教育股份有限公司
-                    <span>日期:${.now?string("yyyy年MM月dd日")}</span>
-                </div>
-            <#else>
-                <div class="sign">甲方签章:武汉长乐长风乐器销售有限公司
-                    <span>日期:${.now?string("yyyy年MM月dd日")}</span>
-                </div>
-            </#if>
+            <div class="sign">甲方签章:${compayName}
+                <span>日期:${.now?string("yyyy年MM月dd日")}</span>
+            </div>
             <div class="sign">乙方签章:
                 <span>日期:${.now?string("yyyy年MM月dd日")} </span>
             </div>

+ 5 - 17
mec-biz/src/main/resources/config/contracts/product3.ftl

@@ -83,13 +83,13 @@
 <body style="font-family:'SimSun'">
     <div class="container">
         <h1>《产品与服务协议》</h1>
-        <!-- 甲方:深圳大雅乐盟网络教育股份有限公司 <br/> -->
-        <#if ownershipType == 'OWN'>
+                            甲方:${compayName} <br/>
+        <!-- <#if ownershipType == 'OWN'>
 		甲方:深圳大雅乐盟网络教育股份有限公司
 		<#else>
 		甲方:武汉长乐长风乐器销售有限公司
 		</#if>
-		<br/>
+		<br/> -->
         <div style="display: flex;">乙方:
             <div style="flex: 1 auto;">
                 <div class="iInfo">
@@ -177,28 +177,16 @@
 
         <div class="signature">
         	<#if isShowVisualSeal>
-        	<#if ownershipType == 'OWN'>
-            <div class="sign">甲方签章:深圳大雅乐盟网络教育股份有限公司<img class="cachet" src="https://daya-online.oss-cn-beijing.aliyuncs.com/website/cachet.png" alt="" />
+            <div class="sign">甲方签章:${compayName}<img class="cachet" src="${sealPicture!}" alt="" />
                 <span>日期:${.now?string("yyyy年MM月dd日")}</span>
             </div>
-            <#else>
-            <div class="sign">甲方签章:武汉长乐长风乐器销售有限公司<img class="cachet" src="https://daya-online.oss-cn-beijing.aliyuncs.com/website/clcf.png" alt="" />
-                <span>日期:${.now?string("yyyy年MM月dd日")}</span>
-            </div>
-            </#if>
             <div class="sign">乙方签章:${studentInfo.realName!}
                 <span>日期:${.now?string("yyyy年MM月dd日")} </span>
             </div>
         	<#else>
-        	<#if ownershipType == 'OWN'>
-            <div class="sign">甲方签章:深圳大雅乐盟网络教育股份有限公司
-                <span>日期:${.now?string("yyyy年MM月dd日")}</span>
-            </div>
-            <#else>
-            <div class="sign">甲方签章:武汉长乐长风乐器销售有限公司
+            <div class="sign">甲方签章:${compayName}
                 <span>日期:${.now?string("yyyy年MM月dd日")}</span>
             </div>
-            </#if>
             <div class="sign">乙方签章:
                 <span>日期:${.now?string("yyyy年MM月dd日")} </span>
             </div>

+ 5 - 17
mec-biz/src/main/resources/config/contracts/product4.ftl

@@ -83,13 +83,13 @@
 <body style="font-family:'SimSun'">
     <div class="container">
         <h1>《产品与服务协议》</h1>
-        <!-- 甲方:深圳大雅乐盟网络教育股份有限公司 <br/> -->
-        <#if ownershipType == 'OWN'>
+                            甲方:${compayName} <br/>
+        <!-- <#if ownershipType == 'OWN'>
 		甲方:深圳大雅乐盟网络教育股份有限公司
 		<#else>
 		甲方:武汉长乐长风乐器销售有限公司
 		</#if>
-		<br/>
+		<br/> -->
         <div style="display: flex;">乙方:
             <div style="flex: 1 auto;">
                 <div class="iInfo">
@@ -179,28 +179,16 @@
 
         <div class="signature">
         	<#if isShowVisualSeal>
-        	<#if ownershipType == 'OWN'>
-            <div class="sign">甲方签章:深圳大雅乐盟网络教育股份有限公司<img class="cachet" src="https://daya-online.oss-cn-beijing.aliyuncs.com/website/cachet.png" alt="" />
+            <div class="sign">甲方签章:${compayName}<img class="cachet" src="${sealPicture!}" alt="" />
                 <span>日期:${.now?string("yyyy年MM月dd日")}</span>
             </div>
-            <#else>
-            <div class="sign">甲方签章:武汉长乐长风乐器销售有限公司<img class="cachet" src="https://daya-online.oss-cn-beijing.aliyuncs.com/website/clcf.png" alt="" />
-                <span>日期:${.now?string("yyyy年MM月dd日")}</span>
-            </div>
-            </#if>
             <div class="sign">乙方签章:${studentInfo.realName!}
                 <span>日期:${.now?string("yyyy年MM月dd日")} </span>
             </div>
         	<#else>
-        	<#if ownershipType == 'OWN'>
-            <div class="sign">甲方签章:深圳大雅乐盟网络教育股份有限公司
-                <span>日期:${.now?string("yyyy年MM月dd日")}</span>
-            </div>
-            <#else>
-            <div class="sign">甲方签章:武汉长乐长风乐器销售有限公司
+            <div class="sign">甲方签章:${compayName}
                 <span>日期:${.now?string("yyyy年MM月dd日")}</span>
             </div>
-            </#if>
             <div class="sign">乙方签章:
                 <span>日期:${.now?string("yyyy年MM月dd日")} </span>
             </div>

+ 12 - 11
mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml

@@ -63,15 +63,6 @@
         VALUES (#{organId},#{studentId}, #{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{level}, #{time}, #{amount}, #{refundAmount},
         #{status},#{orderId},#{platformOrderId},#{startTime},#{endTime}, #{remark}, NOW(), NOW(),#{musicGroupId},#{activeRemark},#{tenantId})
     </insert>
-    <insert id="batchInsert">
-        INSERT INTO cloud_teacher_order (organ_id_,student_id_, type_, level_, time_, amount_,status_,
-        remark_,create_time_, update_time_,tenant_id_)
-        VALUES
-        <foreach collection="userIds" item="userId" separator=",">
-            (#{bean.organId},#{userId},#{bean.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{bean.level},
-             #{bean.time}, #{bean.amount},#{bean.status},#{bean.remark},NOW(),NOW(),#{bean.tenantId})
-        </foreach>
-    </insert>
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.CloudTeacherOrder">
         <!--@mbg.generated-->
         update cloud_teacher_order
@@ -349,9 +340,14 @@
         left join student s on cto.student_id_ = s.user_id_
         left join sys_user u on cto.student_id_ = u.id_
         left join subject sj on s.subject_id_list_ = sj.id_
-        left join student_registration sr ON cto.student_id_ = sr.user_id_
+        <if test="musicGroupId != null and musicGroupId != ''">
+            left join student_registration sr ON cto.student_id_ = sr.user_id_
+        </if>
         <where>
             cto.status_ = #{status} AND cto.tenant_id_ = #{tenantId}
+            <if test="organIds != null and organIds != ''">
+                AND FIND_IN_SET(u.organ_id_ , #{organIds})
+            </if>
             <if test="musicGroupId != null and musicGroupId != ''">
             	AND sr.music_group_id_ = #{musicGroupId}
             </if>
@@ -370,9 +366,14 @@
         left join student s on cto.student_id_ = s.user_id_
         left join sys_user u on cto.student_id_ = u.id_
         left join subject sj on s.subject_id_list_ = sj.id_
-        left join student_registration sr ON cto.student_id_ = sr.user_id_
+        <if test="musicGroupId != null and musicGroupId != ''">
+            left join student_registration sr ON cto.student_id_ = sr.user_id_
+        </if>
         <where>
             cto.status_ = #{status} AND cto.tenant_id_ = #{tenantId}
+            <if test="organIds != null and organIds != ''">
+                AND FIND_IN_SET(u.organ_id_ , #{organIds})
+            </if>
             <if test="musicGroupId != null and musicGroupId != ''">
             	AND sr.music_group_id_ = #{musicGroupId}
             </if>

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

@@ -306,7 +306,7 @@
 	</select>
 
 	<select id="getWithOrganMonthUserStr" resultMap="IndexErrDataRecord">
-		SELECT * FROM index_err_data_record WHERE tenant_id_ = #{tenantId} and CONCAT(generate_time_, organ_id_, deal_user_id_) IN
+		SELECT * FROM index_err_data_record WHERE CONCAT(generate_time_, organ_id_, deal_user_id_) IN
 		<foreach collection="omuStrings" item="omuString" open="(" close=")" separator=",">
 			#{omuString}
 		</foreach>

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

@@ -87,7 +87,7 @@
             operating_tag_,
         </if>
         teacher_id_,create_time_,update_time_,service_tag_update_time_,cooperation_organ_id_,
-        care_package_,come_on_package_,member_rank_setting_id_,membership_start_time_,membership_end_time_,current_grade_num_,current_class_,tenant_id_)
+        care_package_,come_on_package_,member_rank_setting_id_,membership_start_time_,membership_end_time_,current_grade_num_,current_class_,tenant_id_,remark_,unit_name_)
         VALUES
         (#{userId},#{schoolName},#{subjectIdList},
         <if test="serviceTag != null">
@@ -97,7 +97,7 @@
             #{operatingTag},
         </if>
         #{teacherId},NOW(),NOW(),NOW(),#{cooperationOrganId},
-         #{carePackage},#{comeOnPackage},#{memberRankSettingId},#{membershipStartTime},#{membershipEndTime},#{currentGradeNum},#{currentClass},#{tenantId})
+         #{carePackage},#{comeOnPackage},#{memberRankSettingId},#{membershipStartTime},#{membershipEndTime},#{currentGradeNum},#{currentClass},#{tenantId},#{remark}, #{unitName})
     </insert>
 
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.Student">

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

@@ -73,6 +73,7 @@
         <result column="organ_id_" property="organId"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
+        <result column="tenant_id_" property="tenantId"/>
         <result column="lock_flag_" property="lockFlag"/>
         <result column="del_flag_" property="delFlag" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="wx_openid_" property="wxOpenid"/>

+ 1 - 1
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/Payment.java

@@ -144,7 +144,7 @@ public class Payment {
     }
 
 
-    public static Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody, String sellerNo, List<Map<String, Object>> tempRoutingList) throws Exception {
+    public static Map<String, Object> getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody) throws Exception {
         Map<String, Object> paymentParams = new LinkedHashMap<>();
         paymentParams.put("appId", ConfigInit.appId);
         paymentParams.put("amount", amount.setScale(2, BigDecimal.ROUND_HALF_UP));

+ 9 - 4
mec-web/src/main/java/com/ym/mec/web/controller/CloudTeacherOrderController.java

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.page.CloudTeacherAddQueryInfo;
 import com.ym.mec.biz.dal.page.CloudTeacherOrderQueryInfo;
 import com.ym.mec.biz.service.CloudTeacherOrderService;
 import com.ym.mec.biz.service.OrderPayOpsService;
+import com.ym.mec.biz.service.OrganizationService;
 import com.ym.mec.biz.service.TenantOrderRecordService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
@@ -21,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
@@ -41,6 +43,9 @@ public class CloudTeacherOrderController extends BaseController {
     @Autowired
     private TenantOrderRecordService tenantOrderRecordService;
 
+    @Autowired
+    private OrganizationService organizationService;
+
     @ApiOperation(value = "手动添加会员")
     @PostMapping("/addStudents")
     @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/addStudents')")
@@ -52,11 +57,11 @@ public class CloudTeacherOrderController extends BaseController {
     @PostMapping("/queryInactive")
     @PreAuthorize("@pcs.hasPermissions('cloudTeacherOrder/queryInActive')")
     public HttpResponseResult<PageInfo<CloudTeacherStudent>> queryInactive(@RequestBody CloudTeacherOrderQueryInfo cloudTeacherOrderQueryInfo) throws Exception {
+        Integer tenantId = TenantContextHolder.getTenantId();
+        cloudTeacherOrderQueryInfo.setTenantId(tenantId);
+        String organIds = organizationService.getEmployeeOrgan("");
         cloudTeacherOrderQueryInfo.setStatus(1);
-        // 去掉按乐团查询, 不同乐团学生有重复
-        // if (cloudTeacherOrderQueryInfo.getMusicGroupId() == null) {
-        //     throw new Exception("乐团Id必须填写");
-        // }
+        cloudTeacherOrderQueryInfo.setOrganIds(organIds); // 1,2,34,
         return succeed(cloudTeacherOrderService.queryInactive(cloudTeacherOrderQueryInfo));
     }
 

+ 8 - 8
mec-web/src/main/resources/bootstrap-dev.properties

@@ -1,16 +1,16 @@
-#\u6307\u5b9a\u5f00\u53d1\u73af\u5883
+#\u6307\u5B9A\u5F00\u53D1\u73AF\u5883
 #spring.profiles.active=dev
-#\u670d\u52a1\u5668\u5730\u5740
+#\u670D\u52A1\u5668\u5730\u5740
 spring.cloud.nacos.config.server-addr=47.114.1.200:8848
-#\u9ed8\u8ba4\u4e3aPublic\u547d\u540d\u7a7a\u95f4,\u53ef\u4ee5\u7701\u7565\u4e0d\u5199
+#\u9ED8\u8BA4\u4E3APublic\u547D\u540D\u7A7A\u95F4,\u53EF\u4EE5\u7701\u7565\u4E0D\u5199
 spring.cloud.nacos.config.namespace=a5c10b43-0c4d-4e3b-a0ad-9af651cfe89c
-#\u6307\u5b9a\u914d\u7f6e\u7fa4\u7ec4 --\u5982\u679c\u662fPublic\u547d\u540d\u7a7a\u95f4 \u5219\u53ef\u4ee5\u7701\u7565\u7fa4\u7ec4\u914d\u7f6e
+#\u6307\u5B9A\u914D\u7F6E\u7FA4\u7EC4 --\u5982\u679C\u662FPublic\u547D\u540D\u7A7A\u95F4 \u5219\u53EF\u4EE5\u7701\u7565\u7FA4\u7EC4\u914D\u7F6E
 spring.cloud.nacos.config.group=DEFAULT_GROUP
-#\u6587\u4ef6\u540d -- \u5982\u679c\u6ca1\u6709\u914d\u7f6e\u5219\u9ed8\u8ba4\u4e3a ${spring.appliction.name}
+#\u6587\u4EF6\u540D -- \u5982\u679C\u6CA1\u6709\u914D\u7F6E\u5219\u9ED8\u8BA4\u4E3A ${spring.appliction.name}
 spring.cloud.nacos.config.prefix=web
-#\u6307\u5b9a\u6587\u4ef6\u540e\u7f00
+#\u6307\u5B9A\u6587\u4EF6\u540E\u7F00
 spring.cloud.nacos.config.file-extension=yaml
-#\u662f\u5426\u52a8\u6001\u5237\u65b0
+#\u662F\u5426\u52A8\u6001\u5237\u65B0
 spring.cloud.nacos.config.refresh.enabled=true
-#\u662f\u5426\u542f\u7528nacos\u914d\u7f6e\u4e2d\u5fc3
+#\u662F\u5426\u542F\u7528nacos\u914D\u7F6E\u4E2D\u5FC3
 spring.cloud.nacos.config.enabled=true