Procházet zdrojové kódy

Merge branch 'saas' of http://git.dayaedu.com/yonge/mec into zx_saas_export_0814

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java
zouxuan před 11 měsíci
rodič
revize
efee439983
78 změnil soubory, kde provedl 1675 přidání a 1226 odebrání
  1. 3 5
      mec-application/src/main/java/com/ym/mec/AppServerApplication.java
  2. 16 3
      mec-application/src/main/java/com/ym/mec/student/controller/MusicSheetController.java
  3. 17 27
      mec-application/src/main/java/com/ym/mec/student/controller/RepairController.java
  4. 21 52
      mec-application/src/main/java/com/ym/mec/student/controller/ReplacementInstrumentActivityController.java
  5. 91 69
      mec-application/src/main/java/com/ym/mec/student/controller/StudentOrderController.java
  6. 6 11
      mec-application/src/main/java/com/ym/mec/student/controller/SubjectChangeController.java
  7. 12 20
      mec-application/src/main/java/com/ym/mec/teacher/controller/EduRepairController.java
  8. 16 0
      mec-application/src/main/java/com/ym/mec/teacher/controller/MusicSheetController.java
  9. 3 7
      mec-application/src/main/java/com/ym/mec/teacher/controller/TeacherOrderController.java
  10. 3 3
      mec-application/src/main/java/com/ym/mec/web/controller/APIController.java
  11. 18 0
      mec-application/src/main/java/com/ym/mec/web/controller/MusicSheetController.java
  12. 6 6
      mec-application/src/main/java/com/ym/mec/web/controller/StudentPaymentOrderController.java
  13. 5 11
      mec-application/src/main/java/com/ym/mec/web/controller/TenantInfoController.java
  14. 14 16
      mec-application/src/main/java/com/ym/mec/web/controller/education/EduRepairController.java
  15. 7 8
      mec-application/src/main/java/com/ym/mec/web/controller/payment/AdapayController.java
  16. 30 21
      mec-application/src/main/java/com/ym/mec/web/controller/payment/YeepayController.java
  17. 1 0
      mec-application/src/main/resources/bootstrap-dev.properties
  18. 2 1
      mec-application/src/main/resources/bootstrap-test.properties
  19. 16 15
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserController.java
  20. 1 1
      mec-auth/pom.xml
  21. 20 10
      mec-biz/pom.xml
  22. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/FivePlusGradeEnum.java
  23. 30 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/wrapper/MusicSheetWrapper.java
  24. 0 2
      mec-biz/src/main/java/com/ym/mec/biz/service/ActivityUserMapperService.java
  25. 8 0
      mec-biz/src/main/java/com/ym/mec/biz/service/HfMemberService.java
  26. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/ReplacementInstrumentActivityService.java
  27. 9 11
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderService.java
  28. 3 2
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRepairService.java
  29. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/SubjectChangeService.java
  30. 6 0
      mec-biz/src/main/java/com/ym/mec/biz/service/SysMusicScoreService.java
  31. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/TenantOrderRecordService.java
  32. 5 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ChildrenDayReserveServiceImpl.java
  33. 3 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ClassGroupServiceImpl.java
  34. 52 90
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java
  35. 5 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java
  36. 233 43
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/HfMemberServiceImpl.java
  37. 89 13
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/HfMerchantConfigServiceImpl.java
  38. 66 49
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java
  39. 62 52
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrderPayOpsServiceImpl.java
  40. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrganizationServiceImpl.java
  41. 25 46
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java
  42. 47 43
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java
  43. 17 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentActivityServiceImpl.java
  44. 4 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SchoolStaffServiceImpl.java
  45. 305 144
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java
  46. 31 27
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  47. 44 32
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java
  48. 22 15
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectChangeServiceImpl.java
  49. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SubjectServiceImpl.java
  50. 34 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreServiceImpl.java
  51. 6 15
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherServiceImpl.java
  52. 7 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantInfoServiceImpl.java
  53. 75 85
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java
  54. 17 49
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantPaymentOrderServiceImpl.java
  55. 0 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupActivityServiceImpl.java
  56. 2 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  57. 7 2
      mec-biz/src/main/resources/config/mybatis/HfMerchantConfigMapper.xml
  58. 2 2
      mec-biz/src/main/resources/config/mybatis/MusicGroupPaymentEntitiesMapper.xml
  59. 15 17
      mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml
  60. 5 5
      mec-common/audit-log/src/main/java/com/yonge/log/interceptor/AuditLogInterceptor.java
  61. 21 0
      mec-common/common-core/src/main/java/com/ym/mec/common/dto/RealnameAuthenticationDto.java
  62. 1 1
      mec-mall/mall-common/pom.xml
  63. 8 17
      mec-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/PaymentController.java
  64. 16 0
      mec-mall/mall-portal/src/main/resources/bootstrap-dev.properties
  65. 11 1
      mec-mall/pom.xml
  66. 6 6
      mec-thirdparty/pom.xml
  67. 2 11
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/AdapayInit.java
  68. 7 11
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/ConfigInit.java
  69. 2 14
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/CorpMemberService.java
  70. 20 31
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/Payment.java
  71. 2 10
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/SettleAccountService.java
  72. 0 1
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/eseal/provider/TsignPlugin.java
  73. 3 14
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yeepay/YeepayMerchantService.java
  74. 4 21
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yeepay/YeepayPaymentService.java
  75. 2 11
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yeepay/YeepayUploadService.java
  76. 0 1
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/CFCARAUtil.java
  77. 6 4
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/YqPayFeignService.java
  78. 1 6
      pom.xml

+ 3 - 5
mec-application/src/main/java/com/ym/mec/AppServerApplication.java

@@ -5,8 +5,6 @@ import com.ym.mec.config.AppBeanNameGenerator;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.logging.LogLevel;
-import org.springframework.boot.logging.LoggingSystem;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.ComponentScan;
@@ -24,12 +22,12 @@ public class AppServerApplication {
         new SpringApplicationBuilder(AppServerApplication.class)
                 .beanNameGenerator(new AppBeanNameGenerator())
                 .run(args);
-        configureGlobalLogger();
+//        configureGlobalLogger();
     }
-
+/*
     private static void configureGlobalLogger() {
         LoggingSystem loggingSystem = LoggingSystem.get(ClassLoader.getSystemClassLoader());
         // 设置业务日志记录器的日志级别为INFO
         loggingSystem.setLogLevel("businessLogger", LogLevel.INFO);
-    }
+    }*/
 }

+ 16 - 3
mec-application/src/main/java/com/ym/mec/student/controller/MusicSheetController.java

@@ -3,6 +3,7 @@ package com.ym.mec.student.controller;
 import com.alibaba.fastjson.JSON;
 import com.dayaedu.cbs.common.enums.school.EMusicSheetType;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
+import com.google.common.collect.Lists;
 import com.microsvc.toolkit.common.response.template.R;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.ClientEnum;
@@ -14,7 +15,6 @@ import com.ym.mec.biz.service.InstrumentService;
 import com.ym.mec.biz.service.StudentService;
 import com.ym.mec.biz.service.SysMusicScoreService;
 import com.ym.mec.biz.service.SysUserService;
-import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.vo.MusicSheetVo;
 import io.swagger.annotations.Api;
@@ -25,12 +25,10 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -169,4 +167,19 @@ public class MusicSheetController {
 
         return R.from(convert);
     }
+
+    @ApiOperation(value = "总控平台乐器编码", notes = "总控平台乐器编码")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "id", value = "id", dataType = "long")
+    })
+    @GetMapping("/instrumentCode")
+    public R<List<MusicSheetWrapper.InstrumentCode>> instrumentCode() {
+
+        List<MusicSheetWrapper.InstrumentCode> codes = musicSheetService.getAllInstrumentCode();
+        if (CollectionUtils.isEmpty(codes)) {
+            codes = Lists.newArrayList();
+        }
+
+        return R.from(codes);
+    }
 }

+ 17 - 27
mec-application/src/main/java/com/ym/mec/student/controller/RepairController.java

@@ -3,12 +3,7 @@ package com.ym.mec.student.controller;
 
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.StudentRepair;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
-import com.ym.mec.biz.dal.enums.PayStatus;
 import com.ym.mec.biz.dal.page.GoodsCategoryQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
@@ -19,12 +14,9 @@ import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
-import java.util.Map;
+import javax.annotation.Resource;
 import java.util.Optional;
 
 @RequestMapping("${app-config.url.student:}/repair")
@@ -32,17 +24,15 @@ import java.util.Optional;
 @RestController
 public class RepairController extends BaseController {
 
-    @Autowired
+    @Resource
     private SysUserService sysUserService;
-    @Autowired
+    @Resource
     private StudentRepairService studentRepairService;
-    @Autowired
-    private StudentPaymentOrderService studentPaymentOrderService;
-    @Autowired
+    @Resource
     private GoodsService goodsService;
-    @Autowired
+    @Resource
     private GoodsCategoryService goodsCategoryService;
-    @Autowired
+    @Resource
     private StudentGoodsSellService studentGoodsSellService;
 
     @ApiOperation("添加商品销售订单")
@@ -51,37 +41,37 @@ public class RepairController extends BaseController {
         if(studentGoodsSell.getUserId() == null){
             studentGoodsSell.setUserId(sysUserService.getUserId());
         }
-        if (studentGoodsSell.getIsRepeatPay() == false) {
+        /*if (!studentGoodsSell.getIsRepeatPay()) {
             List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.GOODS_SELL, null, studentGoodsSell.getUserId(), DealStatusEnum.ING,
                     OrderTypeEnum.GOODS_SELL);
-            if (list.size() > 0) {
+            if (CollectionUtils.isNotEmpty(list)) {
             	StudentPaymentOrder applyOrder = list.get(list.size() - 1);
             	// 查询订单状态
                 PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder);
                 if(payStatus == PayStatus.SUCCESSED){
             		throw new BizException("订单已支付成功,请勿重复支付");
-            	}/*else if(payStatus == PayStatus.PAYING){
+            	}*//*else if(payStatus == PayStatus.PAYING){
             		throw new BizException("订单还在交易中,请稍后重试");
-            	}*/
+            	}*//*
                 return failed(HttpStatus.CONTINUE, "您有待支付的订单");
             }
-        }
+        }*/
         studentGoodsSell.setAuthorUser(studentGoodsSell.getUserId());
-        Map map = studentRepairService.addGoodsSellOrder(studentGoodsSell);
-        if(map.containsKey("tradeState")){
+        return studentRepairService.addGoodsSellOrder(studentGoodsSell);
+        /*if(map.containsKey("tradeState")){
             return failed(HttpStatus.CREATED, map,"恭喜您,购买成功!");
         }
-        return succeed(map);
+        return succeed(map);*/
     }
 
     @ApiOperation("学员扫码支付")
     @PostMapping(value = "/studentPaymentGoodsOrder")
     public HttpResponseResult studentPaymentGoodsOrder(Integer goodsSellId) throws Exception {
-        Map map = studentRepairService.studentPaymentGoodsOrder(goodsSellId);
-        if(map.containsKey("tradeState")){
+        return studentRepairService.studentPaymentGoodsOrder(goodsSellId);
+        /*if(map.containsKey("tradeState")){
             return failed(HttpStatus.CREATED, map,"恭喜您,购买成功!");
         }
-        return succeed(map);
+        return succeed(map);*/
     }
 
 

+ 21 - 52
mec-application/src/main/java/com/ym/mec/student/controller/ReplacementInstrumentActivityController.java

@@ -1,17 +1,14 @@
 package com.ym.mec.student.controller;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityDto;
 import com.ym.mec.biz.dal.dto.ReplacementInstrumentActivityStatDto;
 import com.ym.mec.biz.dal.dto.ReplacementPayDto;
 import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
 import com.ym.mec.biz.dal.entity.ReplacementInstrumentCooperation;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.enums.PayStatus;
 import com.ym.mec.biz.service.ReplacementInstrumentActivityService;
 import com.ym.mec.biz.service.ReplacementInstrumentCooperationService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.SysUserService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
@@ -19,25 +16,21 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Map;
+import javax.annotation.Resource;
 
 @RequestMapping("${app-config.url.student:}/replacementInstrumentActivity")
 @Api(tags = "乐器置换调查问卷")
 @RestController
 public class ReplacementInstrumentActivityController extends BaseController {
 
-    @Autowired
+    @Resource
     private ReplacementInstrumentActivityService replacementInstrumentActivityService;
-    @Autowired
-    private SysUserFeignService sysUserFeignService;
-    @Autowired
+    @Resource
+    private SysUserService sysUserService;
+    @Resource
     private ReplacementInstrumentCooperationService replacementInstrumentCooperationService;
-    @Autowired
-    private StudentPaymentOrderService studentPaymentOrderService;
 
     @ApiOperation(value = "新增调查问卷")
     @PostMapping("/insert")
@@ -54,10 +47,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @ApiOperation(value = "新版获取学员基本信息")
     @GetMapping("queryUserInfoByCooperationId")
     public Object queryUserInfoByCooperationId(Integer cooperationId) {
-        SysUser user = sysUserFeignService.queryUserInfo();
-        if (user == null) {
-            return failed(HttpStatus.FORBIDDEN, "请登录");
-        }
+        SysUser user = sysUserService.getUser();
         ReplacementInstrumentCooperation replacementInstrumentCooperation = replacementInstrumentCooperationService.get(cooperationId);
         Integer cooperationOrganId = replacementInstrumentCooperation.getCooperationOrganId();
         return succeed(replacementInstrumentActivityService.queryUserInfo(cooperationOrganId,user,cooperationId));
@@ -66,10 +56,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @ApiOperation(value = "获取学员基本信息")
     @GetMapping("queryUserInfo")
     public Object queryUserInfo(Integer cooperationOrganId) {
-        SysUser user = sysUserFeignService.queryUserInfo();
-        if (user == null) {
-            return failed(HttpStatus.FORBIDDEN, "请登录");
-        }
+        SysUser user = sysUserService.getUser();
         ReplacementInstrumentCooperation cooperation = replacementInstrumentCooperationService.findByCooperationOrganIdAndTopicId(cooperationOrganId,null);
         return succeed(replacementInstrumentActivityService.queryUserInfo(cooperationOrganId,user,cooperation.getId()));
     }
@@ -77,10 +64,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @ApiOperation(value = "修改调查问卷")
     @PostMapping("/update")
     public Object update(ReplacementInstrumentActivity replacementInstrumentActivity) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            throw new BizException("用户信息获取失败,请重新登陆");
-        }
+        sysUserService.getUser();
         replacementInstrumentActivityService.update(replacementInstrumentActivity);
         return succeed();
     }
@@ -88,10 +72,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @ApiOperation(value = "获取调查问卷")
     @GetMapping("/get")
     public Object get(Integer id) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            throw new BizException("用户信息获取失败,请重新登陆");
-        }
+        sysUserService.getUser();
         return succeed(replacementInstrumentActivityService.get(id));
     }
 
@@ -99,10 +80,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @GetMapping("/getInfo")
     @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "置换id", required = true, dataType = "int")})
     public HttpResponseResult<ReplacementInstrumentActivityStatDto> getInfo(Integer id) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            throw new BizException("用户信息获取失败,请重新登陆");
-        }
+        sysUserService.getUser();
         return succeed(replacementInstrumentActivityService.getInfo(id));
     }
 
@@ -110,10 +88,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @GetMapping("/getInfoByCooperationOrganId")
     @ApiImplicitParams({@ApiImplicitParam(name = "cooperationOrganId", value = "合作单位id", required = true, dataType = "int")})
     public HttpResponseResult<ReplacementInstrumentActivityStatDto> getInfoByCooperationOrganId(Integer cooperationOrganId) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed(HttpStatus.FORBIDDEN, "请重新登陆");
-        }
+        SysUser sysUser = sysUserService.getUser();
         ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityService.findByUserId(cooperationOrganId, sysUser.getId(),null);
         if(replacementInstrumentActivity == null){
         	return failed("未查询到您参与调查的记录");
@@ -126,10 +101,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @GetMapping("/getInfoByCooperationId")
     @ApiImplicitParams({@ApiImplicitParam(name = "cooperationId", value = "置换活动编号", required = true, dataType = "int")})
     public HttpResponseResult<ReplacementInstrumentActivityStatDto> getInfoByCooperationId(Integer cooperationId) {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            return failed(HttpStatus.FORBIDDEN, "请重新登陆");
-        }
+        SysUser sysUser = sysUserService.getUser();
         ReplacementInstrumentCooperation replacementInstrumentCooperation = replacementInstrumentCooperationService.get(cooperationId);
         ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityService.findByUserId(replacementInstrumentCooperation.getCooperationOrganId(),
                 sysUser.getId(),
@@ -144,10 +116,7 @@ public class ReplacementInstrumentActivityController extends BaseController {
     @ApiOperation(value = "置换支付")
     @PostMapping("/pay")
     public HttpResponseResult pay(@RequestBody ReplacementPayDto replacementPayDto) throws Exception {
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (sysUser == null) {
-            throw new BizException("用户信息获取失败,请重新登陆");
-        }
+        SysUser sysUser = sysUserService.getUser();
         ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityService.get(replacementPayDto.getId());
         if (replacementInstrumentActivity == null) {
             throw new BizException("乐器置换不存在,请核查");
@@ -165,22 +134,22 @@ public class ReplacementInstrumentActivityController extends BaseController {
             return failed("您已支付成功,请勿重复支付");
         }
         //判断用户是否已存在订单
-        if (replacementInstrumentActivity.getPayStatus().equals(1) && !replacementPayDto.getRePay()) {
+        /*if (replacementInstrumentActivity.getPayStatus().equals(1) && !replacementPayDto.getRePay()) {
         	
         	StudentPaymentOrder applyOrder = studentPaymentOrderService.getUserReplacementIngOrder(replacementInstrumentActivity.getUserId(), replacementInstrumentActivity.getId());
         	// 查询订单状态
             PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder);
             if(payStatus == PayStatus.SUCCESSED){
         		throw new BizException("订单已支付成功,请勿重复支付");
-        	}/*else if(payStatus == PayStatus.PAYING){
+        	}*//*else if(payStatus == PayStatus.PAYING){
         		throw new BizException("订单还在交易中,请稍后重试");
-        	}*/
+        	}*//*
             return failed(HttpStatus.CONTINUE, "您有待支付的订单");
-        }
-        Map payMap = replacementInstrumentActivityService.pay(replacementPayDto);
-        if (payMap.containsKey("tradeState")) {
+        }*/
+        return replacementInstrumentActivityService.pay(replacementPayDto);
+        /*if (payMap.containsKey("tradeState")) {
             return failed(HttpStatus.CREATED, payMap, "恭喜您,支付成功!");
         }
-        return succeed(payMap);
+        return succeed(payMap);*/
     }
 }

+ 91 - 69
mec-application/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -2,18 +2,20 @@ package com.ym.mec.student.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.huifu.adapay.core.AdapayCore;
-import com.huifu.adapay.core.util.AdapaySign;
-import com.yeepay.g3.sdk.yop.encrypt.DigitalEnvelopeDTO;
-import com.yeepay.g3.sdk.yop.utils.DigitalEnvelopeUtils;
-import com.yeepay.g3.sdk.yop.utils.RSAKeyUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.microsvc.toolkit.middleware.payment.common.api.BasePaymentService;
+import com.microsvc.toolkit.middleware.payment.common.api.PaymentServiceContext;
+import com.microsvc.toolkit.middleware.payment.common.api.entity.PaymentResp;
+import com.microsvc.toolkit.middleware.payment.common.api.enums.PaymentStatus;
 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.dto.*;
 import com.ym.mec.biz.dal.entity.*;
-import com.ym.mec.biz.dal.enums.*;
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
+import com.ym.mec.biz.dal.enums.GroupType;
+import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.page.StudentPaymentOrderQueryInfo;
 import com.ym.mec.biz.dal.vo.StudentPaymentOrderVo;
 import com.ym.mec.biz.dal.wrapper.CloudTeacherOrderWrapper;
@@ -23,7 +25,6 @@ import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.tenant.TenantContextHolder;
-import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
 import com.ym.mec.thirdparty.yqpay.Msg;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
@@ -36,19 +37,17 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpStatus;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.net.URLEncoder;
-import java.security.PrivateKey;
-import java.security.PublicKey;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -58,66 +57,66 @@ import java.util.stream.Collectors;
 @EnableScheduling
 public class StudentOrderController extends BaseController {
     private static final Logger logger = LoggerFactory.getLogger(StudentOrderController.class);
-    @Autowired
+    @Resource
     private StudentPaymentOrderService studentPaymentOrderService;
-    @Autowired
+    @Resource
     private VipGroupService vipGroupService;
-    @Autowired
+    @Resource
     private MusicGroupService musicGroupService;
-    @Autowired
+    @Resource
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
-    @Autowired
+    @Resource
     private StudentPaymentOrderDao studentPaymentOrderDao;
-    @Autowired
+    @Resource
     private SysConfigDao sysConfigDao;
-    @Autowired
+    @Resource
     private SporadicChargeInfoService sporadicChargeInfoService;
-    @Autowired
+    @Resource
     private OrganizationDao organizationDao;
-    @Autowired
+    @Resource
     private CourseScheduleEvaluateDao courseScheduleEvaluateDao;
-    @Autowired
+    @Resource
     private StudentGoodsSellDao studentGoodsSellDao;
-    @Autowired
+    @Resource
     private LuckDrawCountService luckDrawCountService;
-    @Autowired
+    @Resource
     private DegreeRegistrationDao degreeRegistrationDao;
-    @Autowired
+    @Resource
     private SysUserFeignService sysUserFeignService;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderCourseSettingsDao musicGroupPaymentCalenderCourseSettingsDao;
-    @Autowired
+    @Resource
     private ReplacementInstrumentActivityDao replacementInstrumentActivityDao;
-    @Autowired
+    @Resource
     private CloudTeacherOrderService cloudTeacherOrderService;
-    @Autowired
+    @Resource
     private SysCouponCodeDao sysCouponCodeDao;
-    @Autowired
+    @Resource
     private StudentRegistrationDao studentRegistrationDao;
-    @Autowired
+    @Resource
     private VipGroupActivityService vipGroupActivityService;
-    @Autowired
+    @Resource
     private TenantOrderRecordService tenantOrderRecordService;
-    @Autowired
+    @Resource
     private OrderPayOpsService orderPayOpsService;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderActivityService musicGroupPaymentCalenderActivityService;
-    @Autowired
+    @Resource
     private TenantConfigService tenantConfigService;
-    @Autowired
+    @Resource
     private OrganizationService organizationService;
-    @Autowired
+    @Resource
     private VipGroupCategoryDao vipGroupCategoryDao;
-    @Autowired
+    @Resource
     private TempBuyDoubleElevenUserLogDao tempBuyDoubleElevenUserLogDao;
-    @Autowired
-    private HfMerchantConfigService hfMerchantConfigService;
-    @Autowired
+    @Resource
     private TempDirectorTrainingCampDetailService tempDirectorTrainingCampDetailService;
-    @Autowired
+    @Resource
     private MusicGroupPaymentCalenderMemberService musicGroupPaymentCalenderMemberService;
+    @Resource
+    private PaymentServiceContext paymentServiceContext;
 
     @Value("${spring.profiles.active:dev}")
     private String profiles;
@@ -134,16 +133,42 @@ public class StudentOrderController extends BaseController {
         return succeed(studentPaymentOrderPageInfo);
     }
 
-    @PostMapping("/callback/{orderNo}")
-	public String callback(@PathVariable("orderNo") String orderNo, HttpServletRequest request) {
-		
-		StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findOrderByOrderNo(orderNo);
-		
+    @PostMapping("/callback/{vendor}")
+	public String callback(@PathVariable("vendor") String vendor, HttpServletRequest request) {
+        BasePaymentService paymentService = paymentServiceContext.getPaymentService(vendor);
+        if (Objects.isNull(paymentService)) {
+            throw new BizException("支付渠道不存在 " + vendor);
+        }
+        PaymentResp paymentResp = paymentService.callbackNotifyForPay(request);
+        logger.info("payment vendor={}, paymentResp={}", vendor, JSON.toJSONString(paymentResp));
+        if (Objects.isNull(paymentResp)) {
+            return "支付回调失败";
+        }
+		StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findOrderByOrderNo(paymentResp.getMerOrderNo());
 		if(studentPaymentOrder == null) {
-			return "订单号错误";
-		}
-		
-		PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(studentPaymentOrder.getPaymentChannel());
+            //获取机构订单
+            TenantOrderRecord record = tenantOrderRecordService.getOne(Wrappers.<TenantOrderRecord> lambdaQuery()
+                    .eq(TenantOrderRecord::getOrderNo, paymentResp.getMerOrderNo()));
+            if (Objects.isNull(record)) {
+                throw new BizException("订单号不存在:{}", paymentResp.getMerOrderNo());
+            }else {
+                tenantOrderRecordService.callback(record, paymentResp);
+            }
+		}else {
+            try {
+                Map<String, String> notifyMap = new HashMap<>(4);
+                notifyMap.put("channelType", paymentResp.getPaymentChannel());
+                notifyMap.put("tradeState", paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED?"1":"0");
+                notifyMap.put("totalMoney", paymentResp.getPaymentAmount().toString());
+                notifyMap.put("merOrderNo", paymentResp.getMerOrderNo());
+                studentPaymentOrderService.updateOrder(notifyMap);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        }
+        return paymentService.returnNotifyResult(request);
+        /*
+        PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(studentPaymentOrder.getPaymentChannel());
 		
 		try {
 			
@@ -234,24 +259,22 @@ public class StudentOrderController extends BaseController {
 		} catch (Exception e) {
 			return e.getMessage();
 		}
-		
-		return "succeeded";
+		*/
+//		return "succeeded";
 	}
 
     @PostMapping("/notify")
     public Msg notify(@ModelAttribute Msg msg) throws Exception {
         logger.info(msg.toString());
-        Map<String, Object> rqMap = new LinkedHashMap<String, Object>();
-        rqMap.put("code", msg.getCode());
-        rqMap.put("msg", msg.getMsg());
-        rqMap.put("responseType", msg.getResponseType());
-        rqMap.put("responseParameters", msg.getResponseParameters());
-        rqMap.put("sign", msg.getSign());
+//        Map<String, Object> rqMap = new LinkedHashMap<String, Object>();
+//        rqMap.put("code", msg.getCode());
+//        rqMap.put("msg", msg.getMsg());
+//        rqMap.put("responseType", msg.getResponseType());
+//        rqMap.put("responseParameters", msg.getResponseParameters());
+//        rqMap.put("sign", msg.getSign());
         //boolean rs = YqPayUtil.verify(rqMap);
         msg.setMsg("fail");
-        Map<String, String> notifyMap = new HashMap<>();
-        //if (rs) {
-        notifyMap = JSON.parseObject(msg.getResponseParameters(), Map.class);
+        Map<String, String> notifyMap = JSON.parseObject(msg.getResponseParameters(), Map.class);
         //}
         //支付中订单存在,更新状态
         if (msg.getResponseType().equals("1") && notifyMap.size() > 0) {
@@ -502,11 +525,11 @@ public class StudentOrderController extends BaseController {
     @GetMapping("/setSuccessStatus")
     public HttpResponseResult setSuccessStatus(String orderNo) throws Exception {
         if (!profiles.equals("dev") && !profiles.equals("test")) {
-//            return failed("非法操作");
+            return failed("非法操作");
         }
         List<StudentPaymentOrder> payingOrders = studentPaymentOrderService.findOrdersByStatus(DealStatusEnum.ING);
 
-        String[] statusArr = {"0", "1", "7"};
+//        String[] statusArr = {"0", "1", "7"};
         for (StudentPaymentOrder payingOrder : payingOrders) {
             if (StringUtils.isNotBlank(orderNo) && !orderNo.equals(payingOrder.getOrderNo())) {
                 continue;
@@ -518,7 +541,6 @@ public class StudentOrderController extends BaseController {
                     continue;
                 }
             }
-
             Map<String, String> rpMap = new HashMap<>();
             rpMap.put("tradeState", "1");
             rpMap.put("remarks", "模拟支付成功");
@@ -529,14 +551,14 @@ public class StudentOrderController extends BaseController {
 
             String channelType = rpMap.get("channelType").equals("1") ? "WXPay" : (rpMap.get("channelType").equals("2") ? "Alipay" : "quickPay");
             rpMap.put("channelType", channelType);
-            if (Arrays.asList(statusArr).contains(rpMap.get("tradeState"))) {
+            studentPaymentOrderService.updateOrder(rpMap); //更新订单
+            /*if (Arrays.asList(statusArr).contains(rpMap.get("tradeState"))) {
                 try {
-                    studentPaymentOrderService.updateOrder(rpMap); //更新订单
                 } catch (Exception e) {
                     e.printStackTrace();
                     continue;
                 }
-            }
+            }*/
         }
         return succeed();
     }
@@ -895,7 +917,7 @@ public class StudentOrderController extends BaseController {
 
     @GetMapping("/reConfirmOrder")
     public HttpResponseResult<List<StudentPaymentOrder>> reConfirmOrder(Date startTime, Date endTime) {
-        if (!profiles.equals("prod")) {
+        if (!profiles.equals("prod") && !profiles.equals("pre")) {
             return failed("测试环境不支持");
         }
         return succeed(studentPaymentOrderService.reConfirmOrder(startTime, endTime));

+ 6 - 11
mec-application/src/main/java/com/ym/mec/student/controller/SubjectChangeController.java

@@ -15,22 +15,21 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Map;
+import javax.annotation.Resource;
 
 @RequestMapping("${app-config.url.student:}/subjectChange")
 @Api(tags = "声部更换服务")
 @RestController
 public class SubjectChangeController extends BaseController {
 
-    @Autowired
+    @Resource
     private SubjectChangeService subjectChangeService;
-    @Autowired
+    @Resource
     private SubjectChangeDao subjectChangeDao;
-    @Autowired
+    @Resource
     private StudentPaymentOrderService studentPaymentOrderService;
 
 
@@ -46,7 +45,7 @@ public class SubjectChangeController extends BaseController {
 
     @ApiOperation(value = "支付更换声部费用")
     @PostMapping("/payChange")
-    public HttpResponseResult<Map> payChange(@RequestBody SubjectChangeParamDto subjectChangeParamDto) throws Exception {
+    public HttpResponseResult payChange(@RequestBody SubjectChangeParamDto subjectChangeParamDto) throws Exception {
         SubjectChange subjectChange = subjectChangeDao.get(subjectChangeParamDto.getId());
         if (!subjectChangeParamDto.getRepay() && subjectChange.getStatus().equals(SubjectChangeStatusEnum.ING)) {
         	
@@ -59,11 +58,7 @@ public class SubjectChangeController extends BaseController {
             return failed(HttpStatus.CONTINUE, "您有待支付的订单");
         }
         subjectChangeParamDto.setTenantId(subjectChange.getTenantId());
-        Map payMap = subjectChangeService.payChange(subjectChangeParamDto);
-        if (payMap.containsKey("tradeState")) {
-            return failed(HttpStatus.CREATED, payMap, "恭喜您,支付成功!");
-        }
-        return succeed(payMap);
+        return subjectChangeService.payChange(subjectChangeParamDto);
     }
 
 

+ 12 - 20
mec-application/src/main/java/com/ym/mec/teacher/controller/EduRepairController.java

@@ -2,11 +2,7 @@ package com.ym.mec.teacher.controller;
 
 import com.ym.mec.biz.dal.dto.BasicUserDto;
 import com.ym.mec.biz.dal.entity.StudentGoodsSell;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.Teacher;
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
-import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.page.GoodsCategoryQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsQueryInfo;
 import com.ym.mec.biz.dal.page.GoodsSellQueryInfo;
@@ -18,11 +14,9 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
+import javax.annotation.Resource;
 import java.util.Map;
 import java.util.Objects;
 
@@ -31,19 +25,17 @@ import java.util.Objects;
 @RestController
 public class EduRepairController extends BaseController {
 
-    @Autowired
+    @Resource
     private SysUserService sysUserService;
-    @Autowired
+    @Resource
     private TeacherService teacherService;
-    @Autowired
+    @Resource
     private StudentRepairService studentRepairService;
-    @Autowired
-    private StudentPaymentOrderService studentPaymentOrderService;
-    @Autowired
+    @Resource
     private GoodsService goodsService;
-    @Autowired
+    @Resource
     private GoodsCategoryService goodsCategoryService;
-    @Autowired
+    @Resource
     private StudentGoodsSellService studentGoodsSellService;
 
     @ApiImplicitParams({
@@ -60,21 +52,21 @@ public class EduRepairController extends BaseController {
     @ApiOperation("添加商品销售订单")
     @PostMapping(value = "/addGoodsSellOrder")
     public HttpResponseResult addGoodsSellOrder(@RequestBody StudentGoodsSell studentGoodsSell) throws Exception {
-        if (studentGoodsSell.getIsRepeatPay() == false) {
+        /*if (studentGoodsSell.getIsRepeatPay() == false) {
             List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.GOODS_SELL, null, studentGoodsSell.getUserId(), DealStatusEnum.ING,
                     OrderTypeEnum.RENEW);
             if (list.size() > 0) {
                 return failed(HttpStatus.CONTINUE, "该学员有待支付的订单");
             }
-        }
+        }*/
         Integer userId = sysUserService.getUserId();
         studentGoodsSell.setTeacherId(userId);
         studentGoodsSell.setAuthorUser(userId);
-        Map map = studentRepairService.addGoodsSellOrder(studentGoodsSell);
-        if (map.containsKey("tradeState")) {
+        return studentRepairService.addGoodsSellOrder(studentGoodsSell);
+        /*if (map.containsKey("tradeState")) {
             return failed(HttpStatus.CREATED, map, "恭喜您,购买成功!");
         }
-        return succeed(map);
+        return succeed(map);*/
     }
 
     @ApiOperation("获取学生信息")

+ 16 - 0
mec-application/src/main/java/com/ym/mec/teacher/controller/MusicSheetController.java

@@ -3,6 +3,7 @@ package com.ym.mec.teacher.controller;
 import com.alibaba.fastjson.JSON;
 import com.dayaedu.cbs.common.enums.school.EMusicSheetType;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
+import com.google.common.collect.Lists;
 import com.microsvc.toolkit.common.response.template.R;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.entity.Instrument;
@@ -175,4 +176,19 @@ public class MusicSheetController {
 
         return R.from(convert);
     }
+
+    @ApiOperation(value = "总控平台乐器编码", notes = "总控平台乐器编码")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "id", value = "id", dataType = "long")
+    })
+    @GetMapping("/instrumentCode")
+    public R<List<MusicSheetWrapper.InstrumentCode>> instrumentCode() {
+
+        List<MusicSheetWrapper.InstrumentCode> codes = musicSheetService.getAllInstrumentCode();
+        if (CollectionUtils.isEmpty(codes)) {
+            codes = Lists.newArrayList();
+        }
+
+        return R.from(codes);
+    }
 }

+ 3 - 7
mec-application/src/main/java/com/ym/mec/teacher/controller/TeacherOrderController.java

@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 
@@ -22,14 +23,9 @@ import java.io.IOException;
 @Api(tags = "订单回调")
 @RestController
 public class TeacherOrderController extends BaseController {
-	private static final Logger logger = LoggerFactory.getLogger(TeacherOrderController.class);
-	@Autowired
-	private YqPayFeignService yqPayFeignService;
-	@Autowired
-	private TenantPaymentOrderDao tenantPaymentOrderDao;
-	@Autowired
+	@Resource
 	private SysConfigDao sysConfigDao;
-	@Autowired
+	@Resource
 	private TenantPaymentOrderService tenantPaymentOrderService;
 
 	@RequestMapping("paymentResult")

+ 3 - 3
mec-application/src/main/java/com/ym/mec/web/controller/APIController.java

@@ -125,7 +125,7 @@ public class APIController extends BaseController {
 		queryInfo.setOrganId(sysUser.getOrganId());
 		queryInfo.setUserId(sysUser.getId());
 		List<StudentVipGroupShowListDto> listDtos = vipGroupService.queryVipPracticeGroups(queryInfo);
-		return CollectionUtils.isEmpty(listDtos)?false:true;
+		return !CollectionUtils.isEmpty(listDtos);
 	}
 
 
@@ -145,13 +145,13 @@ public class APIController extends BaseController {
 
 	// 商城订单优惠券金额
 	@PostMapping("/couponAmount")
-	public HttpResponseResult<Map> couponAmount(@RequestBody MallCreateOrderModel model) {
+	public HttpResponseResult<Map<String,Object>> couponAmount(@RequestBody MallCreateOrderModel model) {
 		return succeed(studentPaymentOrderService.couponAmount(model));
 	}
 
 	// 商城保存订单详情数据
 	@PostMapping("/mallSaveOrderInfo")
-	public HttpResponseResult<Map> mallSaveOrderInfo(@RequestBody MallCreateOrderModel model) {
+	public HttpResponseResult mallSaveOrderInfo(@RequestBody MallCreateOrderModel model) {
 		studentPaymentOrderService.mallSaveOrderInfo(model);
 		return succeed();
 	}

+ 18 - 0
mec-application/src/main/java/com/ym/mec/web/controller/MusicSheetController.java

@@ -3,6 +3,7 @@ package com.ym.mec.web.controller;
 import com.alibaba.fastjson.JSON;
 import com.dayaedu.cbs.common.enums.school.EMusicSheetType;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
+import com.google.common.collect.Lists;
 import com.microsvc.toolkit.common.response.template.R;
 import com.ym.mec.biz.dal.entity.Instrument;
 import com.ym.mec.biz.dal.entity.SysMusicScore;
@@ -24,6 +25,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -163,4 +165,20 @@ public class MusicSheetController {
 
         return R.from(convert);
     }
+
+    @ApiOperation(value = "总控平台乐器编码", notes = "总控平台乐器编码")
+    @ApiImplicitParams({
+        @ApiImplicitParam(name = "id", value = "id", dataType = "long")
+    })
+    @PreAuthorize("@pcs.hasPermissions('musicSheet/instrumentCode')")
+    @GetMapping("/instrumentCode")
+    public R<List<MusicSheetWrapper.InstrumentCode>> instrumentCode() {
+
+        List<MusicSheetWrapper.InstrumentCode> codes = musicSheetService.getAllInstrumentCode();
+        if (CollectionUtils.isEmpty(codes)) {
+            codes = Lists.newArrayList();
+        }
+
+        return R.from(codes);
+    }
 }

+ 6 - 6
mec-application/src/main/java/com/ym/mec/web/controller/StudentPaymentOrderController.java

@@ -18,13 +18,13 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 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.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -34,15 +34,15 @@ import java.util.stream.Collectors;
 @RestController
 public class StudentPaymentOrderController extends BaseController {
 
-    @Autowired
+    @Resource
     private StudentPaymentOrderService studentPaymentOrderService;
-    @Autowired
+    @Resource
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
-    @Autowired
+    @Resource
     private OrganizationService organizationService;
-    @Autowired
+    @Resource
     private SysConfigDao sysConfigDao;
-    @Autowired
+    @Resource
     private StudentPaymentOrderDao studentPaymentOrderDao;
 
     @ApiOperation(value = "获取订单列表")

+ 5 - 11
mec-application/src/main/java/com/ym/mec/web/controller/TenantInfoController.java

@@ -8,7 +8,6 @@ import com.ym.mec.biz.dal.entity.TenantInfo;
 import com.ym.mec.biz.dal.entity.TenantProductSumm;
 import com.ym.mec.biz.service.TenantInfoSendMsgService;
 import com.ym.mec.biz.service.TenantInfoService;
-import com.ym.mec.biz.service.TenantOrderRecordService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.WrapperUtil;
@@ -18,14 +17,12 @@ import io.swagger.annotations.*;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.BindingResult;
 import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
 import java.math.BigDecimal;
 import java.util.Map;
@@ -44,17 +41,14 @@ import static com.ym.mec.biz.service.impl.TenantInfoSendMsgServiceImpl.OPEN;
 public class TenantInfoController extends BaseController {
     private static final Logger log = LoggerFactory.getLogger(TenantInfoController.class);
 
-    @Autowired
+    @Resource
     private TenantInfoService tenantInfoService;
 
-    @Autowired
+    @Resource
     private SysUserFeignService sysUserFeignService;
 
-    @Autowired
-    private TenantInfoSendMsgService tenantInfoSendMsgService;
-
     @Resource
-    private TenantOrderRecordService tenantOrderRecordService;
+    private TenantInfoSendMsgService tenantInfoSendMsgService;
 
     @ApiOperation("添加机构信息")
     @PostMapping(value = "/add")
@@ -187,9 +181,9 @@ public class TenantInfoController extends BaseController {
         return succeed();
     }
 
-    @PostMapping("/callback/{orderNo}")
+    /*@PostMapping("/callback/{orderNo}")
     public String callback(@PathVariable("orderNo") String orderNo, HttpServletRequest request) {
         return tenantOrderRecordService.callback(orderNo, request);
-    }
+    }*/
 
 }

+ 14 - 16
mec-application/src/main/java/com/ym/mec/web/controller/education/EduRepairController.java

@@ -41,25 +41,23 @@ import java.util.stream.Collectors;
 @RestController
 public class EduRepairController extends BaseController {
 
-    @Autowired
+    @Resource
     private SysUserService sysUserService;
-    @Autowired
+    @Resource
     private EmployeeDao employeeDao;
-    @Autowired
+    @Resource
     private StudentRepairService studentRepairService;
-    @Autowired
-    private StudentPaymentOrderService studentPaymentOrderService;
-    @Autowired
+    @Resource
     private SubjectService subjectService;
-    @Autowired
+    @Resource
     private GoodsService goodsService;
-    @Autowired
+    @Resource
     private GoodsCategoryService goodsCategoryService;
-    @Autowired
+    @Resource
     private StudentGoodsSellService studentGoodsSellService;
-    @Autowired
+    @Resource
     private StudentInstrumentService studentInstrumentService;
-    @Autowired
+    @Resource
     private StudentInstrumentDao studentInstrumentDao;
     @Resource
     private MallFeignService mallFeignService;
@@ -87,21 +85,21 @@ public class EduRepairController extends BaseController {
     @ApiOperation("添加商品销售订单")
     @PostMapping(value = "/addGoodsSellOrder")
     public HttpResponseResult addGoodsSellOrder(@RequestBody StudentGoodsSell studentGoodsSell) throws Exception {
-        if (studentGoodsSell.getIsRepeatPay() == false) {
+        /*if (studentGoodsSell.getIsRepeatPay() == false) {
             List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.GOODS_SELL, null,studentGoodsSell.getUserId(), DealStatusEnum.ING,
                     OrderTypeEnum.RENEW);
             if (list.size() > 0) {
                 return failed(HttpStatus.CONTINUE, "该学员有待支付的订单");
             }
-        }
+        }*/
         Integer userId = sysUserService.getUserId();
         studentGoodsSell.setTeacherId(userId);
         studentGoodsSell.setAuthorUser(userId);
-        Map map = studentRepairService.addGoodsSellOrder(studentGoodsSell);
-        if(map.containsKey("tradeState")){
+        return studentRepairService.addGoodsSellOrder(studentGoodsSell);
+        /*if(map.containsKey("tradeState")){
             return failed(HttpStatus.CREATED, map,"恭喜您,购买成功!");
         }
-        return succeed(map);
+        return succeed(map);*/
     }
 
     @ApiOperation("添加维修单")

+ 7 - 8
mec-application/src/main/java/com/ym/mec/web/controller/payment/AdapayController.java

@@ -16,7 +16,6 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.adapay.ConfigInit;
-import com.ym.mec.thirdparty.adapay.Payment;
 import com.ym.mec.thirdparty.adapay.entity.AccountInfo;
 import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
 import com.ym.mec.util.date.DateUtil;
@@ -26,7 +25,6 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -34,6 +32,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
@@ -48,10 +47,9 @@ import java.util.Map;
 @RestController
 public class AdapayController extends BaseController {
 
-    @Autowired
+    @Resource
     private HfMemberService hfMemberService;
-    
-    @Autowired
+    @Resource
     private HfMerchantConfigService hfMerchantConfigService;
 
     @Value("${spring.profiles.active:dev}")
@@ -213,12 +211,13 @@ public class AdapayController extends BaseController {
         long createdLte = DateUtil.getLastSecondWithDay(endTime).getTime();
         int pageIndex = 1;
         List<Map<String, Object>> data = new ArrayList<>();
-        while (profiles.equals("prod")) {
+        while (profiles.equals("prod") || profiles.equals("pre")) {
         	HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(TenantContextHolder.getTenantId(), PaymentChannelEnum.ADAPAY.getCode());
             if(hfMerchantConfig == null){
             	throw new BizException("机构[{}]汇付商户信息找不到", TenantContextHolder.getTenantId());
             }
-            Map<String, Object> paymentList = Payment.queryList(hfMerchantConfig.getAppId(), hfMerchantConfig.getMerKey(), pageIndex, createdGte, createdLte);
+            Map<String, Object> paymentList = hfMemberService.queryWithKey(hfMerchantConfig.getAppId(), hfMerchantConfig.getMerKey(), pageIndex, createdGte, createdLte);
+//            Map<String, Object> paymentList = Payment.queryList(hfMerchantConfig.getAppId(), hfMerchantConfig.getMerKey(), pageIndex, createdGte, createdLte);
             JSONArray payments = (JSONArray) paymentList.get("payments");
             if (!paymentList.get("status").equals("succeeded")) {
                 throw new BizException("查询失败,请重试");
@@ -248,7 +247,7 @@ public class AdapayController extends BaseController {
                     }
                     if (paymentMap.get("pay_mode").equals("delay")) {
                         if (!paymentMap.containsKey("payment_confirms")) {
-                            Map<String, Object> confirmMap = Payment.queryConfirmList(hfMerchantConfig.getAppId(), hfMerchantConfig.getMerKey(), paymentMap.get("id").toString());
+                            Map<String, Object> confirmMap = hfMemberService.queryConfirmList(hfMerchantConfig.getAppId(), hfMerchantConfig.getMerKey(), paymentMap.get("id").toString());
                             if (confirmMap.containsKey("payment_confirms")) {
                                 paymentMap.put("payment_confirms", confirmMap.get("payment_confirms"));
                             }

+ 30 - 21
mec-application/src/main/java/com/ym/mec/web/controller/payment/YeepayController.java

@@ -2,6 +2,9 @@ package com.ym.mec.web.controller.payment;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.microsvc.toolkit.middleware.payment.common.api.BasePaymentService;
+import com.microsvc.toolkit.middleware.payment.common.api.PaymentServiceContext;
+import com.microsvc.toolkit.middleware.payment.common.api.entity.PaymentMerchant;
 import com.yeepay.g3.sdk.yop.encrypt.DigitalEnvelopeDTO;
 import com.yeepay.g3.sdk.yop.utils.DigitalEnvelopeUtils;
 import com.yeepay.g3.sdk.yop.utils.RSAKeyUtils;
@@ -17,7 +20,6 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
-import com.ym.mec.thirdparty.yeepay.YeepayMerchantService;
 import com.ym.mec.thirdparty.yeepay.YeepayUploadService;
 import com.ym.mec.thirdparty.yeepay.entity.MerchantInfo;
 import io.swagger.annotations.Api;
@@ -26,12 +28,11 @@ import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -47,20 +48,19 @@ import java.util.Date;
 public class YeepayController extends BaseController {
     private static final Logger logger = LoggerFactory.getLogger(YeepayController.class);
 
-    @Autowired
+    @Resource
     private HfMemberService hfMemberService;
     
-    @Autowired
+    @Resource
     private HfMerchantConfigService hfMerchantConfigService;
     
-    @Autowired
+    @Resource
     private YeepayUploadService yeepayUploadService;
-    
-    @Autowired
-    private YeepayMerchantService yeepayMerchantService;
+    @Resource
+    private PaymentServiceContext paymentServiceContext;
 
-    @Value("${spring.profiles.active:dev}")
-    private String profiles;
+//    @Value("${spring.profiles.active:dev}")
+//    private String profiles;
 
     @ApiOperation(value = "企业用户列表")
     @GetMapping("/queryPage")
@@ -74,14 +74,16 @@ public class YeepayController extends BaseController {
     @ApiOperation(value = "企业用户注册查询")
     @GetMapping("/registerQuery")
     @PreAuthorize("@pcs.hasPermissions('yeepay/registerQuery')")
-    public HttpResponseResult<JSONObject> registerQuery(String requestNo) throws IOException {
-		
-		HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(TenantContextHolder.getTenantId(), PaymentChannelEnum.YEEPAY.getCode());
-        if(hfMerchantConfig == null){
-        	throw new BizException("机构[{}][{}]商户信息找不到", TenantContextHolder.getTenantId(), PaymentChannelEnum.YEEPAY.getCode());
+    public HttpResponseResult<PaymentMerchant.MerchantMember> registerQuery(String requestNo) throws IOException {
+        BasePaymentService paymentService = paymentServiceContext.getPaymentService(PaymentChannelEnum.YEEPAY.getCode() + "_" + TenantContextHolder.getTenantId());
+        if(paymentService == null){
+        	throw new BizException("机构[{}][{}]支付服务找不到", TenantContextHolder.getTenantId(), PaymentChannelEnum.YEEPAY.getCode());
         }
-        
-        return succeed(yeepayMerchantService.registerQueryV2(hfMerchantConfig, requestNo));
+        PaymentMerchant.MerchantConfig merchantConfig = hfMemberService.getMerchantConfig(PaymentChannelEnum.YEEPAY.getCode(), TenantContextHolder.getTenantId());
+        PaymentMerchant.MerchantMember hfMerchantConfig = new PaymentMerchant.MerchantMember();
+        hfMerchantConfig.setRequestNo(requestNo);
+        return succeed(paymentService.getPaymentCorpMember(merchantConfig, hfMerchantConfig));
+//        return succeed(yeepayMerchantService.registerQueryV2(hfMerchantConfig, requestNo));
     }
 
     @ApiOperation("新建企业用户")
@@ -172,12 +174,19 @@ public class YeepayController extends BaseController {
             inputStream.close();
             fos.close();
             
-            HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(TenantContextHolder.getTenantId(), PaymentChannelEnum.YEEPAY.getCode());
+            /*HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(TenantContextHolder.getTenantId(), PaymentChannelEnum.YEEPAY.getCode());
             if(hfMerchantConfig == null){
             	throw new BizException("请配置机构的易宝商户信息");
+            }*/
+            BasePaymentService paymentService = paymentServiceContext.getPaymentService(PaymentChannelEnum.YEEPAY.getCode() + "_" + TenantContextHolder.getTenantId());
+            if(paymentService == null){
+            	throw new BizException("机构[{}][{}]支付服务找不到", TenantContextHolder.getTenantId(), PaymentChannelEnum.YEEPAY.getCode());
             }
-        	
-            return succeed(yeepayUploadService.upload(hfMerchantConfig, file));
+            PaymentMerchant.MerchantConfig merchantConfig = hfMemberService.getMerchantConfig(PaymentChannelEnum.YEEPAY.getCode(), TenantContextHolder.getTenantId());
+            String upload = paymentService.upload(merchantConfig, file);
+            return succeed(upload);
+
+//            return succeed(yeepayUploadService.upload(hfMerchantConfig, file));
         } catch (Exception e) {
             return failed(e.getMessage());
         } finally {

+ 1 - 0
mec-application/src/main/resources/bootstrap-dev.properties

@@ -10,3 +10,4 @@ spring.cloud.nacos.config.file-extension=yaml
 #\u662F\u5426\u52A8\u6001\u5237\u65B0
 spring.cloud.nacos.config.enabled=true
 logging.config=classpath:logback-dev.xml
+spring.cloud.nacos.config.shared-dataids=base.yaml

+ 2 - 1
mec-application/src/main/resources/bootstrap-test.properties

@@ -9,4 +9,5 @@ spring.cloud.nacos.config.prefix=app
 spring.cloud.nacos.config.file-extension=yaml
 #\u662f\u5426\u52a8\u6001\u5237\u65b0
 spring.cloud.nacos.config.enabled=true
-logging.config=classpath:logback-test-env.xml
+logging.config=classpath:logback-test-env.xml
+spring.cloud.nacos.config.shared-dataids=base.yaml

+ 16 - 15
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserController.java

@@ -1,9 +1,6 @@
 package com.ym.mec.auth.web.controller;
 
 import com.alibaba.fastjson.JSON;
-import com.dayaedu.cbs.openfeign.service.CbsQrCodeScanService;
-import com.dayaedu.cbs.openfeign.wrapper.qrcode.CbsQrCodeScanWrapper;
-import com.huifu.adapay.core.util.StringUtil;
 import com.ym.mec.auth.api.dto.SysUserInfo;
 import com.ym.mec.auth.api.dto.SysUserQueryInfo;
 import com.ym.mec.auth.api.entity.SysUser;
@@ -13,6 +10,7 @@ import com.ym.mec.auth.service.SysUserService;
 import com.ym.mec.auth.service.TenantInfoService;
 import com.ym.mec.auth.web.controller.queryInfo.QRLoginDto;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.dto.RealnameAuthenticationDto;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.entity.ImResult;
 import com.ym.mec.common.entity.ImUserModel;
@@ -28,14 +26,15 @@ import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
 import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 import com.ym.mec.util.date.DateUtil;
 import io.swagger.annotations.*;
+import jodd.util.StringUtil;
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.io.IOException;
 import java.util.*;
@@ -45,25 +44,25 @@ import java.util.*;
 @Api(tags = "会员服务")
 public class UserController extends BaseController {
 
-	@Autowired
+	@Resource
 	private SysUserService sysUserService;
-	@Autowired
+	@Resource
 	private SysRoleService sysRoleService;
-	@Autowired
+	@Resource
 	private ImFeignService imFeignService;
-	@Autowired
+	@Resource
 	private SysUserRoleService sysUserRoleService;
-	@Autowired
+	@Resource
 	private IdGeneratorService smsCodeService;
-	@Autowired
+	@Resource
 	private TenantInfoService tenantInfoService;
-	@Autowired
+	@Resource
 	private RedisCache<String,Object> redisCache;
 
-	@Value("${message.debugMode}")
+	/*@Value("${message.debugMode}")
 	private boolean debugMode;
 	@Autowired
-	private RealnameAuthenticationPluginContext realnameAuthenticationPluginContext;
+	private RealnameAuthenticationPluginContext realnameAuthenticationPluginContext;*/
 
 	@ApiOperation(value = "分页查询用户信息")
 	@ApiImplicitParams({ @ApiImplicitParam(name = "userType", value = "用户类型", required = false, dataType = "String"),
@@ -257,8 +256,10 @@ public class UserController extends BaseController {
 				throw new BizException("出生日期不可超过当前时间");
 			}
 
-			if(!debugMode&&StringUtils.isNotBlank(sysUser.getCertificateType())&&"IDENTITY".equals(sysUser.getCertificateType())){
-				realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(sysUser.getRealName(), sysUser.getIdCardNo());
+			if(StringUtils.isNotBlank(sysUser.getCertificateType())&&"IDENTITY".equals(sysUser.getCertificateType())){
+				//取消第三方实名认证,通过正则校验
+//				realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(sysUser.getRealName(), sysUser.getIdCardNo());
+				RealnameAuthenticationDto.verify(sysUser.getRealName(), sysUser.getIdCardNo());
 			}
 
 			sysUserService.updateBaseInfo(sysUser);

+ 1 - 1
mec-auth/pom.xml

@@ -23,7 +23,7 @@
 		<dependency>
 			<groupId>com.microsvc.toolkit.common</groupId>
 			<artifactId>microsvc-common-webportal</artifactId>
-			<version>${com.microsvc.toolkit.version}</version>
+			<version>${microsvc.version}</version>
 		</dependency>
 		<!-- 引用Mybatis 和 Mysql驱动开始 -->
 		<dependency>

+ 20 - 10
mec-biz/pom.xml

@@ -50,21 +50,31 @@
 			<artifactId>thumbnailator</artifactId>
 			<version>0.4.11</version>
 		</dependency>
-
+		<dependency>
+			<groupId>com.microsvc.toolkit.middleware</groupId>
+			<artifactId>microsvc-middleware-payment</artifactId>
+			<version>${microsvc.version}</version>
+			<exclusions>
+				<exclusion>
+					<artifactId>mybatis-plus-annotation</artifactId>
+					<groupId>com.baomidou</groupId>
+				</exclusion>
+			</exclusions>
+		</dependency>
 		<dependency>
 			<groupId>com.microsvc.toolkit.middleware</groupId>
 			<artifactId>microsvc-middleware-live</artifactId>
-			<version>${com.microsvc.toolkit.version}</version>
+			<version>${microsvc.version}</version>
 		</dependency>
 		<dependency>
 			<groupId>com.microsvc.toolkit.common</groupId>
 			<artifactId>microsvc-common-response</artifactId>
-			<version>${com.microsvc.toolkit.version}</version>
+			<version>${microsvc.version}</version>
 		</dependency>
 		<dependency>
 			<groupId>com.microsvc.toolkit.middleware</groupId>
 			<artifactId>microsvc-middleware-rtc</artifactId>
-			<version>${com.microsvc.toolkit.version}</version>
+			<version>${microsvc.version}</version>
 		</dependency>
 
 		<!--修复依赖冲突-->
@@ -75,22 +85,22 @@
 		<dependency>
 			<groupId>com.microsvc.toolkit.config</groupId>
 			<artifactId>microsvc-config-validator</artifactId>
-			<version>${com.microsvc.toolkit.version}</version>
+			<version>${microsvc.version}</version>
 		</dependency>
         <dependency>
             <groupId>com.microsvc.toolkit.config</groupId>
             <artifactId>microsvc-config-jwt</artifactId>
-            <version>${com.microsvc.toolkit.version}</version>
+            <version>${microsvc.version}</version>
         </dependency>
 		<dependency>
 			<groupId>com.microsvc.toolkit.middleware</groupId>
 			<artifactId>microsvc-middleware-im</artifactId>
-			<version>${com.microsvc.toolkit.version}</version>
+			<version>${microsvc.version}</version>
 		</dependency>
 		<dependency>
 			<groupId>com.microsvc.toolkit.middleware</groupId>
 			<artifactId>microsvc-middleware-oss</artifactId>
-			<version>${com.microsvc.toolkit.version}</version>
+			<version>${microsvc.version}</version>
 		</dependency>
 
 		<dependency>
@@ -100,6 +110,8 @@
 		</dependency>
 		<dependency>
 			<artifactId>microsvc-common-tools</artifactId>
+			<groupId>com.microsvc.toolkit.common</groupId>
+			<version>${microsvc.version}</version>
 			<exclusions>
 				<exclusion>
 					<artifactId>commons-io</artifactId>
@@ -110,8 +122,6 @@
 					<groupId>com.alibaba</groupId>
 				</exclusion>
 			</exclusions>
-			<groupId>com.microsvc.toolkit.common</groupId>
-			<version>${com.microsvc.toolkit.version}</version>
 		</dependency>
 		<dependency>
 			<groupId>com.yonge.log</groupId>

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/FivePlusGradeEnum.java

@@ -31,6 +31,15 @@ public enum FivePlusGradeEnum implements BaseEnum<Integer, FivePlusGradeEnum> {
 		this.desc = desc;
 	}
 
+	public static FivePlusGradeEnum getByGradeNum(Integer currentGradeNum) {
+		for (FivePlusGradeEnum gradeEnum : FivePlusGradeEnum.values()) {
+			if (gradeEnum.getCode().equals(currentGradeNum)) {
+				return gradeEnum;
+			}
+		}
+		return FivePlusGradeEnum.GRADE1;
+	}
+
 	@Override
 	public Integer getCode() {
 		return code;

+ 30 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/wrapper/MusicSheetWrapper.java

@@ -16,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
+import java.io.Serializable;
 import java.util.Date;
 import java.util.List;
 import java.util.Optional;
@@ -551,4 +552,33 @@ public class MusicSheetWrapper {
         @ApiModelProperty("音频文件")
         private String audioFileUrl;
     }
+
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @ApiModel("总控平台乐器编码")
+    public static class InstrumentCode implements Serializable {
+
+        @ApiModelProperty("主键")
+        private Integer id;
+
+        @ApiModelProperty("名称")
+        private String name;
+
+        @ApiModelProperty("编码")
+        private String code;
+
+        @ApiModelProperty("声部编号")
+        private Integer subjectId;
+
+        @ApiModelProperty("声部")
+        private String subjectName;
+
+        @ApiModelProperty("横竖屏:1:竖 0:横")
+        private Boolean orientation;
+
+        @ApiModelProperty("是否可转普")
+        private Boolean transferFlag;
+    }
 }

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

@@ -9,8 +9,6 @@ import com.ym.mec.biz.dal.page.ActivityUserQueryInfo;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
-import org.apache.ibatis.annotations.Param;
-import org.snaker.engine.access.Page;
 
 import java.math.BigDecimal;
 import java.util.List;

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/HfMemberService.java

@@ -1,7 +1,9 @@
 package com.ym.mec.biz.service;
 
 import java.io.File;
+import java.util.Map;
 
+import com.microsvc.toolkit.middleware.payment.common.api.entity.PaymentMerchant;
 import com.ym.mec.biz.dal.entity.HfMember;
 import com.ym.mec.common.service.BaseService;
 import com.ym.mec.thirdparty.adapay.entity.AccountInfo;
@@ -22,7 +24,13 @@ public interface HfMemberService extends BaseService<Integer, HfMember> {
 
     boolean createMember(HfMember member, File file) throws Exception;
 
+    PaymentMerchant.MerchantConfig getMerchantConfig(String paymentVerdor, Integer tenantId);
+
     boolean updateMember(HfMember member, File file) throws Exception;
 
     boolean mergeSettleAccount(String memberId, AccountInfo accountInfo) throws Exception;
+
+    Map<String, Object> queryWithKey(String appId, String merKey, int pageIndex, long createdGte, long createdLte);
+
+    Map<String, Object> queryConfirmList(String appId, String merchantKey, String paymentId);
 }

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

@@ -7,6 +7,7 @@ import com.ym.mec.biz.dal.dto.ReplacementPayDto;
 import com.ym.mec.biz.dal.entity.ReplacementInstrumentActivity;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.page.ReplacementInstrumentActivityQueryInfo;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
@@ -27,7 +28,7 @@ public interface ReplacementInstrumentActivityService extends BaseService<Intege
      * @return
      * @throws Exception
      */
-    Map pay(ReplacementPayDto replacementPayDto) throws Exception;
+    HttpResponseResult pay(ReplacementPayDto replacementPayDto) throws Exception;
 
     /**
      * 支付回调处理

+ 9 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/StudentPaymentOrderService.java

@@ -1,15 +1,7 @@
 package com.ym.mec.biz.service;
 
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import com.ym.mec.biz.dal.dto.*;
-import com.ym.mec.common.entity.OrderSkuSync;
-import org.apache.ibatis.annotations.Param;
-
 import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
+import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.ActivityUserMapper;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
@@ -23,10 +15,16 @@ import com.ym.mec.biz.dal.vo.StudentPaymentOrderVo;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.entity.MallCreateOrderModel;
 import com.ym.mec.common.entity.OrderCancelModel;
+import com.ym.mec.common.entity.OrderSkuSync;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 import com.ym.mec.thirdparty.adapay.entity.BaseResult;
-import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 public interface StudentPaymentOrderService extends BaseService<Long, StudentPaymentOrder> {
 
@@ -266,7 +264,7 @@ public interface StudentPaymentOrderService extends BaseService<Long, StudentPay
     BaseResult<Map<String, Object>> refund(String orderNo, String notifyUrl, String refundNo);
 
     // 查询优惠券优惠券金额
-    Map couponAmount(MallCreateOrderModel model);
+    Map<String,Object> couponAmount(MallCreateOrderModel model);
 
     // 订单收货状态更新
     void receive(String orderNo, boolean autoReceive);

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

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.entity.StudentGoodsSell;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.StudentRepair;
 import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
 import com.ym.mec.common.service.BaseService;
@@ -94,7 +95,7 @@ public interface StudentRepairService extends BaseService<Integer, StudentRepair
      * @date 2020/9/16
      * @time 13:47
      */
-    Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception;
+    HttpResponseResult addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception;
 
     /**
      * @param goodsSellId:
@@ -105,7 +106,7 @@ public interface StudentRepairService extends BaseService<Integer, StudentRepair
      * @date 2020/9/16
      * @time 13:47
      */
-    Map studentPaymentGoodsOrder(Integer goodsSellId) throws Exception;
+    HttpResponseResult studentPaymentGoodsOrder(Integer goodsSellId) throws Exception;
 
     /**
      * @param order:

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

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
 import com.ym.mec.biz.dal.entity.SubjectChange;
 import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
 import com.ym.mec.biz.dal.page.SubjectChangeQueryInfo;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
 
@@ -25,7 +26,7 @@ public interface SubjectChangeService extends BaseService<Integer, SubjectChange
      * @param isUseBalancePayment
      * @return
      */
-    Map payChange(SubjectChangeParamDto subjectChangeParamDto) throws Exception;
+    HttpResponseResult payChange(SubjectChangeParamDto subjectChangeParamDto) throws Exception;
 
     /**
      * 添加声部更换

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

@@ -71,4 +71,10 @@ public interface SysMusicScoreService extends BaseService<Integer, SysMusicScore
 
 
     MusicSheetWrapper.ClientMusicSheetInfo queryMusicScoreDetail(MusicSheetWrapper.ClientMusicSheetInfoQuery id);
+
+    /**
+     * 获取所有乐器编码
+     * @return List<MusicSheetWrapper.InstrumentCode>
+     */
+    List<MusicSheetWrapper.InstrumentCode> getAllInstrumentCode();
 }

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

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.microsvc.toolkit.middleware.payment.common.api.entity.PaymentResp;
 import com.ym.mec.biz.dal.dto.TenantOrderRecordDto;
 import com.ym.mec.biz.dal.entity.TenantOrderRecord;
 import com.ym.mec.common.page.PageInfo;
@@ -33,7 +34,7 @@ public interface TenantOrderRecordService extends IService<TenantOrderRecord> {
 
     void rechargeSuccess(TenantOrderRecord record);
 
-    String callback(String orderNo, HttpServletRequest request);
+    void callback(TenantOrderRecord record, PaymentResp paymentResp);
 
 }
 

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

@@ -18,6 +18,7 @@ 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.collections.CollectionUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -128,7 +129,7 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil
             //统计
             pageInfo.setStatInfo(childrenDayReserveDao.childrenStatistics(params));
             //获取乐团在读人数
-            List<String> musicGroupIds = dataList.stream().map(e -> e.getMusicGroupId()).collect(Collectors.toList());
+            List<String> musicGroupIds = dataList.stream().map(ChildrenStatisticsDto::getMusicGroupId).collect(Collectors.toList());
             Map<String, Long> normalNum = MapUtil.convertIntegerMap(studentRegistrationService.countNormalNum(musicGroupIds));
             dataList.forEach(e -> {
                 e.setNormalNum(normalNum.get(e.getMusicGroupId()) == null ? 0 : normalNum.get(e.getMusicGroupId()).intValue());
@@ -180,7 +181,7 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil
         List<ChildrenDayDegreeDetail> details = childrenDayDegreeDetailService.getByUserIdAndStatus(degreePayDto.getUserId(), 1);
 
         //处理关闭订单
-        if (details.size() > 0 && degreePayDto.getRePay()) {
+        if (CollectionUtils.isNotEmpty(details) && degreePayDto.getRePay()) {
             Long orderId = details.get(0).getOrderId();
             StudentPaymentOrder oldOrder = studentPaymentOrderService.get(orderId);
             if (oldOrder != null) {
@@ -220,7 +221,7 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil
             }
             List<ChildrenDayDegreeDetail> hasList = details.stream().filter(e -> e.getType().equals(1)).filter(e -> e.getSubjectId().equals(degreePayDto.getSubject()))
                     .filter(e -> e.getLevel().equals(degreePayDto.getMusicGradeLevel())).collect(Collectors.toList());
-            if (hasList.size() > 0) {
+            if (CollectionUtils.isNotEmpty(hasList)) {
                 throw new BizException("您已报考同声部同等级,请勿重复报考");
             }
 
@@ -233,7 +234,7 @@ public class ChildrenDayReserveServiceImpl extends BaseServiceImpl<Integer, Chil
         if (degreePayDto.getTheoryLevel() != null && degreePayDto.getTheoryLevel() > 0) {
             List<ChildrenDayDegreeDetail> hasList = details.stream().filter(e -> e.getType().equals(2))
                     .filter(e -> e.getLevel().equals(degreePayDto.getTheoryLevel())).collect(Collectors.toList());
-            if (hasList.size() > 0) {
+            if (CollectionUtils.isNotEmpty(hasList)) {
                 throw new BizException("您已报考同等级乐理,请勿重复报考");
             }
         }

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

@@ -2,11 +2,10 @@ package com.ym.mec.biz.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.microsvc.toolkit.middleware.im.ImPluginContext;
-import com.microsvc.toolkit.middleware.im.message.GroupMemberWrapper;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
-import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.microsvc.toolkit.middleware.im.ImPluginContext;
+import com.microsvc.toolkit.middleware.im.message.GroupMemberWrapper;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
@@ -16,7 +15,6 @@ import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.*;
 import com.ym.mec.biz.dal.wrapper.LiveGroupWrapper;
 import com.ym.mec.biz.service.*;
-import com.ym.mec.biz.service.im.ImGroupCoreService;
 import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.dal.BaseDAO;
@@ -42,6 +40,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
+
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.time.*;

+ 52 - 90
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -1,93 +1,53 @@
 package com.ym.mec.biz.service.impl;
 
-import java.io.File;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.stream.Collectors;
-
 import com.microsvc.toolkit.middleware.oss.OssPluginContext;
 import com.microsvc.toolkit.middleware.oss.impl.TencentOssPlugin;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Isolation;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.enums.CertificateTypeEnum;
-import com.ym.mec.biz.dal.dao.EmployeeDao;
-import com.ym.mec.biz.dal.dao.MusicGroupPaymentCalenderDao;
-import com.ym.mec.biz.dal.dao.MusicGroupStudentFeeDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
-import com.ym.mec.biz.dal.dao.SysUserContractsDao;
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.CirculationUser;
 import com.ym.mec.biz.dal.dto.OAFinancialDto;
 import com.ym.mec.biz.dal.dto.StudentInfo;
 import com.ym.mec.biz.dal.entity.CooperationOrgan.OwnershipType;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.MusicGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupPaymentCalender;
-import com.ym.mec.biz.dal.entity.MusicGroupStudentFee;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectPlan;
-import com.ym.mec.biz.dal.entity.Organization;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
-import com.ym.mec.biz.dal.entity.Subject;
-import com.ym.mec.biz.dal.entity.SysUserContracts;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.entity.SysUserContracts.ContractType;
-import com.ym.mec.biz.dal.entity.SysUserTsign;
-import com.ym.mec.biz.dal.entity.TenantConfig;
-import com.ym.mec.biz.dal.entity.TenantContractTemplate;
-import com.ym.mec.biz.dal.entity.TenantInfo;
-import com.ym.mec.biz.dal.entity.VipGroup;
 import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
 import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
-import com.ym.mec.biz.service.ContractService;
-import com.ym.mec.biz.service.GoodsService;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.MusicGroupSubjectGoodsGroupService;
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
-import com.ym.mec.biz.service.OrganizationService;
-import com.ym.mec.biz.service.StudentRegistrationService;
-import com.ym.mec.biz.service.SubjectService;
-import com.ym.mec.biz.service.SysUserContractsService;
-import com.ym.mec.biz.service.SysUserTsignService;
-import com.ym.mec.biz.service.TenantConfigService;
-import com.ym.mec.biz.service.TenantContractTemplateService;
-import com.ym.mec.biz.service.TenantInfoService;
-import com.ym.mec.biz.service.VipGroupService;
+import com.ym.mec.biz.service.*;
+import com.ym.mec.common.dto.RealnameAuthenticationDto;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.thirdparty.eseal.ESealPlugin;
 import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
-import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.freemarker.FreemarkerTemplateEngine;
 import com.ym.mec.util.money.MoneyUtil;
 import com.ym.mec.util.pdf.PDFUtil;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import javax.annotation.PostConstruct;
+import java.io.File;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class ContractServiceImpl implements ContractService {
@@ -246,11 +206,13 @@ public class ContractServiceImpl implements ContractService {
             }
 
             if (CertificateTypeEnum.IDENTITY.getCode().equals(user.getCertificateType())) {
-                if (!debugMode) {
+                // 取消第三方实名认证
+                RealnameAuthenticationDto.verify(realName, idCardNo);
+                /*if (!debugMode) {
                     realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(realName, idCardNo);
-                }
+                }*/
 
-                accountId = eSealPlugin.createUserAccount(realName, idCardNo, mobileNo);
+                /*accountId = eSealPlugin.createUserAccount(realName, idCardNo, mobileNo);
 
                 if (StringUtils.isBlank(accountId)) {
                     throw new BizException("创建电子存证账户失败");
@@ -260,7 +222,7 @@ public class ContractServiceImpl implements ContractService {
 
                 if (StringUtils.isBlank(sealData)) {
                     throw new BizException("创建电子存证印章失败");
-                }
+                }*/
             }
 
             sysUserTsign = new SysUserTsign(userId, accountId, sealData, realName, idCardNo, user.getTenantId());
@@ -310,9 +272,9 @@ public class ContractServiceImpl implements ContractService {
             throw new BizException("生成pdf协议失败", e);
         }
 
-        if (sysUserTsign != null) {
+        /*if (sysUserTsign != null) {
             eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-        }
+        }*/
 
         Date date = new Date();
         // 上传到oss
@@ -450,7 +412,7 @@ public class ContractServiceImpl implements ContractService {
         } catch (IOException e) {
             throw new BizException("生成pdf协议失败", e);
         }
-        String organCode = "";
+        /*String organCode = "";
         if (musicGroup.getOwnershipType() == OwnershipType.OWN) {
             organCode = "91440300326364429H";
         } else {
@@ -464,7 +426,7 @@ public class ContractServiceImpl implements ContractService {
         eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
         if (sysUserTsign != null) {
             eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-        }
+        }*/
 
         // 上传到oss
         String dateStrOss = dateFormatOss.format(date);
@@ -631,7 +593,7 @@ public class ContractServiceImpl implements ContractService {
         } catch (IOException e) {
             throw new BizException("生成pdf协议失败", e);
         }
-        String organCode = "91440300326364429H";
+        /*String organCode = "91440300326364429H";
         SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
         if (organTsign == null) {
             throw new BizException("甲方未创建签章");
@@ -641,7 +603,7 @@ public class ContractServiceImpl implements ContractService {
 
         if (sysUserTsign != null) {
             eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-        }
+        }*/
 
         // 上传到oss
         String dateStrOss = dateFormatOss.format(date);
@@ -875,7 +837,7 @@ public class ContractServiceImpl implements ContractService {
         } catch (IOException e) {
             throw new BizException("生成pdf协议失败", e);
         }
-        String organCode = "91440300326364429H";
+        /*String organCode = "91440300326364429H";
         SysUserTsign organTsign = sysUserTsignService.queryByCardNo(organCode);
         if (organTsign == null) {
             throw new BizException("甲方未创建签章");
@@ -885,7 +847,7 @@ public class ContractServiceImpl implements ContractService {
 
         if (sysUserTsign != null) {
             eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-        }
+        }*/
 
         // 上传到oss
         String dateStrOss = dateFormatOss.format(date);
@@ -929,12 +891,12 @@ public class ContractServiceImpl implements ContractService {
 
         SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
         if (sysUserTsign == null) {
-            try {
-                sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
+            sysUserTsign = register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
+            /*try {
             } catch (Exception e) {
                 logger.error("用户电子签章注册失败", e);
                 return;
-            }
+            }*/
         }
         Date date = new Date();
 
@@ -1026,7 +988,7 @@ public class ContractServiceImpl implements ContractService {
             return;
         }
 
-        String organCode = StringUtils.equals(companyName, tenantInfo.getTsignName()) ? tenantInfo.getTsignCode() : organizationDto.getCorporateCode();
+        /*String organCode = StringUtils.equals(companyName, tenantInfo.getTsignName()) ? tenantInfo.getTsignCode() : organizationDto.getCorporateCode();
         
 		if (user.getTenantId() == 1) {
 			if (!OwnershipType.OWN.name().equals(params.get("ownershipType"))) {
@@ -1042,7 +1004,7 @@ public class ContractServiceImpl implements ContractService {
         eSealPlugin.organSign(organTsign.getSealData(), srcPdfPath, srcPdfPath);
         if (sysUserTsign != null && CertificateTypeEnum.IDENTITY.getCode().equals(user.getCertificateType())) {
             eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), srcPdfPath, srcPdfPath);
-        }
+        }*/
 
         // 上传到oss
         String dateStrOss = dateFormatOss.format(date);
@@ -1181,7 +1143,7 @@ public class ContractServiceImpl implements ContractService {
         List<SysUser> users = employeeDao.getUsers(circulationUserIds);
 
         Integer workOrderId = null;
-        List<SysUserTsign> sysUserTsigns = new ArrayList<>();
+//        List<SysUserTsign> sysUserTsigns = new ArrayList<>();
         for (SysUser user : users) {
             for (CirculationUser circulationUser : financialDto.getCirculationUsers()) {
                 if (workOrderId == null) {
@@ -1196,14 +1158,14 @@ public class ContractServiceImpl implements ContractService {
             }
             SysUserTsign sysUserTsign = sysUserTsignService.get(user.getId());
             if (sysUserTsign == null) {
-                try {
-                    sysUserTsign = register(user.getId(), user.getRealName(), user.getIdCardNo(), user.getPhone());
+                sysUserTsign = register(user.getId(), user.getRealName(), user.getIdCardNo(), user.getPhone());
+                /*try {
                 } catch (Exception e) {
                     logger.error("用户电子签章注册失败", e);
                     continue;
-                }
+                }*/
             }
-            sysUserTsigns.add(sysUserTsign);
+//            sysUserTsigns.add(sysUserTsign);
         }
 
         Date date = new Date();
@@ -1242,9 +1204,9 @@ public class ContractServiceImpl implements ContractService {
             logger.error("生成签章协议失败", e);
         }
 
-        for (SysUserTsign sysUserTsign : sysUserTsigns) {
+        /*for (SysUserTsign sysUserTsign : sysUserTsigns) {
             eSealPlugin.userSign(sysUserTsign.getAccountId(), sysUserTsign.getSealData(), sysUserTsign.getUserId().toString(), srcPdfPath, srcPdfPath);
-        }
+        }*/
 
         //上传到oss
         String dateStrOss = dateFormatOss.format(date);

+ 5 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

@@ -171,6 +171,8 @@ public class ExportServiceImpl implements ExportService {
     @Resource
     private StudentCourseConsumerService studentCourseConsumerService;
     @Resource
+    private HfMemberService hfMemberService;
+    @Resource
     private TeacherCloudCourseReportService teacherCloudCourseReportService;
     @Resource
     private OssPluginContext ossPluginContext;
@@ -690,14 +692,14 @@ public class ExportServiceImpl implements ExportService {
         long createdLte = DateUtil.getLastSecondWithDay(endTime).getTime();
         int pageIndex = 1;
         List<Map<String, Object>> data = new ArrayList<>();
-        while ("prod".equals(profiles)) {
+        while ("prod".equals(profiles) || "pre".equals(profiles)) {
             Map<String, Object> paymentList = null;
             HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(TenantContextHolder.getTenantId(), PaymentChannelEnum.ADAPAY.getCode());
             if (hfMerchantConfig == null) {
                 throw new BizException("机构[{}]汇付商户信息找不到", TenantContextHolder.getTenantId());
             }
             try {
-                paymentList = Payment.queryList(hfMerchantConfig.getAppId(), hfMerchantConfig.getMerKey(), pageIndex, createdGte, createdLte);
+                paymentList = hfMemberService.queryWithKey(hfMerchantConfig.getAppId(), hfMerchantConfig.getMerKey(), pageIndex, createdGte, createdLte);
             } catch (Exception e) {
                 e.printStackTrace();
             }
@@ -732,7 +734,7 @@ public class ExportServiceImpl implements ExportService {
                         if (!paymentMap.containsKey("payment_confirms")) {
                             Map<String, Object> confirmMap = null;
                             try {
-                                confirmMap = Payment.queryConfirmList(hfMerchantConfig.getAppId(), hfMerchantConfig.getMerKey(), paymentMap.get("id").toString());
+                                confirmMap = hfMemberService.queryConfirmList(hfMerchantConfig.getAppId(), hfMerchantConfig.getMerKey(), paymentMap.get("id").toString());
                             } catch (Exception e) {
                                 e.printStackTrace();
                             }

+ 233 - 43
mec-biz/src/main/java/com/ym/mec/biz/service/impl/HfMemberServiceImpl.java

@@ -1,16 +1,10 @@
 package com.ym.mec.biz.service.impl;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
+import com.alibaba.fastjson.JSON;
+import com.huifu.adapay.core.exception.BaseAdaPayException;
+import com.microsvc.toolkit.middleware.payment.common.api.BasePaymentService;
+import com.microsvc.toolkit.middleware.payment.common.api.PaymentServiceContext;
+import com.microsvc.toolkit.middleware.payment.common.api.entity.PaymentMerchant;
 import com.ym.mec.biz.dal.config.AdapayNotifyConstants;
 import com.ym.mec.biz.dal.dao.HfMemberDao;
 import com.ym.mec.biz.dal.dto.YeepayMember;
@@ -21,37 +15,40 @@ import com.ym.mec.biz.service.HfMerchantConfigService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.adapay.CorpMemberService;
 import com.ym.mec.thirdparty.adapay.SettleAccountService;
 import com.ym.mec.thirdparty.adapay.entity.AccountInfo;
 import com.ym.mec.thirdparty.adapay.entity.EnterpriseUser;
 import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
-import com.ym.mec.thirdparty.yeepay.YeepayMerchantService;
-import com.ym.mec.thirdparty.yeepay.entity.MerchantInfo;
+import com.ym.mec.thirdparty.exception.ThirdpartyException;
 import com.ym.mec.util.string.MessageFormatter;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.io.File;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
 @Service
+@Slf4j
 public class HfMemberServiceImpl extends BaseServiceImpl<Integer, HfMember> implements HfMemberService {
 	
-    @Autowired
+    @Resource
     private HfMemberDao hfMemberDao;
-    
-    @Autowired
-    private SettleAccountService settleAccountService;
-    
-    @Autowired
-    private CorpMemberService corpMemberService;
-    
-    @Autowired
+    @Resource
     private HfMerchantConfigService hfMerchantConfigService;
-    
-    @Autowired
-    private YeepayMerchantService yeepayMerchantService;
+    @Resource
+    private PaymentServiceContext paymentServiceContext;
 
     @Value("${spring.profiles.active:dev}")
     private String env;
 
-	private String cardName;
 
     @Override
     public BaseDAO<Integer, HfMember> getDAO() {
@@ -84,7 +81,21 @@ public class HfMemberServiceImpl extends BaseServiceImpl<Integer, HfMember> impl
         if (hasMember != null) {
             throw new BizException("公司名与已有公司名相同,请核查");
         }
-        
+        BasePaymentService paymentService = paymentServiceContext.getPaymentService(member.getPayerName() + "_" + member.getTenantId());
+        if (paymentService == null) {
+            throw new BizException("支付渠道不存在:{}", member.getPayerName());
+        }
+        PaymentMerchant.MerchantConfig merchantConfig = getMerchantConfig(member.getPayerName() + "_" + member.getTenantId(),member.getTenantId());
+        PaymentMerchant.MerchantMember merchantMember = getHfMerchantMember(member);
+        merchantMember.setAttachFile(file);
+        try {
+            log.info("创建子账户参数:{}", JSON.toJSONString(merchantMember));
+            paymentService.createPaymentCorpMember(merchantConfig, merchantMember);
+        }catch (Exception e) {
+            log.error("创建子账户失败", e);
+            throw new BizException("创建子账户失败:" + e.getMessage());
+        }
+/*
         switch (PaymentChannelEnum.codeOf(member.getPayerName())) {
 		case ADAPAY:
 			createMemberWithAdapay(member, file);
@@ -99,7 +110,7 @@ public class HfMemberServiceImpl extends BaseServiceImpl<Integer, HfMember> impl
 		default:
 			
 			return false;
-		}
+		}*/
 
         Date nowDate = new Date();
         member.setCreateTime(nowDate);
@@ -111,14 +122,133 @@ public class HfMemberServiceImpl extends BaseServiceImpl<Integer, HfMember> impl
     }
 
     @Override
+    public PaymentMerchant.MerchantConfig getMerchantConfig(String paymentVerdor, Integer tenantId) {
+        HfMerchantConfig merchantConfig = hfMerchantConfigService.queryByTenantId(tenantId,paymentVerdor);
+        if (merchantConfig == null) {
+            throw new BizException("机构[{}]商户信息找不到", tenantId);
+        }
+        return PaymentMerchant.MerchantConfig.builder()
+                .payerName(paymentVerdor)
+                .appId(merchantConfig.getAppId())
+                .merchantKey(merchantConfig.getMerKey())
+                .apiKey(merchantConfig.getApiKey())
+                .rsaPrivateKey(merchantConfig.getRsaPrivateKey())
+                .rsaPublicKey(merchantConfig.getRsaPublicKey())
+                .wxAppId(merchantConfig.getWxAppId())
+                .wxAppSecret(merchantConfig.getWxAppSecret())
+                .alipayAppId(merchantConfig.getAlipayAppId())
+                .alipayPublicKey(merchantConfig.getAlipayPublicKey())
+                .platformPayeeMemberId(merchantConfig.getPlatformPayeeMemberId())
+                .build();
+    }
+
+    private PaymentMerchant.MerchantMember getHfMerchantMember(HfMember tenantMember) {
+        if (StringUtils.equalsIgnoreCase(tenantMember.getPayerName(), PaymentChannelEnum.ADAPAY.getCode())) {
+            PaymentMerchant.MerchantMember merchantMember = PaymentMerchant.MerchantMember.builder()
+                    .memberId(tenantMember.getMemberId())
+                    .merchantName(tenantMember.getName())
+                    .provinceCode(tenantMember.getProvCode())
+                    .cityCode(tenantMember.getAreaCode())
+                    .districtCode(tenantMember.getDistrictCode())
+                    .socialCreditCode(tenantMember.getSocialCreditCode())
+                    .socialCreditCodeExpires(tenantMember.getSocialCreditCodeExpires())
+                    .businessScope(tenantMember.getBusinessScope())
+                    .legalName(tenantMember.getLegalPerson())
+                    .legalLicenceNo(tenantMember.getLegalCertId())
+                    .legalCertIdExpires(tenantMember.getLegalCertIdExpires())
+                    .mobile(tenantMember.getLegalMp())
+                    .legalLicenceType(tenantMember.getLegalLicenceType())
+                    .address(tenantMember.getAddress())
+                    .bankCode(tenantMember.getBankCode())
+                    .bankAccountType(tenantMember.getBankAcctType())
+                    .bankCardNo(tenantMember.getCardNo())
+                    .cardName(tenantMember.getCardName())
+                    .zipCode(tenantMember.getZipCode())
+                    .requestNo(tenantMember.getRequestNo())
+                    .licenceNo(tenantMember.getSocialCreditCode())
+                    .contactName(tenantMember.getContactName())
+                    .contactMobile(tenantMember.getContactMobile())
+                    .contactEmail(tenantMember.getContactEmail())
+                    .contactLicenceNo(tenantMember.getContactLicenceNo())
+                    .primaryIndustryCategory("120")
+                    .secondaryIndustryCategory("120004")
+                    .settlementDirection("BANKCARD")
+                    .build();
+            if (StringUtils.equals(env, "prod") || StringUtils.equals(env, "pre")) {
+                merchantMember.setNotifyUrl(MessageFormatter.arrayFormat(AdapayNotifyConstants.corp_member_notify_url_prod, "adapay"));
+            } else {
+                merchantMember.setNotifyUrl(MessageFormatter.arrayFormat(AdapayNotifyConstants.corp_member_notify_url_test, "adapay"));
+            }
+            return merchantMember;
+        } else {
+            YeepayMember yeepayMember = (YeepayMember) tenantMember;
+            PaymentMerchant.MerchantMember merchantMember = PaymentMerchant.MerchantMember.builder()
+                    .memberId(yeepayMember.getMemberId())
+                    .merchantName(yeepayMember.getName())
+                    .merchantType(yeepayMember.getMerchantType())
+                    .provinceCode(yeepayMember.getProvCode())
+                    .cityCode(yeepayMember.getAreaCode())
+                    .districtCode(yeepayMember.getDistrictCode())
+                    .socialCreditCode(yeepayMember.getSocialCreditCode())
+                    .socialCreditCodeExpires(yeepayMember.getSocialCreditCodeExpires())
+                    .businessScope(yeepayMember.getBusinessScope())
+                    .legalName(yeepayMember.getLegalPerson())
+                    .legalLicenceNo(yeepayMember.getLegalCertId())
+                    .legalCertIdExpires(yeepayMember.getLegalCertIdExpires())
+                    .mobile(yeepayMember.getLegalMp())
+                    .legalLicenceType(yeepayMember.getLegalLicenceType())
+                    .legalLicenceFrontUrl(yeepayMember.getLegalLicenceFrontUrl())
+                    .legalLicenceBackUrl(yeepayMember.getLegalLicenceBackUrl())
+                    .address(yeepayMember.getAddress())
+                    .bankCode(yeepayMember.getBankCode())
+                    .bankAccountType(yeepayMember.getBankAcctType())
+                    .bankCardNo(yeepayMember.getCardNo())
+                    .cardName(yeepayMember.getCardName())
+                    .zipCode(yeepayMember.getZipCode())
+                    .requestNo(yeepayMember.getRequestNo())
+                    .licenceNo(yeepayMember.getSocialCreditCode())
+                    .licenceUrl(yeepayMember.getLicenceUrl())
+                    .openAccountLicenceUrl(yeepayMember.getOpenAccountLicenceUrl())
+                    .contactName(yeepayMember.getContactName())
+                    .contactMobile(yeepayMember.getContactMobile())
+                    .contactEmail(yeepayMember.getContactEmail())
+                    .contactLicenceNo(yeepayMember.getContactLicenceNo())
+                    .primaryIndustryCategory("120")
+                    .secondaryIndustryCategory("120004")
+                    .settlementDirection("BANKCARD")
+                    .build();
+            String notifyURL = MessageFormatter.arrayFormat(AdapayNotifyConstants.corp_member_notify_url_test, "yeepay");
+            if (StringUtils.equals(env, "prod") || StringUtils.equals(env, "pre")) {
+                notifyURL = MessageFormatter.arrayFormat(AdapayNotifyConstants.corp_member_notify_url_prod, "yeepay");
+            }
+            merchantMember.setNotifyUrl(notifyURL);
+            return merchantMember;
+        }
+    }
+
+    @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean updateMember(HfMember member, File file) throws Exception {
         HfMember hfMember = hfMemberDao.get(member.getId());
         if (hfMember == null) {
             throw new BizException("商户不存在请核对");
         }
+        BasePaymentService paymentService = paymentServiceContext.getPaymentService(member.getPayerName() + "_" + member.getTenantId());
+        if (paymentService == null) {
+            throw new BizException("支付渠道不存在:{}", member.getPayerName());
+        }
+        PaymentMerchant.MerchantConfig merchantConfig = getMerchantConfig(member.getPayerName() + "_" + member.getTenantId(),member.getTenantId());
+        PaymentMerchant.MerchantMember merchantMember = getHfMerchantMember(member);
+        merchantMember.setAttachFile(file);
+        try {
+            log.info("更新商户信息失败:{}", JSON.toJSONString(merchantMember));
+            paymentService.updatePaymentCorpMember(merchantConfig, merchantMember);
+        }catch (Exception e) {
+            log.error("更新商户信息失败", e);
+            throw new BizException("更新商户信息失败:" + e.getMessage());
+        }
+        /*Integer tenantId = member.getTenantId();
 
-        Integer tenantId = member.getTenantId();
         
         HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(tenantId, member.getPayerName());
         if(hfMerchantConfig == null){
@@ -141,7 +271,7 @@ public class HfMemberServiceImpl extends BaseServiceImpl<Integer, HfMember> impl
         enterpriseUser.setMemberId(member.getMemberId());
         enterpriseUser.setName(member.getName());
         
-        if(StringUtils.equals(env, "prod")){
+        if(StringUtils.equals(env, "prod") || StringUtils.equals(env, "pre")){
             enterpriseUser.setNotifyUrl(AdapayNotifyConstants.corp_member_notify_url_prod);
         }else {
             enterpriseUser.setNotifyUrl(AdapayNotifyConstants.corp_member_notify_url_test);
@@ -152,7 +282,7 @@ public class HfMemberServiceImpl extends BaseServiceImpl<Integer, HfMember> impl
         enterpriseUser.setSocialCreditCodeExpires(member.getSocialCreditCodeExpires());
         
         corpMemberService.update(hfMerchantConfig.getMerKey(), hfMerchantConfig.getAppId(), enterpriseUser, enterpriseUser.getNotifyUrl());
-
+*/
         Date nowDate = new Date();
         member.setUpdateTime(nowDate);
         member.setStatus("pending");
@@ -170,11 +300,6 @@ public class HfMemberServiceImpl extends BaseServiceImpl<Integer, HfMember> impl
         if (!hfMember.getStatus().equals("succeeded")) {
             throw new BizException("商户审核通过,才能绑定结算卡");
         }
-        /*hfMember.setCardNo(accountInfo.getCardId());
-        hfMember.setBankCode(accountInfo.getBankCode());
-        hfMember.setBankAcctType(accountInfo.getBankAcctType());
-        hfMember.setCardName(accountInfo.getCardName());*/
-        
         accountInfo.setAreaCode(hfMember.getAreaCode());
         accountInfo.setBankAcctType(hfMember.getBankAcctType());
         accountInfo.setBankCode(hfMember.getBankCode());
@@ -191,22 +316,87 @@ public class HfMemberServiceImpl extends BaseServiceImpl<Integer, HfMember> impl
         if(hfMerchantConfig == null){
         	throw new BizException("机构[{}]汇付商户信息找不到", tenantId);
         }
+        BasePaymentService paymentService = paymentServiceContext.getPaymentService(PaymentChannelEnum.ADAPAY.getCode() + "_" + TenantContextHolder.getTenantId());
+        if (paymentService == null) {
+            throw new BizException("支付渠道不存在:{}", PaymentChannelEnum.ADAPAY.getCode() + "_" + TenantContextHolder.getTenantId());
+        }
 
         //删除结算账户
         if (StringUtils.isNotBlank(hfMember.getSettleAccountId())) {
-            settleAccountService.delete(hfMerchantConfig.getMerKey(), hfMerchantConfig.getAppId(), memberId, hfMember.getSettleAccountId());
+//            settleAccountService.delete(hfMerchantConfig.getMerKey(), hfMerchantConfig.getAppId(), memberId, hfMember.getSettleAccountId());
+            paymentService.deleteSettleAccount(hfMerchantConfig.getMerKey(), hfMerchantConfig.getAppId(), memberId, hfMember.getSettleAccountId());
         }
 
         //创建结算账户
-        String settleAccountId = settleAccountService.create(hfMerchantConfig.getMerKey(), hfMerchantConfig.getAppId(), accountInfo);
+//        String settleAccountId = settleAccountService.create(hfMerchantConfig.getMerKey(), hfMerchantConfig.getAppId(), accountInfo);
+        PaymentMerchant.MerchantConfig merchantConfig = getMerchantConfig(PaymentChannelEnum.ADAPAY.getCode(), TenantContextHolder.getTenantId());
+        String settleAccount = paymentService.createSettleAccount(merchantConfig, getAccountInfo(accountInfo));
 
-        hfMember.setSettleAccountId(settleAccountId);
+        hfMember.setSettleAccountId(settleAccount);
         if (hfMemberDao.update(hfMember) <= 0) {
             throw new BizException("绑卡失败,请重试");
         }
         return true;
     }
-    
+
+    private PaymentMerchant.AccountInfo getAccountInfo(AccountInfo accountInfo) {
+        return PaymentMerchant.AccountInfo.builder()
+                .memberId(accountInfo.getMemberId())
+                .cardId(accountInfo.getCardId())
+                .cardName(accountInfo.getCardName())
+                .certId(accountInfo.getCertId())
+                .certType(accountInfo.getCertType())
+                .telNo(accountInfo.getTelNo())
+                .bankCode(accountInfo.getBankCode())
+                .bankName(accountInfo.getBankName())
+                .bankAcctType(accountInfo.getBankAcctType())
+                .provCode(accountInfo.getProvCode())
+                .areaCode(accountInfo.getAreaCode())
+                .build();
+    }
+
+    @Override
+    public Map<String, Object> queryWithKey(String appId, String merKey, int pageIndex, long createdGte, long createdLte) {
+        Map<java.lang.String, java.lang.Object> paymentParams = new HashMap<>();
+        paymentParams.put("app_id", appId);
+        paymentParams.put("page_index", pageIndex);
+        paymentParams.put("page_size", "20");
+        paymentParams.put("created_gte", createdGte);
+        paymentParams.put("created_lte", createdLte);
+        Map<String, Object> payment = null;
+        try {
+            payment = com.huifu.adapay.model.Payment.queryList(paymentParams, merKey);
+        } catch (BaseAdaPayException e) {
+            throw new BizException("查询支付对象列表失败:{}", e, e.getMessage());
+        }
+        String error_code = (String) payment.get("error_code");
+        if (null != error_code) {
+            String errorMsg = (String) payment.get("error_msg");
+            throw new ThirdpartyException(errorMsg);
+        }
+        return payment;
+    }
+
+    @Override
+    public Map<String, Object> queryConfirmList(String appId, String merchantKey, String paymentId){
+        Map<String, Object> paymentParams = new HashMap<>();
+        paymentParams.put("app_id", appId);
+        paymentParams.put("payment_id", paymentId);
+
+        Map<String, Object> payment = null;
+        try {
+            payment = com.huifu.adapay.model.Payment.queryConfirmList(paymentParams, merchantKey);
+        } catch (BaseAdaPayException e) {
+            throw new BizException("查询支付确认列表失败:{}", e, e.getMessage());
+        }
+        String error_code = (String) payment.get("error_code");
+        if (null != error_code) {
+            String errorMsg = (String) payment.get("error_msg");
+            throw new ThirdpartyException(errorMsg);
+        }
+        return payment;
+    }
+    /*
 	private boolean createMemberWithAdapay(HfMember member, File file) {
 		Integer tenantId = member.getTenantId();
 
@@ -231,7 +421,7 @@ public class HfMemberServiceImpl extends BaseServiceImpl<Integer, HfMember> impl
 		enterpriseUser.setMemberId(member.getMemberId());
 		enterpriseUser.setName(member.getName());
 
-		if (StringUtils.equals(env, "prod")) {
+		if (StringUtils.equals(env, "prod") || StringUtils.equals(env, "pre")) {
 			enterpriseUser.setNotifyUrl(MessageFormatter.arrayFormat(AdapayNotifyConstants.corp_member_notify_url_prod, "adapay"));
 		} else {
 			enterpriseUser.setNotifyUrl(MessageFormatter.arrayFormat(AdapayNotifyConstants.corp_member_notify_url_test, "adapay"));
@@ -276,10 +466,10 @@ public class HfMemberServiceImpl extends BaseServiceImpl<Integer, HfMember> impl
 		merchantInfo.setSettlementDirection("BANKCARD");
 
 		String notifyURL = MessageFormatter.arrayFormat(AdapayNotifyConstants.corp_member_notify_url_test, "yeepay");
-		if (StringUtils.equals(env, "prod")) {
+		if (StringUtils.equals(env, "prod") || StringUtils.equals(env, "pre")) {
 			notifyURL = MessageFormatter.arrayFormat(AdapayNotifyConstants.corp_member_notify_url_prod, "yeepay");
 		}
 		
 		return yeepayMerchantService.registerSaasMerchantV2(hfMerchantConfig, merchantInfo, notifyURL);
-	}
+	}*/
 }

+ 89 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/HfMerchantConfigServiceImpl.java

@@ -1,32 +1,108 @@
 package com.ym.mec.biz.service.impl;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
+import com.google.common.collect.Lists;
+import com.microsvc.toolkit.middleware.payment.common.api.PaymentServiceContext;
+import com.microsvc.toolkit.middleware.payment.impl.AdapayPaymentServicePlugin;
+import com.microsvc.toolkit.middleware.payment.impl.YeepayPaymentServicePlugin;
+import com.microsvc.toolkit.middleware.payment.properties.PayConfigProperties;
 import com.ym.mec.biz.dal.dao.HfMerchantConfigDao;
-import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.biz.service.HfMerchantConfigService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
-import com.ym.mec.thirdparty.adapay.AdapayInit;
 import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
 
+@Slf4j
 @Service
-public class HfMerchantConfigServiceImpl extends BaseServiceImpl<Integer, HfMerchantConfig>  implements HfMerchantConfigService,InitializingBean {
+public class HfMerchantConfigServiceImpl extends BaseServiceImpl<Integer, HfMerchantConfig>  implements HfMerchantConfigService {
 	
-	@Autowired
+	@Resource
 	private HfMerchantConfigDao hfMerchantConfigDao;
+	@Resource
+	private PayConfigProperties properties;
 
 	@Override
 	public BaseDAO<Integer, HfMerchantConfig> getDAO() {
 		return hfMerchantConfigDao;
 	}
 
-	@Override
+	@PostConstruct
+	public void init(){
+		List<HfMerchantConfig> list = hfMerchantConfigDao.findAll(new HashMap<>());
+
+		if(CollectionUtils.isEmpty(list)) {
+			return;
+		}
+
+		List<String> pluginNames = Lists.newArrayList();
+		for (HfMerchantConfig config : list) {
+			if (StringUtils.isEmpty(config.getPayerName())) {
+				log.error("数据错误 {}", config);
+			} else if (StringUtils.equalsIgnoreCase(config.getPayerName(),"ADAPAY")) {
+				PayConfigProperties.AdapayPayConfig adapayPayConfig = new PayConfigProperties.AdapayPayConfig();
+				adapayPayConfig.setEnable(true);
+				adapayPayConfig.setAppId(config.getAppId());
+				adapayPayConfig.setPayType(config.getPayerName() + "_" + config.getTenantId());
+				adapayPayConfig.setMerchantKey(config.getMerKey());
+				adapayPayConfig.setMerchantId(config.getApiKey());
+				adapayPayConfig.setPayNotifyUrl(properties.getPayNotifyUrl());
+				adapayPayConfig.setRefundNotifyUrl(properties.getRefundNotifyUrl());
+				adapayPayConfig.setKeyPublic(config.getRsaPublicKey());
+				adapayPayConfig.setKeyPrivate(config.getRsaPrivateKey());
+				adapayPayConfig.setWxAppId(config.getWxAppId());
+				adapayPayConfig.setWxAppSecret(config.getWxAppSecret());
+//				adapayPayConfig.setMiniAppId(config.getMiniAppId());
+//				adapayPayConfig.setMiniAppSecret(config.getMiniAppSerret());
+				adapayPayConfig.setSupportCreditCards(properties.getSupportCreditCards());
+				try {
+					AdapayPaymentServicePlugin plugin = new AdapayPaymentServicePlugin(adapayPayConfig.getPayType(), adapayPayConfig, false);
+					PaymentServiceContext.addPlugin(plugin);
+					pluginNames.add(plugin.venderName());
+				} catch (Exception e) {
+					log.error("初始[汇付]化支付插件失败", e);
+				}
+			} else if (StringUtils.equalsIgnoreCase(config.getPayerName(),"YEEPAY")){
+				PayConfigProperties.YeepayPayConfig yeepayPayConfig = new PayConfigProperties.YeepayPayConfig();
+				yeepayPayConfig.setEnable(true);
+				yeepayPayConfig.setAppId(config.getAppId());
+				yeepayPayConfig.setPayType(config.getPayerName() + "_" + config.getTenantId());
+				yeepayPayConfig.setMerchantId(config.getPlatformPayeeMemberId());
+				yeepayPayConfig.setPayNotifyUrl(properties.getPayNotifyUrl());
+				yeepayPayConfig.setRefundNotifyUrl(properties.getRefundNotifyUrl());
+				yeepayPayConfig.setKeyPublic(config.getRsaPublicKey());
+				yeepayPayConfig.setKeyPrivate(config.getRsaPrivateKey());
+				yeepayPayConfig.setWxAppId(config.getWxAppId());
+				yeepayPayConfig.setWxAppSecret(config.getWxAppSecret());
+				yeepayPayConfig.setSupportCreditCards(properties.getSupportCreditCards());
+				yeepayPayConfig.setAlipayAppId(config.getAlipayAppId());
+				yeepayPayConfig.setAlipayPrivateKey(config.getAlipayPrivateKey());
+				yeepayPayConfig.setAlipayPublicKey(config.getAlipayPublicKey());
+//				yeepayPayConfig.setMiniAppId(config.getMiniAppId());
+//				yeepayPayConfig.setMiniAppSecret(config.getMiniAppSerret());
+				try {
+					YeepayPaymentServicePlugin plugin = new YeepayPaymentServicePlugin(yeepayPayConfig.getPayType(), yeepayPayConfig, false);
+					PaymentServiceContext.addPlugin(plugin);
+
+					pluginNames.add(plugin.venderName());
+				} catch (Exception e) {
+					log.error("初始化[易宝]支付插件失败", e);
+				}
+			}else {
+				log.error("数据错误 {}", config);
+			}
+		}
+		log.info("初始化支付插件完成, plugins={}", pluginNames);
+	}
+
+	/*@Override
 	public void afterPropertiesSet() throws Exception {
 		AdapayInit adapayInit = AdapayInit.getInstance(false, true);
 		
@@ -34,7 +110,7 @@ public class HfMerchantConfigServiceImpl extends BaseServiceImpl<Integer, HfMerc
 		params.put("payerName", PaymentChannelEnum.ADAPAY.getCode());
 		
 		adapayInit.initWithMerConfig(hfMerchantConfigDao.findAll(params));
-	}
+	}*/
 
 	@Override
 	public HfMerchantConfig queryByTenantId(Integer tenantId, String payerName) {

+ 66 - 49
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MemberRankSettingServiceImpl.java

@@ -5,6 +5,10 @@ import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.common.collect.Lists;
+import com.microsvc.toolkit.middleware.payment.common.api.BasePaymentService;
+import com.microsvc.toolkit.middleware.payment.common.api.PaymentServiceContext;
+import com.microsvc.toolkit.middleware.payment.common.api.entity.PaymentResp;
+import com.microsvc.toolkit.middleware.payment.common.api.enums.PaymentStatus;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
@@ -23,8 +27,6 @@ import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
-import com.ym.mec.thirdparty.adapay.Payment;
-import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
@@ -36,7 +38,6 @@ 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.context.annotation.Lazy;
 import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
@@ -55,91 +56,91 @@ import static com.ym.mec.biz.dal.enums.CouponDetailTypeEnum.MEMBER;
 @Service
 public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, MemberRankSetting> implements MemberRankSettingService {
 
-    @Autowired
+    @Resource
     private MemberRankSettingDao memberRankSettingDao;
-    @Autowired
+    @Resource
     private MemberRankPrivilegesDao memberRankPrivilegesDao;
-    @Autowired
+    @Resource
     private StudentService studentService;
-    @Autowired
+    @Resource
     private StudentPaymentOrderService studentPaymentOrderService;
-    @Autowired
+    @Resource
     private SysUserCashAccountService sysUserCashAccountService;
-    @Autowired
+    @Resource
     private SysUserCashAccountDetailService sysUserCashAccountDetailService;
 
-    @Autowired
+    @Resource
     private LessonCoursewareService lessonCoursewareService;
 
-    @Autowired
+    @Resource
     private SysUserService sysUserService;
 
     @Resource
     private CbsMusicScoreCategoriesService cbsMusicScoreCategoriesService;
     @Lazy
-    @Autowired
+    @Resource
     private ContractService contractService;
-    @Autowired
+    @Resource
     private SysUserFeignService sysUserFeignService;
-    @Autowired
+    @Resource
     private CloudTeacherOrderService cloudTeacherOrderService;
-    @Autowired
+    @Resource
     private IdGeneratorService idGeneratorService;
-    @Autowired
+    @Resource
     private SysCouponCodeService sysCouponCodeService;
-    @Autowired
+    @Resource
     private StudentCloudCoachPaymentDetailsService studentCloudCoachPaymentDetailsService;
-    @Autowired
+    @Resource
     private CloudCoachPaymentProgramService cloudCoachPaymentProgramService;
-    @Autowired
+    @Resource
     private RedissonClient redissonClient;
-    @Autowired
+    @Resource
     private SysConfigDao sysConfigDao;
-    @Autowired
+    @Resource
     private SysMessageService sysMessageService;
-    @Autowired
+    @Resource
     private VipGroupActivityDao vipGroupActivityDao;
-    @Autowired
+    @Resource
     private TenantConfigService tenantConfigService;
-    @Autowired
+    @Resource
     private ActivityUserMapperService activityUserMapperService;
-    @Autowired
+    @Resource
     private MemberFeeSettingService memberFeeSettingService;
-    @Autowired
+    @Resource
     private TeacherDao teacherDao;
-    @Autowired
+    @Resource
     private LiveGoodsService liveGoodsService;
-    @Autowired
+    @Resource
     private TempBuyFreeLiveTheoryCourseDao tempBuyFreeLiveTheoryCourseDao;
-    @Autowired
+    @Resource
     private TempLittleArtistTrainingCampUserRelationDao tempLittleArtistTrainingCampUserRelationDao;
-    @Autowired
+    @Resource
     private StudentPaymentOrderDetailDao studentPaymentOrderDetailDao;
 
-    @Autowired
+    @Resource
     private MemberRankCategoryMapperService memberRankCategoryMapperService;
 
-    @Autowired
+    @Resource
     private MemberRankCourseTypeMapperService memberRankCourseTypeMapperService;
     
-    @Autowired
-    private HfMerchantConfigService hfMerchantConfigService;
-
-    @Autowired
+    @Resource
     private SysMusicScoreDao sysMusicScoreDao;
 
-    @Autowired
+    @Resource
     private CloudTeacherOrderDao cloudTeacherOrderDao;
 
-    @Autowired
+    @Resource
     private MusicGroupDao musicGroupDao;
 
-    @Autowired
+    @Resource
     private TenantMemberRankSettingService tenantMemberRankSettingService;
 
-    @Autowired
+    @Resource
     private MemberRankOrganizationFeeMapperDao memberRankOrganizationFeeMapperDao;
 
+    @Resource
+    private PaymentServiceContext paymentServiceContext;
+
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
 
     @Override
@@ -611,10 +612,14 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
     public HttpResponseResult buy2Qqhe(MemberPayParamDto dto) throws Exception {
         //获取学员信息
         SysUser sysUser = getSysUser();
-        if (!dto.getRepeatPay()) {
-            //查询是否有待支付订单
-            List<StudentPaymentOrder> studentPaymentOrders = studentPaymentOrderService.queryByCondition(GroupType.MEMBER,
-                    null, sysUser.getId(), DealStatusEnum.ING, OrderTypeEnum.MEMBER);
+        //查询是否有待支付订单
+        List<StudentPaymentOrder> studentPaymentOrders = studentPaymentOrderService.queryByCondition(GroupType.MEMBER,
+                null, sysUser.getId(), DealStatusEnum.ING, OrderTypeEnum.MEMBER);
+        HttpResponseResult result1 = studentPaymentOrderService.checkRepeatPay(studentPaymentOrders.get(0), dto.getRepeatPay());
+        if (result1.getCode() != 200) {
+            return result1;
+        }
+        /*if (!dto.getRepeatPay()) {
             if (CollectionUtils.isNotEmpty(studentPaymentOrders)) {
                 return BaseController.failed(HttpStatus.CONTINUE, studentPaymentOrders.get(0), "您有待支付的订单,是否继续支付");
             }
@@ -645,7 +650,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
             } else {
                 return BaseController.failed("该订单已关闭,请重新购买!");
             }
-        }
+        }*/
 
         int val = dto.getVal();
         //获取赠送的月份
@@ -704,8 +709,9 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
             logger.info("closeBuy2Qqhe>>>>> 未找到 orderNo {}", orderNo);
             return BaseController.succeed();
         }
+        studentPaymentOrderService.checkRepeatPay(orderByOrderNo, true);
         //订单是ing 才可以关闭
-        if (orderByOrderNo.getStatus().getCode().equals(DealStatusEnum.ING.getCode())) {
+        /*if (orderByOrderNo.getStatus().getCode().equals(DealStatusEnum.ING.getCode())) {
             //有第三方支付编号的 要主动去查询一下
             checkOrder(orderByOrderNo);
             //关闭订单  退余额 退优惠券
@@ -717,14 +723,25 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
             return BaseController.succeed();
         } else if (orderByOrderNo.getStatus().getCode().equals(DealStatusEnum.SUCCESS.getCode())) {
             throw new BizException("该订单已经支付成功,无法关闭。");
-        }
+        }*/
         return BaseController.succeed();
     }
 
     //检查订单在第三方是否支付成功
     private void checkOrder(StudentPaymentOrder orderByOrderNo) throws Exception {
         if (StringUtils.isNotBlank(orderByOrderNo.getTransNo())) {
-
+            BasePaymentService paymentService = paymentServiceContext.getPaymentService(orderByOrderNo.getPaymentChannel() + "_" + orderByOrderNo.getTenantId());
+            if (paymentService == null) {
+                throw new BizException("支付渠道[{}]找不到", orderByOrderNo.getPaymentChannel());
+            }
+            PaymentResp paymentResp = paymentService.query(orderByOrderNo.getOrderNo(), orderByOrderNo.getOrderNo());
+            if (Objects.isNull(paymentResp)) {
+                throw new BizException("订单支付状态获取异常,稍后请重试");
+            }
+            if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED) {
+                throw new BizException("该订单已经支付成功,无法关闭。");
+            }
+            /*
             HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(orderByOrderNo.getTenantId(), orderByOrderNo.getPaymentChannel());
             if(hfMerchantConfig == null){
             	throw new BizException("机构[{}]汇付商户信息找不到", orderByOrderNo.getTenantId());
@@ -734,7 +751,7 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
             String status = (String) payment.get("status");
             if (status.equals("succeeded")) {
                 throw new BizException("该订单已经支付成功,无法关闭。");
-            }
+            }*/
         }
     }
 

+ 62 - 52
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrderPayOpsServiceImpl.java

@@ -1,33 +1,5 @@
 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 com.huifu.adapay.core.util.StringUtil;
-import com.ym.mec.biz.service.*;
-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.alipay.api.AlipayApiException;
@@ -35,6 +7,10 @@ import com.alipay.api.AlipayClient;
 import com.alipay.api.DefaultAlipayClient;
 import com.alipay.api.request.AlipaySystemOauthTokenRequest;
 import com.alipay.api.response.AlipaySystemOauthTokenResponse;
+import com.microsvc.toolkit.middleware.payment.common.api.BasePaymentService;
+import com.microsvc.toolkit.middleware.payment.common.api.PaymentServiceContext;
+import com.microsvc.toolkit.middleware.payment.common.api.entity.PaymentOrder;
+import com.microsvc.toolkit.middleware.payment.common.api.entity.PaymentReq;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.PaymentParam;
 import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
@@ -43,15 +19,33 @@ 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.dal.enums.PaymentChannelEnum;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.WrapperUtil;
 import com.ym.mec.thirdparty.adapay.ConfigInit;
-import com.ym.mec.thirdparty.adapay.Payment;
 import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
-import com.ym.mec.thirdparty.yeepay.YeepayPaymentService;
 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.joda.time.DateTime;
+import org.redisson.api.RBucket;
+import org.redisson.api.RedissonClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.util.DigestUtils;
+
+import javax.annotation.Resource;
+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;
 
 import static com.ym.mec.biz.dal.enums.OrderTypeEnum.MALL_BUY;
 
@@ -63,25 +57,22 @@ import static com.ym.mec.biz.dal.enums.OrderTypeEnum.MALL_BUY;
 public class OrderPayOpsServiceImpl implements OrderPayOpsService {
     private static final Logger log = LoggerFactory.getLogger(OrderPayOpsServiceImpl.class);
 
-    @Autowired
+    @Resource
     private StudentPaymentOrderService studentPaymentOrderService;
-    @Autowired
+    @Resource
     private TenantPaymentOrderService tenantPaymentOrderService;
-    @Autowired
+    @Resource
     private TenantOrderRecordService tenantOrderRecordService;
-    
-    @Autowired
+    @Resource
     private HfMerchantConfigService hfMerchantConfigService;
-    
-    @Autowired
-    private YeepayPaymentService yeepayPaymentService;
-    
-    @Autowired
+    @Resource
     private RedissonClient redissonClient;
-    @Autowired
+    @Resource
     private TenantConfigService tenantConfigService;
-    @Autowired
+    @Resource
     private SysConfigDao sysConfigDao;
+    @Resource
+    private PaymentServiceContext paymentServiceContext;
 
     //tenant 机构开通、续费付款、 cloudTeacherOrder 团练宝激活支付、tenantRecharge 机构充值
     private static final String[] tenantPlatform = {"tenant", "cloudTeacherOrder", "tenantRecharge"};
@@ -101,7 +92,7 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
             //tenant 机构开通、续费付款、 cloudTeacherOrder 团练宝激活支付、tenantRecharge 机构充值
             payment = tenantPlatformOrder(payParam);
             //主动延迟检查订单
-            delayCheckTenant();
+//            delayCheckTenant();感觉不需要这个流程,反而会影响正常的支付回调
         } else {
             StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.findOrderByOrderNo(payParam.getOrderNo());
             if(studentPaymentOrder == null) {
@@ -141,7 +132,6 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
 
 
     private void checkSing(PaymentParam param) {
-        
         //查询商户支付账户
         HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(param.getTenantId(), param.getPayerName());
         if(hfMerchantConfig == null){
@@ -262,14 +252,34 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
         	throw new BizException("请配置机构的汇付商户信息");
         }
         
-        Map<String, Object> payment = new HashMap<String, Object>();
-        String transNo = null;
-        
+//        Map<String, Object> payment = new HashMap<String, Object>();
+//        String transNo = null;
+        BasePaymentService paymentService = paymentServiceContext.getPaymentService(payParam.getPayerName() + "_" + payParam.getTenantId());
+        if (paymentService == null) {
+            throw new BizException("支付渠道错误:" + payParam.getPayerName());
+        }
+        PaymentOrder paymentOrder = new PaymentOrder();
+        paymentOrder.setMerOrderNo(payParam.getOrderNo());
+        paymentOrder.setPrice(payParam.getAmount());
+        paymentOrder.setSubject(payParam.getOrderSubject());
+        paymentOrder.setBody(payParam.getOrderBody());
+        paymentOrder.setExpirationTime(DateTime.now().plusMinutes(120).toDate());
+        paymentOrder.setPaymentChannel(payParam.getPayChannel());
+        paymentOrder.setIp(payParam.getIp());
+        paymentOrder.setCode(payParam.getCode());
+        paymentOrder.setPayMode(true);
+        PaymentReq paymentReq = paymentService.pay(paymentOrder);
+        if (Objects.isNull(paymentReq)) {
+            throw new BizException("生成支付参数异常");
+        }
+//        transNo = paymentReq.getTransNo();
+        /*
         PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(payParam.getPayerName());
         
         switch (paymentChannel) {
 		case ADAPAY:
 
+
 	        //初始化支付数据
 	        Map<String, Object> paymentParams = getPaymentParam(payParam, clazz, hfMerchantConfig.getPlatformPayeeMemberId());
 	        paymentParams.put("time_expire", timeExpire);
@@ -320,18 +330,18 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
 
 		default:
 			break;
-		}
-        log.info("executePayment create order param >>>>> {}", JSON.toJSONString(payment));
+		}*/
+        log.info("executePayment create order param >>>>> {}", JSON.toJSONString(paymentReq));
         //修改流水
-        setTransNoByApply(transNo, clazz, setOption, action);
+        setTransNoByApply(paymentReq.getTransNo(), clazz, setOption, action);
 
-        return payment;
+        return paymentReq.getReqParams();
     }
 
     private <T> void checkOrderState(T obj, Function<T, DealStatusEnum> func) {
         DealStatusEnum em = func.apply(obj);
         if (predicate.test(obj, em)) {
-            String msg = em.equals(DealStatusEnum.SUCCESS) ? "订单已支付,请勿重复支付" : "订单已关闭,不能支付";
+            String msg = em.equals(DealStatusEnum.SUCCESS) ? "订单已支付,请勿重复支付" : "订单已关闭,请重新下单";
             throw new BizException(msg);
         }
     }

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

@@ -191,10 +191,10 @@ public class OrganizationServiceImpl extends BaseServiceImpl<Integer, Organizati
             //升级机构协议版本号
             tenantContractTemplateService.upgradeContractVersion(tenantId);
             
-			if (StringUtils.isNotBlank(organization.getCorporateName()) && StringUtils.isNotBlank(organization.getCorporateCode())) {
+			/*if (StringUtils.isNotBlank(organization.getCorporateName()) && StringUtils.isNotBlank(organization.getCorporateCode())) {
 				// 添加签章信息
 				contractService.addTsign(organization.getId(), organization.getCorporateCode(), organization.getCorporateName(), tenantId);
-			}
+			}*/
         }
 		
 		return true;

+ 25 - 46
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java

@@ -1,78 +1,57 @@
 package com.ym.mec.biz.service.impl;
 
-import java.math.BigDecimal;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
-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.GoodsProcurementDao;
 import com.ym.mec.biz.dal.dao.HfMemberDao;
 import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
 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.Goods;
-import com.ym.mec.biz.dal.entity.GoodsProcurement;
-import com.ym.mec.biz.dal.entity.HfMember;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
-import com.ym.mec.biz.dal.entity.SysPaymentConfig;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.FeeTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
 import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
-import com.ym.mec.biz.service.GoodsService;
-import com.ym.mec.biz.service.HfMerchantConfigService;
-import com.ym.mec.biz.service.PayService;
-import com.ym.mec.biz.service.SellOrderService;
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
-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.*;
 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.adapay.entity.HfMerchantConfig;
 import com.ym.mec.thirdparty.yqpay.YqPayUtil;
 import com.ym.mec.util.date.DateUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
 
 /**
  * 支付服务类
  */
 @Service
 public class PayServiceImpl implements PayService {
-    @Autowired
+    @Resource
     private StudentPaymentOrderService studentPaymentOrderService;
-    
-    @Autowired
+    @Resource
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
-    
-    @Autowired
+    @Resource
     private GoodsService goodsService;
-    
-    @Autowired
+    @Resource
     private HfMerchantConfigService hfMerchantConfigService;
-    
-    @Autowired
+    @Resource
     private SysConfigDao sysConfigDao;
-    @Autowired
+    @Resource
     private SysPaymentConfigService sysPaymentConfigService;
-    @Autowired
+    @Resource
     private StudentPaymentRouteOrderDao studentPaymentRouteOrderDao;
-    @Autowired
+    @Resource
     private SellOrderService sellOrderService;
-    @Autowired
+    @Resource
     private HfMemberDao hfMemberDao;
-    
-    @Autowired
+    @Resource
     private StudentPaymentOrderDao studentPaymentOrderDao;
 
     @Override
@@ -94,7 +73,7 @@ public class PayServiceImpl implements PayService {
 		PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(paymentChannelStr);
         
         Integer tenantId = studentPaymentOrder.getTenantId();
-        
+
         HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(tenantId, paymentChannelStr);
         if(hfMerchantConfig == null){
         	throw new BizException("机构[{}][{}]商户信息找不到", tenantId, paymentChannelStr);
@@ -135,11 +114,11 @@ public class PayServiceImpl implements PayService {
 		Date date = new Date();
         
         //如果当前是买的小课/网管课
-		if (studentPaymentOrder != null && (studentPaymentOrder.getType() == OrderTypeEnum.SMALL_CLASS_TO_BUY || studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_BUY
-				|| studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_RENEW || studentPaymentOrder.getType() == OrderTypeEnum.LIVE_GROUP_BUY)) {
+		if (studentPaymentOrder.getType() == OrderTypeEnum.SMALL_CLASS_TO_BUY || studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_BUY
+				|| studentPaymentOrder.getType() == OrderTypeEnum.PRACTICE_GROUP_RENEW || studentPaymentOrder.getType() == OrderTypeEnum.LIVE_GROUP_BUY) {
 			
 			//忽略的分部
-			List<Integer> ignoreOrganList = Arrays.asList(4);
+			List<Integer> ignoreOrganList = Collections.singletonList(4);
 			
 			// 是否由平台收款
 			String isPlatformCollection = sysConfigDao.findConfigValue(SysConfigService.IS_OPEN_SMALL_CLASS_INCOME_TO_PLATFORM);
@@ -190,7 +169,7 @@ public class PayServiceImpl implements PayService {
 		}
 		
 		//如果是乐队指导培训的订单,由武汉学校收款
-		if(studentPaymentOrder != null && studentPaymentOrder.getType() == OrderTypeEnum.DIRECTOR_TRAINING_CAMP) {
+		if(studentPaymentOrder.getType() == OrderTypeEnum.DIRECTOR_TRAINING_CAMP) {
 			
 			Integer routeOrganId = 50;
 			HfMember receiverMember = hfMemberDao.getByOrganId(routeOrganId, paymentChannelStr);

+ 47 - 43
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -25,6 +25,7 @@ import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.http.HttpUtil;
 import com.ym.mec.util.string.MessageFormatter;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -37,9 +38,9 @@ import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
-import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.time.*;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.WeekFields;
@@ -2938,20 +2939,20 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         if (teacherDefaultSalary == null) {
             throw new BizException("请设置教师课酬");
         }
-        BigDecimal studentSingleCourseCost = amount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
+        BigDecimal studentSingleCourseCost = amount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, RoundingMode.DOWN);
 
         BigDecimal oneMonthOriginalPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceOriginalPrice() : practiceGroupSellPrice.getTwiceOriginalPrice();
         BigDecimal originalAmount = ZERO;
         if (Objects.nonNull(oneMonthOriginalPrice)) {
             originalAmount = oneMonthOriginalPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
         }
-        BigDecimal studentSingleCourseOriginalCost = originalAmount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
+        BigDecimal studentSingleCourseOriginalCost = originalAmount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, RoundingMode.DOWN);
 
         //使用优惠券
         StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(practiceGroupBuyParams.getCouponIdList(), amount, true);
         //实际支付金额,去除优惠券
         BigDecimal actualPrice = studentPaymentOrder.getExpectAmount();
-        BigDecimal divide = actualPrice.divide(new BigDecimal(practiceCourses.size()), ROUND_DOWN);
+        BigDecimal divide = actualPrice.divide(new BigDecimal(practiceCourses.size()), RoundingMode.DOWN);
         BigDecimal firstAmount = actualPrice.subtract(divide.multiply(new BigDecimal(practiceCourses.size()))).add(divide);
         for (int i = 0; i < practiceCourses.size(); i++) {
             CourseSchedule courseSchedule = practiceCourses.get(i);
@@ -3005,8 +3006,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             courseScheduleService.checkNewCourseSchedules(practiceCourses, false, false);
         } catch (Exception e) {
             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-            String errMessage = new String();
-            if (e.getMessage().indexOf("主教冲突") != -1) {
+            String errMessage;
+            if (e.getMessage().contains("主教冲突")) {
                 errMessage = "抱歉啦,当前所选时段组合,「" + teacher.getRealName() + "」老师已被预约,请重新选择时段或更换老师后重试。";
             } else {
                 String courseName = e.getMessage().substring(e.getMessage().indexOf(")-") + 2);
@@ -3079,11 +3080,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         }
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
-        Map<String, BigDecimal> classFee = new HashMap<>();
+        /*Map<String, BigDecimal> classFee = new HashMap<>();
         classFee.put("course", amount);
         classFee.put("instrument", BigDecimal.ZERO);
         classFee.put("accessories", BigDecimal.ZERO);
-        classFee.put("other", BigDecimal.ZERO);
+        classFee.put("other", BigDecimal.ZERO);*/
         try {
             Map<String, Object> payMap = payService.getPayMap(
                     amount,
@@ -3317,7 +3318,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         BigDecimal singleClassMinutesPrice = practiceGroupSellPrice.getSingleClassMinutesPrice();
         //实际支付金额,去除优惠券
         BigDecimal actualPrice = order.getExpectAmount();
-        BigDecimal divide = actualPrice.divide(new BigDecimal(courseSchedules.size()), ROUND_DOWN);
+        BigDecimal divide = actualPrice.divide(new BigDecimal(courseSchedules.size()), RoundingMode.DOWN);
         BigDecimal firstAmount = actualPrice.subtract(divide.multiply(new BigDecimal(courseSchedules.size()))).add(divide);
 
         SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
@@ -3336,7 +3337,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             }
             VipGroupSalarySettlementTypeDto salarySettlement = vipGroupSalarySettlementDto.getPracticeSalarySettlement();
             if (salarySettlement.getSalarySettlementType() == SalarySettlementTypeEnum.FIXED_SALARY) {
-                teacherDefaultSalary = salarySettlement.getSettlementValue().setScale(2, BigDecimal.ROUND_CEILING);
+                teacherDefaultSalary = salarySettlement.getSettlementValue().setScale(2, RoundingMode.CEILING);
             }
         }
 
@@ -3414,7 +3415,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                     LocalTime courseStartTime = LocalTime.parse(courseJson.getString(weekNumStr), DateUtil.timeFormatter);
                     LocalTime courseEndTime = courseStartTime.plusMinutes(practiceCourseMinutes);
                     if (PracticeGroupType.COME_ON_PACKAGE.equals(userPracticeGroup.getType())) {
-                        courseEndTime = courseStartTime.plusMinutes(2 * practiceCourseMinutes);
+                        courseEndTime = courseStartTime.plusMinutes(2L * practiceCourseMinutes);
                     }
                     newCourseJson.put("startTime", courseStartTime.format(DateUtil.timeFormatter));
                     newCourseJson.put("endTime", courseEndTime.format(DateUtil.timeFormatter));
@@ -3523,7 +3524,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         List<StudentPaymentOrder> userGroupOrders = studentPaymentOrderDao.findUserGroupOrders(userId, practiceGroupId.toString(), GroupType.PRACTICE, null);
         Map<DealStatusEnum, List<StudentPaymentOrder>> statusOrderMap = userGroupOrders.stream().collect(Collectors.groupingBy(StudentPaymentOrder::getStatus));
         List<StudentPaymentOrder> successOrders = statusOrderMap.get(DealStatusEnum.SUCCESS);
-        if (!CollectionUtils.isEmpty(successOrders) && successOrders.size() > 0) {
+        if (CollectionUtils.isNotEmpty(successOrders)) {
             Map<String, Object> result = new HashMap<>();
             result.put("orderNo", successOrders.get(0).getOrderNo());
             return BaseController.succeed(result);
@@ -3591,11 +3592,11 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         }
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
-        Map<String, BigDecimal> classFee = new HashMap<>();
+        /*Map<String, BigDecimal> classFee = new HashMap<>();
         classFee.put("course", newOrder.getActualAmount());
         classFee.put("instrument", BigDecimal.ZERO);
         classFee.put("accessories", BigDecimal.ZERO);
-        classFee.put("other", BigDecimal.ZERO);
+        classFee.put("other", BigDecimal.ZERO);*/
 
         Map<String, Object> payMap = payService.getPayMap(
                 newOrder.getActualAmount(),
@@ -3675,10 +3676,13 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.PRACTICE, groupId + "", userId, DealStatusEnum.ING,
                     OrderTypeEnum.PRACTICE_GROUP_BUY);
 
-            if (list.size() > 0) {
-                StudentPaymentOrder applyOrder = list.get(list.size() - 1);
+            if (!CollectionUtils.isEmpty(list)) {
+                HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(list.get(list.size() - 1), true);
+                if (result.getCode() != 200) {
+                    return result;
+                }
                 // 查询订单状态
-                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder);
+                /*PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder);
                 if (payStatus == PayStatus.SUCCESSED) {
                     throw new BizException("订单已支付成功,请勿重复支付");
                 }
@@ -3690,7 +3694,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                             PlatformCashAccountDetailTypeEnum.REFUNDS, "购买网管课支付失败");
                 }
                 studentPaymentOrderService.update(applyOrder);
-                sysCouponCodeService.quit(applyOrder.getCouponCodeId());
+                sysCouponCodeService.quit(applyOrder.getCouponCodeId());*/
             }
 
         } else if (practiceGroup.getGroupStatus().equals(GroupStatusEnum.NORMAL)) {
@@ -3701,10 +3705,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         return BaseController.succeed();
     }
 
-    public static void main(String[] args) {
-
-    }
-
     @Override
     public void pushStudyReport(Date expiredDate, String pushType) {
         if (Objects.isNull(expiredDate)) {
@@ -3768,13 +3768,13 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             pageInfo.setTotal(count);
             params.put("offset", pageInfo.getOffset());
             dataList = practiceGroupDao.findPracticeGroupsReviews(params);
-            if (dataList != null && dataList.size() > 0) {
-                List<Integer> subjectIds = dataList.stream().map(practiceGroup -> practiceGroup.getSubjectId()).distinct().collect(Collectors.toList());
-                Set<Integer> organIds = dataList.stream().map(practiceGroup -> practiceGroup.getOrganId()).collect(Collectors.toSet());
+            if (CollectionUtils.isNotEmpty(dataList)) {
+                List<Integer> subjectIds = dataList.stream().map(PracticeGroup::getSubjectId).distinct().collect(Collectors.toList());
+                Set<Integer> organIds = dataList.stream().map(PracticeGroup::getOrganId).collect(Collectors.toSet());
                 List<String> practiceGroupIds = dataList.stream().map(e -> String.valueOf(e.getId())).distinct().collect(Collectors.toList());
 
                 List<ClassGroup> classGroupsByVipGroups = classGroupDao
-                        .findByMusicGroupsAndType(practiceGroupIds.stream().map(groupId -> String.valueOf(groupId)).collect(Collectors.toList()),
+                        .findByMusicGroupsAndType(practiceGroupIds.stream().map(String::valueOf).collect(Collectors.toList()),
                                 GroupType.PRACTICE.getCode());
                 Map<String, ClassGroup> vipGroupClassGroupMap = classGroupsByVipGroups.stream().collect(Collectors.toMap(ClassGroup::getMusicGroupId, classGroup -> classGroup));
                 //当前课时,总课时
@@ -3785,7 +3785,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                 Map<Long, String> subjectNames = MapUtil.convertMybatisMap(subjectDao.findBySubjecIds(StringUtils.join(subjectIds, ",")));
                 Map<Integer, String> organNames = MapUtil.convertMybatisMap(organizationDao.findOrganNameMapList(organIds));
                 dataList.forEach(e -> {
-                    e.setSubjectName(subjectNames.get(e.getSubjectId().intValue()));
+                    e.setSubjectName(subjectNames.get(e.getSubjectId()));
                     e.setOrganName(organNames.get(e.getOrganId()));
                     ClassGroup classGroup = vipGroupClassGroupMap.get(e.getId().toString());
                     if (Objects.nonNull(classGroup)) {
@@ -3901,7 +3901,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         BigDecimal totalPrice = BigDecimal.ZERO;
         if (practice.getAllCourseNum() != null) {
             BigDecimal onlineClassNum = new BigDecimal(practice.getAllCourseNum());
-            totalPrice = practiceGroupSellPrice.getSingleClassMinutesPrice().multiply(onlineClassNum).setScale(0, BigDecimal.ROUND_CEILING);
+            totalPrice = practiceGroupSellPrice.getSingleClassMinutesPrice().multiply(onlineClassNum).setScale(0, RoundingMode.CEILING);
         }
 
         //课程购买费用计算
@@ -3918,7 +3918,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             if(vipGroupActivity.getFixedCourseNumFlag()){
                 totalPrice = vipGroupActivity.getMarketPrice();
             }else {
-                totalPrice = totalPrice.multiply(vipGroupActivity.getDiscount()).divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, ROUND_DOWN).setScale(0, BigDecimal.ROUND_CEILING);
+                totalPrice = totalPrice.multiply(vipGroupActivity.getDiscount()).divide(new BigDecimal(100), CommonConstants.DECIMAL_PLACE, RoundingMode.DOWN).setScale(0, RoundingMode.CEILING);
             }
         }
         //教师课酬线上单课酬计算
@@ -3936,8 +3936,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         }
 
         results.put("totalPrice", totalPrice);
-        results.put("onlineTeacherSalary", teacherDefaultSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
-        results.put("giveTeacherDefaultSalary", giveTeacherDefaultSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
+        results.put("onlineTeacherSalary", teacherDefaultSalary.setScale(2, RoundingMode.HALF_UP));
+        results.put("giveTeacherDefaultSalary", giveTeacherDefaultSalary.setScale(2, RoundingMode.HALF_UP));
         return results;
     }
 
@@ -3981,8 +3981,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
             }
         }
 
-        results.put("onlineTeacherSalary", teacherDefaultSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
-        results.put("giveTeacherDefaultSalary", giveTeacherDefaultSalary.setScale(2, BigDecimal.ROUND_HALF_UP));
+        results.put("onlineTeacherSalary", teacherDefaultSalary.setScale(2, RoundingMode.HALF_UP));
+        results.put("giveTeacherDefaultSalary", giveTeacherDefaultSalary.setScale(2, RoundingMode.HALF_UP));
         return results;
     }
 
@@ -4172,15 +4172,19 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                         user.getId(),
                         DealStatusEnum.ING,
                         OrderTypeEnum.PRACTICE_GROUP_BUY);
-        if (list.size() > 0) {
+        if (CollectionUtils.isNotEmpty(list)) {
             StudentPaymentOrder applyOrder = list.get(list.size() - 1);
+            HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(applyOrder, practiceGroupBuyParams.getRepeatPay());
+            if (result.getCode() != 200) {
+                return result;
+            }
             // 查询订单状态
-            PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder);
+            /*PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder);
             if (payStatus == PayStatus.SUCCESSED) {
                 throw new BizException("订单已支付成功,请勿重复支付");
-            }/*else if(payStatus == PayStatus.PAYING){
+            }*//*else if(payStatus == PayStatus.PAYING){
                 throw new BizException("订单还在交易中,请稍后重试");
-            }*/
+            }*//*
             if (!practiceGroupBuyParams.getRepeatPay()) {
                 return BaseController.failed(HttpStatus.CONTINUE, "您有待支付的订单");
             }
@@ -4192,7 +4196,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                         PlatformCashAccountDetailTypeEnum.REFUNDS, "购买网管课支付失败");
             }
             studentPaymentOrderService.update(applyOrder);
-            sysCouponCodeService.quit(applyOrder.getCouponCodeId());
+            sysCouponCodeService.quit(applyOrder.getCouponCodeId());*/
         }
 
         ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(practiceGroupBuyParams.getPracticeGroupId().toString(), ClassGroupTypeEnum.PRACTICE.getCode());
@@ -4209,7 +4213,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
 
         VipGroupActivity vipGroupActivity = null;
         if (Objects.nonNull(practiceGroup.getVipGroupActivityId())) {
-            vipGroupActivity = vipGroupActivityDao.get(practiceGroup.getVipGroupActivityId().intValue());
+            vipGroupActivity = vipGroupActivityDao.get(practiceGroup.getVipGroupActivityId());
         }
 
         if (Objects.nonNull(vipGroupActivity) && Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes()) && vipGroupActivity.getStudentMaxUsedTimes() != -1) {
@@ -4286,19 +4290,19 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
                 }
             }
         }
-        try {
+        /*try {
             contractService.register(user.getId(), user.getRealName(), user.getIdCardNo(), user.getPhone());
         } catch (Exception e) {
             LOGGER.error("[{}]小课购买协议生成错误:{}", practiceGroup.getId(), e.getCause());
-        }
+        }*/
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
         //分类费用 course,instrument,accessories,other
-        Map<String, BigDecimal> classFee = new HashMap<>();
+        /*Map<String, BigDecimal> classFee = new HashMap<>();
         classFee.put("course", amount);
         classFee.put("instrument", BigDecimal.ZERO);
         classFee.put("accessories", BigDecimal.ZERO);
-        classFee.put("other", BigDecimal.ZERO);
+        classFee.put("other", BigDecimal.ZERO);*/
         Map<String, Object> payMap = payService.getPayMap(
                 amount,
                 balance,

+ 17 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ReplacementInstrumentActivityServiceImpl.java

@@ -10,7 +10,9 @@ import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.dto.BrandDto;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.mall.MallFeignService;
 import org.apache.commons.lang.math.NumberUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -18,6 +20,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -302,7 +305,7 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Map pay(ReplacementPayDto replacementPayDto) throws Exception {
+    public HttpResponseResult pay(ReplacementPayDto replacementPayDto) throws Exception {
         ReplacementInstrumentActivity replacementInstrumentActivity = replacementInstrumentActivityDao.getLock(replacementPayDto.getId());
         Integer userId = replacementInstrumentActivity.getUserId();
 
@@ -311,23 +314,27 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
         }
 
         //处理关闭订单
-        if (replacementInstrumentActivity.getPayStatus().equals(1) && replacementPayDto.getRePay()) {
+        if (replacementInstrumentActivity.getPayStatus().equals(1)/* && replacementPayDto.getRePay()*/) {
             StudentPaymentOrder oldOrder = studentPaymentOrderService.getUserReplacementIngOrder(userId, replacementInstrumentActivity.getId());
             if (oldOrder != null) {
-                
+                HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(oldOrder, replacementPayDto.getRePay());
+                if (result.getCode() != 200) {
+                    return result;
+                }
+
                 // 查询订单状态
-                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(oldOrder);
+                /*PayStatus payStatus = studentPaymentOrderService.queryPayStatus(oldOrder);
                 if(payStatus != PayStatus.FAILED){
                 	if(payStatus == PayStatus.SUCCESSED){
                 		throw new BizException("订单已支付成功,请勿重复支付");
-                	}/*else if(payStatus == PayStatus.PAYING){
+                	}*//*else if(payStatus == PayStatus.PAYING){
                 		throw new BizException("订单还在交易中,请稍后重试");
-                	}*/
+                	}*//*
                 }
                 
                 oldOrder.setStatus(DealStatusEnum.FAILED);
                 oldOrder.setMemo("用户手动关闭");
-                studentPaymentOrderService.callOrderCallBack(oldOrder);
+                studentPaymentOrderService.callOrderCallBack(oldOrder);*/
             }
         }
 
@@ -390,7 +397,8 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
             notifyMap.put("channelType", channelType);
             notifyMap.put("orderNo", "");
             studentPaymentOrderService.updateOrder(notifyMap);
-            return notifyMap;
+            return BaseController.failed(HttpStatus.CREATED, notifyMap, "恭喜您,支付成功!");
+//            return notifyMap;
         }
 
         String orderSubject = "乐器置换";
@@ -414,7 +422,7 @@ public class ReplacementInstrumentActivityServiceImpl extends BaseServiceImpl<In
         studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
         studentPaymentOrder.setUpdateTime(nowDate);
         studentPaymentOrderService.update(studentPaymentOrder);
-        return payMap;
+        return BaseController.succeed(payMap);
     }
 
     @Override

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

@@ -11,6 +11,7 @@ import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.auth.api.enums.SysUserType;
 import com.ym.mec.auth.api.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.common.dto.RealnameAuthenticationDto;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.EFriendRoleType;
 import com.ym.mec.biz.dal.enums.MessageTypeEnum;
@@ -25,7 +26,6 @@ import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
-import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -40,7 +40,6 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.text.MessageFormat;
 import java.util.*;
-import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
@@ -661,7 +660,9 @@ public class SchoolStaffServiceImpl extends ServiceImpl<SchoolStaffMapper, Schoo
 
         // 验证数据合法
         if (!debugMode) {
-            realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(realName, idcardNo);
+//            realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(realName, idcardNo);
+            // 取消第三方实名认证
+            RealnameAuthenticationDto.verify(realName, idcardNo);
         }
 
         // 保存到sys_user表中

+ 305 - 144
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -3,6 +3,12 @@ package com.ym.mec.biz.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.collect.Lists;
+import com.microsvc.toolkit.common.tools.ThreadPool;
+import com.microsvc.toolkit.middleware.payment.common.api.BasePaymentService;
+import com.microsvc.toolkit.middleware.payment.common.api.PaymentServiceContext;
+import com.microsvc.toolkit.middleware.payment.common.api.entity.*;
+import com.microsvc.toolkit.middleware.payment.common.api.enums.PaymentStatus;
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
@@ -27,13 +33,11 @@ import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.thirdparty.adapay.ConfigInit;
-import com.ym.mec.thirdparty.adapay.Payment;
 import com.ym.mec.thirdparty.adapay.entity.BaseResult;
-import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
-import com.ym.mec.thirdparty.yeepay.YeepayPaymentService;
 import com.ym.mec.thirdparty.yqpay.*;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -45,8 +49,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.annotation.Resource;
-import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
@@ -57,99 +59,98 @@ import java.util.stream.Collectors;
 import static com.ym.mec.biz.dal.enums.DealStatusEnum.CLOSE;
 import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
 
+@Slf4j
 @Service
 public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, StudentPaymentOrder> implements StudentPaymentOrderService {
 
-    @Resource
+    @Autowired
     private StudentPaymentOrderDao studentPaymentOrderDao;
-    @Resource
+    @Autowired
     private YqPayFeignService yqPayFeignService;
-    @Resource
+    @Autowired
     private StudentRegistrationService studentRegistrationService;
-    @Resource
+    @Autowired
     @Lazy
     private VipGroupService vipGroupService;
-    @Resource
+    @Autowired
     private MusicGroupService musicGroupService;
-    @Resource
+    @Autowired
     private SporadicChargeInfoService sporadicChargeInfoService;
-    @Resource
+    @Autowired
     private PracticeGroupService practiceGroupService;
-    @Resource
+    @Autowired
     private StudentRepairService studentRepairService;
-    @Resource
+    @Autowired
     private SysUserCashAccountService sysUserCashAccountService;
-    @Resource
+    @Autowired
     private SubjectChangeService subjectChangeService;
-    @Resource
+    @Autowired
     private DegreeRegistrationService degreeRegistrationService;
-    @Resource
+    @Autowired
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
-    @Resource
+    @Autowired
     private IdGeneratorService idGeneratorService;
-    @Resource
+    @Autowired
     private SysConfigDao sysConfigDao;
-    @Resource
+    @Autowired
     private GoodsService goodsService;
-    @Resource
+    @Autowired
     private StudentInstrumentService studentInstrumentService;
-    @Resource
+    @Autowired
     private ReplacementInstrumentActivityService replacementInstrumentActivityService;
-    @Resource
+    @Autowired
     private ChildrenDayReserveService childrenDayReserveService;
-    @Resource
+    @Autowired
     private MemberRankSettingService memberRankSettingService;
-    @Resource
+    @Autowired
     private PayService payService;
-    @Resource
+    @Autowired
     private StudentPaymentRouteOrderService studentPaymentRouteOrderService;
-    @Resource
+    @Autowired
     private CloudTeacherOrderService cloudTeacherOrderService;
-    @Resource
+    @Autowired
     private SysCouponCodeService sysCouponCodeService;
-    @Resource
+    @Autowired
     private VipGroupActivityService vipGroupActivityService;
-    @Resource
+    @Autowired
     private ActivityUserMapperService activityUserMapperService;
-    @Resource
+    @Autowired
     private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
-    @Resource
+    @Autowired
     private SysUserFeignService sysUserFeignService;
-    @Resource
+    @Autowired
     private TenantConfigService tenantConfigService;
-    @Resource
+    @Autowired
     private GoodsProcurementDao goodsProcurementDao;
-    @Resource
+    @Autowired
     private SysPaymentConfigService sysPaymentConfigService;
-    @Resource
+    @Autowired
     private SellOrderDao sellOrderDao;
     @Lazy
-    @Resource
+    @Autowired
     private ContractService contractService;
-    @Resource
-    private HfMerchantConfigService hfMerchantConfigService;
-    @Resource
+    @Autowired
     private StudentDao studentDao;
-    @Resource
+    @Autowired
     private SysUserCashAccountDetailService sysUserCashAccountDetailService;
-    @Resource
-    private YeepayPaymentService yeepayPaymentService;
-    @Resource
+    @Autowired
     private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
-    @Resource
+    @Autowired
     private StudentRepairDao studentRepairDao;
-    @Resource
+    @Autowired
     private MusicGroupDao musicGroupDao;
-    @Resource
+    @Autowired
     private StudentGoodsSellDao studentGoodsSellDao;
-    @Resource
+    @Autowired
     private StudentPaymentOrderService studentPaymentOrderService;
-    @Resource
+    @Autowired
     private TempDirectorTrainingCampDetailService tempDirectorTrainingCampDetailService;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderAddressService musicGroupPaymentCalenderAddressService;
-    @Resource
+    @Autowired
     private MusicGroupPaymentCalenderMemberService musicGroupPaymentCalenderMemberService;
+    @Autowired
+    private PaymentServiceContext paymentServiceContext;
 
     private final Logger logger = LoggerFactory.getLogger(this.getClass());
     @Override
@@ -157,8 +158,6 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         return studentPaymentOrderDao;
     }
 
-    private final static Logger LOGGER = LoggerFactory.getLogger(StudentPaymentOrderServiceImpl.class);
-
     @Override
     public StudentPaymentOrderDao getDao() {
         return studentPaymentOrderDao;
@@ -324,48 +323,58 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
 
         Date date = new Date();
 
-        if (payingOrders.size() == 0) {
+        if (CollectionUtils.isEmpty(payingOrders)) {
             return;
         }
         
-        List<String> orderNoList = new ArrayList<String>();
-
         for (StudentPaymentOrder payingOrder : payingOrders) {
-            //if (payingOrder.getTransNo() == null && "205".equals(payingOrder.getPaymentAccountNo()) && DateUtil.isSameDay(payingOrder.getCreateTime(), new Date())) {
-            if (payingOrder.getTransNo() == null && "205".equals(payingOrder.getPaymentAccountNo())) {
+            //查询支付超过10分钟的
+            if (DateUtil.minutesBetween(payingOrder.getCreateTime(), date) < 30) {
                 continue;
             }
+            TenantContextHolder.setTenantId(payingOrder.getTenantId());
+            //if (payingOrder.getTransNo() == null && "205".equals(payingOrder.getPaymentAccountNo()) && DateUtil.isSameDay(payingOrder.getCreateTime(), new Date())) {
             if (payingOrder.getTransNo() == null) {
-                orderNoList.add(payingOrder.getOrderNo());
-                continue;
-            }
-            //查询支付超过10分钟的
-            if (DateUtil.minutesBetween(payingOrder.getCreateTime(), date) < 10) {
-                continue;
+                if ("205".equals(payingOrder.getPaymentAccountNo())){
+                    continue;
+                }else {
+                    payingOrder.setStatus(CLOSE);
+                    payingOrder.setMemo("未拉起,超时未支付关闭");
+                    callOrderCallBack(payingOrder);
+                    continue;
+                }
             }
             try {
-            	updateOrderStatus(date, payingOrder);
+                updateOrderStatus(date, payingOrder);
             }catch (Exception e) {
-				logger.error("执行[订单状态查询]任务失败", e);
-			}
+				logger.error("执行[订单状态查询]任务失败,订单号:{}", payingOrder.getOrderNo(), e);
+			}finally {
+                TenantContextHolder.clearTenantId();
+            }
         }
-        closeOrders(orderNoList);
     }
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public OrderCancelModel updateOrderStatus(Date date, StudentPaymentOrder payingOrder) throws Exception {
     	
-        HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(payingOrder.getTenantId(), payingOrder.getPaymentChannel());
+        /*HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(payingOrder.getTenantId(), payingOrder.getPaymentChannel());
         if(hfMerchantConfig == null){
             throw new BizException("机构[{}]汇付商户信息找不到", payingOrder.getTenantId());
-        }
+        }*/
         
-        PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(payingOrder.getPaymentChannel());
+//        PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(payingOrder.getPaymentChannel());
         
-        OrderCancelModel  model = new OrderCancelModel();
-        Map<String, Object> payment = new HashMap<String, Object>();
-
+//        Map<String, Object> payment = new HashMap<String, Object>();
+        BasePaymentService paymentService = paymentServiceContext.getPaymentService(payingOrder.getPaymentChannel() + "_" + payingOrder.getTenantId());
+        if (paymentService == null) {
+            throw new BizException("支付渠道[{}]不支持", payingOrder.getPaymentChannel());
+        }
+        PaymentResp paymentResp = paymentService.query(payingOrder.getTransNo(), payingOrder.getOrderNo());
+        if (paymentResp == null) {
+            throw new BizException("订单支付状态获取异常,稍后请重试,transNo:{},orderNo:{},paymentChannel:{}", payingOrder.getTransNo(), payingOrder.getOrderNo(), payingOrder.getPaymentChannel());
+        }
+/*
         if(paymentChannel == PaymentChannelEnum.ADAPAY) {
         	payment = Payment.queryPayment(payingOrder.getTransNo(), hfMerchantConfig.getMerKey());
         }else if(paymentChannel == PaymentChannelEnum.YEEPAY) {
@@ -386,28 +395,49 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         	throw new BizException("[{}]支付渠道不支持", payingOrder.getPaymentChannel());
         }
         
-        LOGGER.warn("订单[{}]交易主动查询接口返回:{}", payingOrder.getTransNo(), payment);
-
+        LOGGER.warn("订单[{}]交易主动查询接口返回:{}", payingOrder.getTransNo(), payment);*/
         Map<String, String> rpMap = new HashMap<>();
         rpMap.put("merOrderNo", payingOrder.getOrderNo());
         rpMap.put("orderNo", payingOrder.getTransNo());
-        rpMap.put("channelType", (String) payment.get("pay_channel"));
-        model.setPayChannel((String) payment.get("pay_channel"));
-        String status = (String) payment.get("status");
-        if (payment.containsKey("error_msg")) {
-            rpMap.put("remarks", (String) payment.get("error_msg"));
+        rpMap.put("channelType", paymentResp.getPaymentChannel());
+        OrderCancelModel  model = new OrderCancelModel();
+        model.setPayChannel(paymentResp.getPaymentChannel());
+//        String status = (String) payment.get("status");
+        if (paymentResp.getPaymentStatus() == PaymentStatus.FAILED) {
+            rpMap.put("remarks", paymentResp.getMsg());
+            rpMap.put("tradeState", "0");
+            model.setStatus(false);
+        }else if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED) {
+            rpMap.put("tradeState", "1");
+            model.setStatus(true);
+        } else if (paymentResp.getPaymentStatus() == PaymentStatus.PENDDING) {
+            PaymentClose close = paymentService.close(payingOrder.getTransNo(), "超时未支付关闭", payingOrder.getOrderNo());
+            if (close == null) {
+                log.error("订单关闭失败,orderNo:{}", payingOrder.getOrderNo());
+                return model;
+            }
+            if (close.getStatus() == PaymentStatus.SUCCESSED) {
+                log.info("关闭订单返回:{}", close);
+                payingOrder.setStatus(CLOSE);
+                payingOrder.setMemo("超时未支付关闭");
+                callOrderCallBack(payingOrder);
+                return model;
+            } else {
+                log.info("关闭订单返回:{}", close);
+                return model;
+            }
+
         }
-        if (status.equals("succeeded")) {
+        /*if (status.equals("succeeded")) {
             rpMap.put("tradeState", "1");
             model.setStatus(true);
         } else if (status.equals("failed")
                 || (DateUtil.minutesBetween(DateUtil.addHours(payingOrder.getUpdateTime(), 2),date) > 0)) {
             rpMap.put("tradeState", "0");
             model.setStatus(false);
-        }
+        }*/
 
-        if (status.equals("succeeded") ||
-                (status.equals("failed") || payingOrder.getCreateTime().before(DateUtil.addMinutes(new Date(), -35)))) {
+        if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED || paymentResp.getPaymentStatus() == PaymentStatus.FAILED) {
             try {
                 updateOrder(rpMap); //更新订单
                 model.setSuccess(true);
@@ -501,21 +531,45 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         }
         Date date = new Date();
         
-        HfMerchantConfig hfMerchantConfig = null;
-        
         List<StudentPaymentRouteOrder> routeOrders = studentPaymentRouteOrderService.getDao().getRouteOrders(order.getOrderNo());
-        
-        PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(order.getPaymentChannel());
-        
 
-    	if(hfMerchantConfig == null){
-    		hfMerchantConfig = hfMerchantConfigService.queryByTenantId(order.getTenantId(), order.getPaymentChannel());
-    	}
+        /*HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(order.getTenantId(), order.getPaymentChannel());
         if(hfMerchantConfig == null){
-        	throw new BizException("机构[{}][{}]商户信息找不到", order.getTenantId(), order.getPaymentChannel());
+            throw new BizException("机构[{}][{}]商户信息找不到", order.getTenantId(), order.getPaymentChannel());
+        }*/
+        BasePaymentService paymentService = paymentServiceContext.getPaymentService(order.getPaymentChannel() + "_" + order.getTenantId());
+        for (StudentPaymentRouteOrder routeOrder : routeOrders) {
+            if (routeOrder.getRouteAmount().compareTo(BigDecimal.ZERO) == 0) {
+                routeOrder.setServiceFee(BigDecimal.ZERO);
+                routeOrder.setUpdateTime(date);
+                studentPaymentRouteOrderService.getDao().update(routeOrder);
+                continue;
+            }
+            // 执行分账逻辑
+            DivideReq.DivMember divMember = DivideReq.DivMember.builder()
+                    .memberId(routeOrder.getMerNo().equals(ConfigInit.merNo) ? "0" : routeOrder.getMerNo())
+                    .amount(routeOrder.getRouteAmount().setScale(2, RoundingMode.HALF_UP))
+                    .feeFlag("Y")
+                    .build();
+            DivideReq divideReq = DivideReq.builder()
+                    .transNo(order.getTransNo())
+                    .orderNo(order.getOrderNo())
+                    .divideOrderNo(idGeneratorService.generatorId("payment") + "")
+                    .divideAmount(divMember.getAmount())
+                    .divMembers(Lists.newArrayList(divMember))
+                    .build();
+            try {
+                DivideResp divide = paymentService.divide(divideReq);
+                log.info("分账信息返回:{}", divide);
+                routeOrder.setServiceFee(divide.getFeeAmount());
+                routeOrder.setUpdateTime(date);
+                studentPaymentRouteOrderService.getDao().update(routeOrder);
+            } catch (Exception e) {
+                log.error("分账失败 orderId:{}", order.getId(), e);
+            }
         }
-        
-        StudentPaymentRouteOrder studentPaymentRouteOrder = null;
+
+        /*StudentPaymentRouteOrder studentPaymentRouteOrder = null;
         
         if(paymentChannel == PaymentChannelEnum.ADAPAY) {
         	
@@ -601,7 +655,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
 
                 studentPaymentRouteOrderService.getDao().update(spro);
 			}
-		}
+		}*/
         
         return true;
     }
@@ -655,7 +709,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     private void closeOrders(List<String> orderNoList) throws Exception {
-        if (orderNoList.size() == 0) {
+        if (CollectionUtils.isEmpty(orderNoList)) {
             return;
         }
 
@@ -665,15 +719,19 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
 
         List<StudentPaymentOrder> ordersOverTime = findOrdersOverTime(orderNoList, DealStatusEnum.ING, beforeDate);
         for (StudentPaymentOrder order : ordersOverTime) {
+            BasePaymentService paymentService = paymentServiceContext.getPaymentService(order.getPaymentChannel() + "_" + order.getTenantId());
+            if (paymentService == null) {
+                log.error("关闭订单失败,支付渠道[{}]不支持,订单编号{}", order.getPaymentChannel(), order.getOrderNo());
+            }
             try {
+                PaymentClose close = paymentService.close(order.getTransNo(), "超时未支付关闭", order.getOrderNo());
                 TenantContextHolder.setTenantId(order.getTenantId());
-                order.setStatus(DealStatusEnum.FAILED);
-                order.setMemo("超时未支付关闭");
+                order.setStatus(CLOSE);
+                order.setMemo(close.getMsg());
                 callOrderCallBack(order);
                 TenantContextHolder.clearTenantId();
             } catch (Exception e) {
                 e.printStackTrace();
-                continue;
             }
         }
 
@@ -876,22 +934,35 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public PayStatus queryPayStatus(StudentPaymentOrder studentPaymentOrder) throws Exception {
-    	
+
     	String paymentChannel = studentPaymentOrder.getPaymentChannel();
     	String orderNo = studentPaymentOrder.getOrderNo();
     	String transNo = studentPaymentOrder.getTransNo();
-    	
+
         if (StringUtils.isBlank(transNo)) {
             return PayStatus.FAILED;
         }
-        
-    	HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(studentPaymentOrder.getTenantId(), studentPaymentOrder.getPaymentChannel());
+
+    	/*HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(studentPaymentOrder.getTenantId(), studentPaymentOrder.getPaymentChannel());
         if(hfMerchantConfig == null){
         	throw new BizException("机构[{}]汇付商户信息找不到", studentPaymentOrder.getTenantId());
+        }*/
+        PaymentResp paymentResp = paymentServiceContext.getPaymentService(paymentChannel + "_" + studentPaymentOrder.getTenantId())
+                .query(transNo, orderNo);
+        if (paymentResp == null) {
+            throw new BizException("订单支付状态获取异常,稍后请重试,transNo:{},orderNo:{},paymentChannel:{}", transNo, orderNo, paymentChannel);
+        }
+        if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED) {
+            return PayStatus.SUCCESSED;
+        } else if (paymentResp.getPaymentStatus() == PaymentStatus.PENDDING) {
+            return PayStatus.PAYING;
+        }else {
+            return PayStatus.FAILED;
         }
-        
-        if (StringUtils.equals(paymentChannel, "ADAPAY")) {
+
+        /*if (StringUtils.equals(paymentChannel, "ADAPAY")) {
             Map<String, Object> payment = Payment.queryPayment(transNo, hfMerchantConfig.getMerKey());
             String status = (String) payment.get("status");
             if (status.equals("succeeded")) {
@@ -945,7 +1016,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         	}
             throw new BizException(result.get("message").toString());
         }
-        throw new BizException("支付渠道错误");
+        throw new BizException("支付渠道错误");*/
     }
 
     @Override
@@ -1056,22 +1127,49 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     @Transactional(rollbackFor = Exception.class)
     public HttpResponseResult checkRepeatPay(StudentPaymentOrder order, Boolean repeatPay) throws Exception {
         // 查询订单状态
-        PayStatus payStatus = this.queryPayStatus(order);
-        if (payStatus == PayStatus.SUCCESSED) {
-            throw new BizException("订单已支付成功,请勿重复支付");
-        }
-        if (!repeatPay && payStatus == PayStatus.PAYING) {
-            return BaseController.failed(HttpStatus.CONTINUE, "您有支付中的订单,是否继续支付");
+        String paymentChannel = order.getPaymentChannel();
+        String orderNo = order.getOrderNo();
+        String transNo = order.getTransNo();
+
+        if (StringUtils.isNotEmpty(transNo)) {
+            BasePaymentService paymentService = paymentServiceContext.getPaymentService(paymentChannel + "_" + order.getTenantId());
+            if (paymentService == null) {
+                log.error("获取支付服务异常,稍后请重试,orderNo:{}", order.getOrderNo());
+                throw new BizException("获取支付服务异常,稍后请重试");
+            }
+            PaymentResp paymentResp = paymentService.query(transNo, orderNo);
+            if (paymentResp == null) {
+                log.error("订单支付状态获取异常,稍后请重试,transNo:{},orderNo:{},paymentChannel:{}", transNo, orderNo, paymentChannel);
+                throw new BizException("订单支付状态获取异常,稍后请重试");
+            }
+            if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED) {
+                throw new BizException("订单已支付成功,请勿重复支付");
+            }else if (paymentResp.getPaymentStatus() == PaymentStatus.PENDDING) {
+                if (!repeatPay) {
+                    return BaseController.failed(HttpStatus.CONTINUE, "您有支付中的订单,是否继续支付");
+                }
+                PaymentClose close = paymentService.close(order.getTransNo(), "超时未支付关闭", order.getOrderNo());
+                if (close == null) {
+                    log.error("订单关闭失败,orderNo:{}", order.getOrderNo());
+                    throw new BizException("上一笔订单关闭失败,稍后请重试");
+                }
+                if (close.getStatus() != PaymentStatus.SUCCESSED) {
+                    log.error("关闭订单失败,orderNo:{},msg:{}", order.getOrderNo(), close.getMsg());
+                    throw new BizException("上一笔订单关闭失败,稍后请重试");
+                }
+            } else {
+                return BaseController.failed("该订单已关闭,请重新购买!");
+            }
         }
         //处理关闭订单
         order.setStatus(CLOSE);
-        order.setMemo("关闭订单");
-
+        order.setMemo("用户主动关闭订单");
         
         Date nowDate = new Date();
         //增加商品库存
         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(order.getId());
-        String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
+        String goodsIds = studentPaymentOrderDetailList.stream().map(StudentPaymentOrderDetail::getMinuendStockGoodsIdList)
+                .filter(StringUtils::isNotBlank).collect(Collectors.joining(","));
         if(StringUtils.isNotBlank(goodsIds)){
         	List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
         	Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
@@ -1091,7 +1189,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
 				
 				batchUpdateGoodsMap.put(goods.getId(), goods);
         	}
-            if(batchUpdateGoodsMap.size() > 0){
+            if(!batchUpdateGoodsMap.isEmpty()){
             	goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
             }
         }
@@ -1119,9 +1217,9 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             if (studentRegistration.getMusicGroupStatus() == StudentMusicGroupStatusEnum.APPLY) {
                 List<StudentPaymentOrder> oldStudentPaymentOrderList = this.queryByCondition(GroupType.MUSIC, musicGroupId, userId, SUCCESS, OrderTypeEnum.APPLY);
                 //判断是否有成功的订单,如果有,表示已经处理过人数
-                if (oldStudentPaymentOrderList == null || oldStudentPaymentOrderList.size() == 0) {
+                if (CollectionUtils.isEmpty(oldStudentPaymentOrderList)) {
                     List<StudentPaymentOrderDetail> orderDetail = studentPaymentOrderDetailService.getOrderDetail(order.getId());
-                    if (orderDetail != null && orderDetail.size() > 0) {
+                    if (CollectionUtils.isNotEmpty(orderDetail)) {
                         long count = orderDetail.stream().filter(e -> e.getType() == OrderDetailTypeEnum.MUSICAL || e.getType() == OrderDetailTypeEnum.CLOUD_TEACHER).count();
                         MusicGroup musicGroup = musicGroupService.get(musicGroupId);
                         //如果购买了乐器或者云教练,或者不是会员团,那么关闭订单时人数减一
@@ -1260,14 +1358,18 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
             if (orderByOrderNo == null) {
                 throw new BizException("未找到原订单");
             }
+            HttpResponseResult result = this.checkRepeatPay(orderByOrderNo, true);
+            if (result.getCode() != 200) {
+                throw new BizException(result.getMsg());
+            }
             amount = orderByOrderNo.getActualAmount();
             balance = orderByOrderNo.getBalancePaymentAmount();
             // 已有订单,先关单
-            orderByOrderNo.setStatus(CLOSE);
+            /*orderByOrderNo.setStatus(CLOSE);
             orderByOrderNo.setMemo("关闭订单");
             this.update(orderByOrderNo);
             //退优惠券
-            sysCouponCodeService.quit(orderByOrderNo.getCouponCodeId());
+            sysCouponCodeService.quit(orderByOrderNo.getCouponCodeId());*/
         }
 
 
@@ -1327,7 +1429,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         studentGoodsSell.setGoodsJson(model.getOrderInfo());
         studentGoodsSell.setOrderNo(model.getOrderNo());
         List<Integer> couponIdList = model.getCouponIdList();
-        if (couponIdList != null && couponIdList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(couponIdList)) {
             studentGoodsSell.setCouponIds(StringUtils.join(couponIdList, ","));
         }
         studentGoodsSell.setTenantId(student.getTenantId());
@@ -1418,13 +1520,13 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
                         long count = goodsOrderItemVOS.stream().filter(e -> StringUtils.isEmpty(e.getOrderSn())).count();
                         //如果有空的商品货号,不处理
                         if(count == 0l){
-                            List<String> productSns = goodsOrderItemVOS.stream().map(e -> e.getProductSn()).distinct().collect(Collectors.toList());
+                            List<String> productSns = goodsOrderItemVOS.stream().map(GoodsOrderItemVO::getProductSn).distinct().collect(Collectors.toList());
                             List<Goods> goodsList = goodsService.getGoodsDao().findBySns(productSns);
                             //如果有不匹配的商品货号,不处理
                             if(CollectionUtils.isEmpty(goodsList) || goodsList.size() < productSns.size()){
                                 return;
                             }
-                            Map<String, Goods> goodsSnMap = goodsList.stream().collect(Collectors.groupingBy(e -> e.getSn(),
+                            Map<String, Goods> goodsSnMap = goodsList.stream().collect(Collectors.groupingBy(Goods::getSn,
                                     Collectors.collectingAndThen(Collectors.toList(), v -> v.get(0))));
                             List<StudentPaymentOrderDetail> orderDetails = new ArrayList<>();
                             List<SellOrder> sellOrders = new ArrayList<>();
@@ -1685,12 +1787,52 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public OrderCancelModel cancelOrder(StudentPaymentOrder order, String reason) {
         OrderCancelModel model = new OrderCancelModel();
         model.setSuccess(true);
         try {
-            HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(order.getTenantId(), order.getPaymentChannel());
+            String errorMessage = null;
+            BasePaymentService paymentService = paymentServiceContext.getPaymentService(order.getPaymentChannel() + "_" + order.getTenantId());
+            if (paymentService == null) {
+                throw new BizException("支付渠道不支持:{}", order.getPaymentChannel());
+            }
+            PaymentResp paymentResp = paymentService.query(order.getTransNo(), order.getOrderNo());
+            if (paymentResp == null) {
+                throw new BizException("订单支付状态获取异常,稍后请重试,transNo:{},orderNo:{},paymentChannel:{}", order.getTransNo(), order.getOrderNo(), order.getPaymentChannel());
+            }
+            if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED) {
+                model.setStatus(true);
+                order.setStatus(SUCCESS);
+            } else if (paymentResp.getPaymentStatus() == PaymentStatus.PENDDING) {
+                // 执行关单操作
+                PaymentClose paymentClose = paymentService.close(order.getTransNo(), reason, order.getOrderNo());
+                model.setSuccess(false);
+                if (Objects.nonNull(paymentClose)) {
+                    model.setMessage(paymentClose.getMsg());
+                    errorMessage = paymentClose.getMsg();
+                    // 订单取消,三方返回异常信息
+                    if (StringUtils.isNotEmpty(errorMessage)) {
+                        log.warn("cancelPayment orderNo={}, ex={}", order.getOrderNo(), errorMessage);
+                        // 记录异常消息
+                        ThreadPool.getExecutor().submit(() -> {
+                            order.setMemo(paymentClose.getMsg());
+                            // 更新订单关单异常信息
+                            studentPaymentOrderDao.update(order);
+                        });
+                    }else {
+                        model.setSuccess(true);
+                    }
+                }
+                model.setStatus(false);
+                order.setStatus(CLOSE);
+            }else {
+                model.setStatus(false);
+                order.setStatus(CLOSE);
+                order.setMemo(reason);
+            }
+
+            /*HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(order.getTenantId(), order.getPaymentChannel());
             if(hfMerchantConfig == null){
                 throw new BizException("机构[{}]汇付商户信息找不到", order.getTenantId());
             }
@@ -1738,7 +1880,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
                 order.setStatus(CLOSE);
                 model.setSuccess(success);
                 model.setMessage(closeInfo.get("msg"));
-            }
+            }*/
             if (model.getSuccess()) {
                 TenantContextHolder.setTenantId(order.getTenantId());
                 callOrderCallBack(order);
@@ -1753,28 +1895,48 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     }
 
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public BaseResult<Map<String, Object>> refund(String orderNo, String notifyUrl, String refundNo) {
 
-        StudentPaymentOrder orderByOrderNo = this.findOrderByOrderNo(orderNo);
-        if (orderByOrderNo == null) {
+        StudentPaymentOrder paymentOrder = this.findOrderByOrderNo(orderNo);
+        if (paymentOrder == null) {
             throw new BizException("为找到订单");
         }
-        if (orderByOrderNo.getActualAmount().compareTo(BigDecimal.ZERO) ==0) {
+        if (paymentOrder.getActualAmount().compareTo(BigDecimal.ZERO) ==0) {
             throw new BizException("0元订单");
         }
-
+        BasePaymentService paymentService = paymentServiceContext.getPaymentService(paymentOrder.getPaymentChannel() + "_" + paymentOrder.getTenantId());
+        if (paymentService == null) {
+            throw new BizException("支付渠道不支持:{}", paymentOrder.getPaymentChannel());
+        }
+        RefundOrder refundOrder = new RefundOrder();
+        refundOrder.setUserId(paymentOrder.getUserId().toString());
+        refundOrder.setMerOrderNo(refundNo);
+        refundOrder.setRefundAmount(paymentOrder.getActualAmount());
+        refundOrder.setOrderAmount(paymentOrder.getActualAmount());
+        refundOrder.setTransNo(paymentOrder.getTransNo());
+        refundOrder.setPaymentOrderNo(paymentOrder.getOrderNo());
+        RefundResp refundResp = paymentService.refund(refundOrder);
+        // 申请请求失败
+        if (PaymentStatus.FAILED == refundResp.getPaymentStatus()) {
+            return BaseResult.failed(refundResp.getMsg());
+        } else {
+            Map<String,Object> param = new HashMap<>();
+            param.put("refundNo",refundNo);
+            return BaseResult.succeed(param);
+        }
+/*
         HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(orderByOrderNo.getTenantId(), orderByOrderNo.getPaymentChannel());
         if(hfMerchantConfig == null){
             throw new BizException("请配置机构的汇付商户信息");
         }
         return Payment.reversePayment(orderByOrderNo.getTransNo(),hfMerchantConfig.getAppId(),refundNo,
-                               orderByOrderNo.getActualAmount().setScale(2,BigDecimal.ROUND_HALF_UP).toString(),notifyUrl);
+                               orderByOrderNo.getActualAmount().setScale(2, RoundingMode.HALF_UP).toString(),notifyUrl);*/
     }
 
     @Override
-    public Map couponAmount(MallCreateOrderModel model) {
-        Map payMap = new HashMap();
+    public Map<String,Object> couponAmount(MallCreateOrderModel model) {
+        Map<String,Object> payMap = new HashMap(2);
         StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(model.getCouponIdList(), model.getAmount(),false);
         payMap.put("mallCouponAmount",studentPaymentOrder.getCouponRemitFee() == null?BigDecimal.ZERO:studentPaymentOrder.getCouponRemitFee());
         payMap.put("mallStatus",1);
@@ -1820,7 +1982,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
                 && e.getGroupType() != GroupType.MEMBER
                 && e.getGroupType() != GroupType.ACTIVITY
                 && e.getGroupType() != GroupType.VIP
-                && e.getGroupType() != GroupType.LIVE).map(e -> e.getId()).collect(Collectors.toList());
+                && e.getGroupType() != GroupType.LIVE).map(StudentPaymentOrder::getId).collect(Collectors.toList());
         Map<Long, List<StudentPaymentOrderExportDto>> feeByTypeMap = new HashMap<>();
         Map<Long, BigDecimal> childRepairMap = new HashMap<>();
         if (!org.springframework.util.CollectionUtils.isEmpty(otherOrderIds)) {
@@ -1831,7 +1993,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         //获取外部订单,将学校商品采购划分为大件乐器
         Map<String, StudentPaymentRouteOrder> routeOrderMap = new HashMap<>();
         List<String> outOrderNos = studentPaymentOrderExportDtos.stream().filter(e -> e.getGroupType() == GroupType.OUTORDER && e.getType() == OrderTypeEnum.SCHOOL)
-        .map(e -> e.getOrderNo()).collect(Collectors.toList());
+        .map(StudentPaymentOrder::getOrderNo).collect(Collectors.toList());
         if(CollectionUtils.isNotEmpty(outOrderNos)){
             List<StudentPaymentRouteOrder> routeOrders = studentPaymentRouteOrderService.getDao().queryByOrderNos(outOrderNos);
             if (CollectionUtils.isNotEmpty(routeOrders)){
@@ -1843,7 +2005,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
 //        List<Integer> organIds = studentPaymentOrderExportDtos.stream().map(e -> e.getOrganId()).distinct().collect(Collectors.toList());
         Map<Integer, String> userOrganNameMap = this.getMap("organization","id_","name_",true,1,Integer.class,String.class);
         //按分部分组
-        Map<Integer, List<StudentPaymentOrderExportDto>> listMap = studentPaymentOrderExportDtos.stream().collect(Collectors.groupingBy(e -> e.getOrganId()));
+        Map<Integer, List<StudentPaymentOrderExportDto>> listMap = studentPaymentOrderExportDtos.stream().collect(Collectors.groupingBy(StudentPaymentOrder::getOrganId));
         List<OperatingTotalIncomeDto> incomeDtos = new ArrayList<>();
         //承担课程的云教练收入
         String month = params.get("month").toString();
@@ -1945,15 +2107,14 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
                                 row.setDegreeFee(row.getActualAmount());
                             }else {
                                 String[] feeTypes = row.getMemo().split(";");
-                                List<String> feeTypeList = Arrays.asList(feeTypes);
-                                for (String feeTypeStr : feeTypeList) {
+                                for (String feeTypeStr : feeTypes) {
                                     int index = feeTypeStr.lastIndexOf(":");
                                     if (index < 0) {
                                         continue;
                                     }
                                     BigDecimal typeFee = new BigDecimal(feeTypeStr.substring(index + 1));
                                     if (row.getExpectAmount().compareTo(BigDecimal.ZERO) > 0) {
-                                        typeFee = typeFee.multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, BigDecimal.ROUND_DOWN);
+                                        typeFee = typeFee.multiply(row.getActualAmount()).divide(row.getExpectAmount(), 2, RoundingMode.DOWN);
                                     }
                                     if (feeTypeStr.contains("VIP")) {
                                         row.setVipCourseFee(typeFee);
@@ -2131,7 +2292,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         if (CollectionUtils.isEmpty(orderSkuSyncs)) {
             return;
         }
-        List<String> orderNos = orderSkuSyncs.stream().map(e -> e.getOrderNo()).collect(Collectors.toList());
+        List<String> orderNos = orderSkuSyncs.stream().map(OrderSkuSync::getOrderNo).collect(Collectors.toList());
         List<SellOrder> sellOrders = sellOrderDao.queryByOrganNos(orderNos);
         if (CollectionUtils.isEmpty(sellOrders)) {
             return;

+ 31 - 27
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -36,7 +36,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.annotation.Resource;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.*;
@@ -54,7 +53,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 
     private static final Logger LOGGER = LoggerFactory.getLogger(StudentRegistrationServiceImpl.class);
 
-    @Resource
+    @Autowired
     private StudentRegistrationDao studentRegistrationDao;
     @Autowired
     private StudentPaymentOrderService studentPaymentOrderService;
@@ -235,18 +234,18 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         if (studentRegistration == null) {
             throw new BizException("学员信息不存在");
         }
-        
+
         Student student = studentService.get(userId);
         if(student == null){
         	throw new BizException("用户[{}]信息获取失败", userId);
         }
-        
+
         if(!StringUtils.equals(student.getSubjectIdList(), subId+"")){
         	student.setSubjectIdList(subId + "");
         	student.setUpdateTime(new Date());
         	studentService.update(student);
         }
-        
+
         //批量调剂(未缴费学员)
         int i = studentRegistrationDao.batchUpdateSubject(userId, subId, musicGroupId);
         if (i > 0) {
@@ -539,16 +538,16 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                                         MusicGroupApplyGoodsDto goodsDto,
                                         RegisterPayDto registerPayDto,
                                         CouponPayParam couponPayParam) throws Exception {
-    	
+
         MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
-        
+
         if(musicGroup == null){
         	throw new BizException("乐团[{}]信息查询失败", studentRegistration.getMusicGroupId());
         }
         MusicGroupPaymentCalender calender = musicGroupPaymentCalenderDao.get(studentPaymentOrder.getCalenderId());
 
         boolean isGiveAccessories = musicGroup.getIsGiveAccessories() != null && musicGroup.getIsGiveAccessories();
-        
+
         Date date = new Date();
         List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
         //乐器及打包辅件
@@ -558,9 +557,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         BigDecimal remitFee = goodsDto.getRemitFee();
         Boolean buyCloudTeacher = CollectionUtils.isNotEmpty(registerPayDto.getBuyCalenderMemberId());
         if (CollectionUtils.isNotEmpty(goodsGroups)) {
-        	
+
         	BigDecimal organShareProfit = BigDecimal.ZERO;
-        	
+
             for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
                 StudentPaymentOrderDetail studentPaymentOrderDetail4goodsGroup = new StudentPaymentOrderDetail();
                 studentPaymentOrderDetail4goodsGroup.setRemitFee(BigDecimal.ZERO);
@@ -577,7 +576,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentPaymentOrderDetail4goodsGroup.setType(type);
 
                 BigDecimal goodsPrice = new BigDecimal(0);
-                
+
 				if (!(type == OrderDetailTypeEnum.ACCESSORIES && (isGiveAccessories && buyCloudTeacher))) {
 
 	                if (studentRegistration.getOrganId() == 55 && musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE && !buyCloudTeacher) {
@@ -602,7 +601,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 if (OrderDetailTypeEnum.MUSICAL.equals(type)) {
                     maintenanceGoodsId = goodsGroup.getGoodsIdList();
                 }
-                
+
                 if(goodsGroup.getOrganShareProfit() != null && goodsGroup.getKitGroupPurchaseType() == KitGroupPurchaseTypeEnum.GROUP){
                 	organShareProfit = organShareProfit.add(goodsGroup.getOrganShareProfit());
                 }
@@ -1383,19 +1382,20 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             } catch (Exception e) {
                 LOGGER.error("协议生成失败", e);
             }
-            
+
         }
 
-        if (studentPaymentOrder.getStatus().equals(DealStatusEnum.FAILED)) {
+        if (studentPaymentOrder.getStatus().equals(DealStatusEnum.FAILED) || studentPaymentOrder.getStatus().equals(DealStatusEnum.CLOSE)) {
             MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
             studentRegistration.setPayingStatus(0);
             studentRegistrationDao.update(studentRegistration);
             //减去缴费人数(器乐收费,0元时不减缴费人数)
             studentPaymentOrderService.cutSubjectPlan(studentPaymentOrder);
-            
+
             //增加商品库存
             List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(studentPaymentOrder.getId());
-            String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
+            String goodsIds = studentPaymentOrderDetailList.stream().map(StudentPaymentOrderDetail::getMinuendStockGoodsIdList)
+                    .filter(StringUtils::isNotBlank).collect(Collectors.joining(","));
             if(StringUtils.isNotBlank(goodsIds)){
 //            	GoodsProcurement goodsProcurement = null;
             	List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
@@ -1403,7 +1403,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             	Goods goods = null;
     			Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
 //    			Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
-            	
+
             	for(String goodsIdStr : goodsIds.split(",")){
             		if(StringUtils.isBlank(goodsIdStr)){
 						continue;
@@ -1415,9 +1415,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 //					goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
 					goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
 					goods.setUpdateTime(nowDate);
-					
+
 					batchUpdateGoodsMap.put(goods.getId(), goods);
-					
+
 					// 进货清单
 					/*goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
 					if(goodsProcurement != null){
@@ -1428,14 +1428,14 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
 						goodsProcurement.setUpdateTime(nowDate);
 						goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
 					}*/
-					
+
             	}
-            	
+
             	/*if(goodsProcurementMap.size() > 0){
             		goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
             	}*/
-                
-                if(batchUpdateGoodsMap.size() > 0){
+
+                if(!batchUpdateGoodsMap.isEmpty()){
                 	goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
                 }
             }
@@ -1548,13 +1548,17 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentInfo.setCurrentClass(studentRegistration.getCurrentClass());
         studentDao.update(studentInfo);
         // 添加用户电子签章账户
-        contractService.register(student.getUserId(), student.getParentsName(), student.getIdCardNo(), student.getParentsPhone());
+//        contractService.register(student.getUserId(), student.getParentsName(), student.getIdCardNo(), student.getParentsPhone());
         return student;
     }
 
     @Override
     public StudentRegistration queryUserByPhone(String mobile) {
-        return studentRegistrationDao.queryUserByPhone(mobile);
+        StudentRegistration studentRegistration = studentRegistrationDao.queryUserByPhone(mobile);
+        if (studentRegistration != null) {
+            studentRegistration.setCurrentGrade(FivePlusGradeEnum.getByGradeNum(studentRegistration.getCurrentGradeNum()).getDesc());
+        }
+        return studentRegistration;
     }
 
     @Override
@@ -1848,10 +1852,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         for (MusicGroupPaymentCalender regCalender : regCalenders) {
             viewMap.put(regCalender.getMusicGroupId(), true);
         }
-        
+
         //判断乐团是否开课
         List<MusicGroup> musicGroupList = musicGroupDao.getMusicGroupByIds(ids);
-        
+
         for(MusicGroup mg : musicGroupList){
         	if (viewMap.containsKey(mg.getId()) && mg.getFirstCourseStartTime() != null) {
                 viewMap.remove(mg.getId());

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

@@ -16,8 +16,10 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.RepairStudentQueryInfo;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.dto.BrandDto;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.page.QueryInfo;
@@ -33,6 +35,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Propagation;
@@ -46,7 +49,8 @@ import java.util.stream.Collectors;
 
 import static com.ym.mec.biz.dal.enums.CouponDetailTypeEnum.ACCESSORIES;
 import static com.ym.mec.biz.dal.enums.CouponDetailTypeEnum.MUSICAL;
-import static com.ym.mec.biz.dal.enums.DealStatusEnum.*;
+import static com.ym.mec.biz.dal.enums.DealStatusEnum.ING;
+import static com.ym.mec.biz.dal.enums.DealStatusEnum.SUCCESS;
 
 @Service
 public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRepair> implements StudentRepairService {
@@ -157,7 +161,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
-    public Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception {
+    public HttpResponseResult addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception {
         //关闭老订单
         StudentPaymentOrderAddress studentPaymentOrderAddress = null;
         if (StringUtils.isNotBlank(studentGoodsSell.getAddress())) {
@@ -169,7 +173,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
         if (StringUtils.isNotEmpty(studentGoodsSell.getOrderNo())) {
             StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(studentGoodsSell.getOrderNo());
-            if (orderByOrderNo.getBalancePaymentAmount() != null && orderByOrderNo.getBalancePaymentAmount().longValue() != 0l) {
+            if (orderByOrderNo.getBalancePaymentAmount() != null && orderByOrderNo.getBalancePaymentAmount().longValue() != 0L) {
                 studentGoodsSell.setIsUseBalancePayment(true);
             } else {
                 studentGoodsSell.setIsUseBalancePayment(false);
@@ -178,15 +182,19 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             if (orderByOrderNo.getStatus() == SUCCESS) {
                 throw new BizException("您已支付请勿重复提交");
             } else if (orderByOrderNo.getStatus() == ING) {
+                HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(orderByOrderNo, true);
+                if (result.getCode() != 200) {
+                    return result;
+                }
 
                 // 查询订单状态
-                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(orderByOrderNo);
+                /*PayStatus payStatus = studentPaymentOrderService.queryPayStatus(orderByOrderNo);
                 if (payStatus != PayStatus.FAILED) {
                     if (payStatus == PayStatus.SUCCESSED) {
                         throw new BizException("订单已支付成功,请勿重复支付");
-                    }/*else if(payStatus == PayStatus.PAYING){
+                    }*//*else if(payStatus == PayStatus.PAYING){
                 		throw new BizException("订单还在交易中,请稍后重试");
-                	}*/
+                	}*//*
                 }
 
                 orderByOrderNo.setStatus(CLOSE);
@@ -200,7 +208,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 Date nowDate = new Date();
                 //增加商品库存
                 List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(orderByOrderNo.getId());
-                String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
+                String goodsIds = studentPaymentOrderDetailList.stream().map(StudentPaymentOrderDetail::getMinuendStockGoodsIdList).filter(StringUtils::isNotBlank).collect(Collectors.joining(","));
                 if (StringUtils.isNotBlank(goodsIds)) {
 //                    GoodsProcurement goodsProcurement = null;
                     List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
@@ -224,7 +232,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                         batchUpdateGoodsMap.put(goods.getId(), goods);
 
                         // 进货清单
-                        /*goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
+                        *//*goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
                         if (goodsProcurement != null) {
                             if (goodsProcurementMap.get(goodsProcurement.getId()) != null) {
                                 goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
@@ -232,18 +240,18 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                             goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
                             goodsProcurement.setUpdateTime(nowDate);
                             goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
-                        }*/
+                        }*//*
 
                     }
 
-                    /*if (goodsProcurementMap.size() > 0) {
+                    *//*if (goodsProcurementMap.size() > 0) {
                         goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
-                    }*/
+                    }*//*
 
                     if (batchUpdateGoodsMap.size() > 0) {
                         goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
                     }
-                }
+                }*/
             }
             StudentGoodsSell byOrderNo = studentGoodsSellDao.findByOrderNo(studentGoodsSell.getOrderNo());
             if (byOrderNo != null) {
@@ -326,7 +334,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         String orderNo = idGeneratorService.generatorId("payment") + "";
         studentGoodsSell.setOrderNo(orderNo);
         List<Integer> couponIdList = studentGoodsSell.getCouponIdList();
-        if (couponIdList != null && couponIdList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(couponIdList)) {
             studentGoodsSell.setCouponIds(StringUtils.join(couponIdList, ","));
         }
         studentGoodsSell.setTenantId(student.getTenantId());
@@ -339,7 +347,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         if (studentGoodsSell.getType() == 1) {
             Map<String, Object> repairInfoMap = new HashMap<>();
             MapUtil.populateMap(repairInfoMap, studentGoodsSell);
-            return repairInfoMap;
+            return BaseController.succeed(repairInfoMap);
         }
 
         studentPaymentOrder.setUserId(studentId);
@@ -380,7 +388,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
             studentPaymentOrderService.updateOrder(notifyMap);
             notifyMap.put("orderNo", orderNo);
-            return notifyMap;
+            return BaseController.failed(HttpStatus.CREATED, notifyMap,"恭喜您,购买成功!");
         }
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
@@ -399,18 +407,18 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
         studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
         studentPaymentOrderService.update(studentPaymentOrder);
-        return payMap;
+        return BaseController.succeed(payMap);
     }
 
 
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
-    public Map studentPaymentGoodsOrder(Integer goodsSellId) throws Exception {
+    public HttpResponseResult studentPaymentGoodsOrder(Integer goodsSellId) throws Exception {
         StudentGoodsSell studentGoodsSell = studentGoodsSellDao.get(goodsSellId);
         Integer studentId = studentGoodsSell.getUserId();
         studentService.getDao().lockUser(studentId);
         List<GoodsSellDto> goodsSellDtos = JSONObject.parseArray(studentGoodsSell.getGoodsJson(), GoodsSellDto.class);
-        List<Integer> goodsIds = goodsSellDtos.stream().map(e -> e.getGoodsId()).collect(Collectors.toList());
+        List<Integer> goodsIds = goodsSellDtos.stream().map(GoodsSellDto::getGoodsId).collect(Collectors.toList());
         Map<Integer, String> integerStringMap = getMap("goods", "id_", "type_", goodsIds, studentGoodsSell.getTenantId(), Integer.class, String.class);
         Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds, studentGoodsSell.getTenantId(), Integer.class, BigDecimal.class);
         for (GoodsSellDto goodsSellDto : goodsSellDtos) {
@@ -439,7 +447,11 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         if (StringUtils.isNotEmpty(orderNo1)) {
             studentPaymentOrder = studentPaymentOrderService.findOrderByOrderNo(orderNo1);
             if (studentPaymentOrder != null) {
-                if (studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS) {
+                HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(studentPaymentOrder, true);
+                if (result.getCode() != 200) {
+                    return result;
+                }
+                /*if (studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS) {
                     throw new BizException("该订单已支付");
                 }
                 //关闭老订单
@@ -453,7 +465,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
                     sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "关闭订单");
                 }
-                sysCouponCodeService.quit(studentPaymentOrder.getCouponCodeId());
+                sysCouponCodeService.quit(studentPaymentOrder.getCouponCodeId());*/
             }
         }
         studentGoodsSellDao.update(studentGoodsSell);
@@ -501,7 +513,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
             studentPaymentOrderService.updateOrder(notifyMap);
             notifyMap.put("orderNo", orderNo);
-            return notifyMap;
+            return BaseController.failed(HttpStatus.CREATED, notifyMap,"恭喜您,购买成功!");
         }
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
@@ -520,7 +532,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
         studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
         studentPaymentOrderService.update(studentPaymentOrder);
-        return payMap;
+        return BaseController.succeed(payMap);
     }
 
     @Override
@@ -566,7 +578,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         String goodsJson = repairInfo.getGoodsJson();
         if (StringUtils.isNotEmpty(goodsJson)) {
             repairGoodsDtos = JSONObject.parseArray(goodsJson, RepairGoodsDto.class);
-            List<Integer> goodsIds = repairGoodsDtos.stream().map(e -> e.getId()).collect(Collectors.toList());
+            List<Integer> goodsIds = repairGoodsDtos.stream().map(RepairGoodsDto::getId).collect(Collectors.toList());
             Map<Integer, BigDecimal> map = getMap("goods", "id_", "discount_price_", goodsIds, student.getTenantId(), Integer.class, BigDecimal.class);
             repairGoodsDtos.forEach(e -> {
                 e.setGroupPurchasePrice(map.get(e.getId()));
@@ -593,7 +605,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         }
         StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(couponIdList, amount, repairInfo.getType() != 1);
         amount = studentPaymentOrder.getActualAmount();
-        if (couponIdList != null && couponIdList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(couponIdList)) {
             repairInfo.setCouponIds(StringUtils.join(couponIdList, ","));
         }
         studentRepairDao.insert(repairInfo);
@@ -797,7 +809,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         StudentRepair repairInfo = studentRepairDao.getRepairInfo(id);
         String couponIds = repairInfo.getCouponIds();
         if (StringUtils.isNotEmpty(couponIds)) {
-            List<Integer> collect = Arrays.stream(couponIds.split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
+            List<Integer> collect = Arrays.stream(couponIds.split(",")).map(Integer::valueOf).collect(Collectors.toList());
             repairInfo.setCouponCodeDtos(sysCouponCodeService.findByIdList(collect));
         }
         String goodsJson = repairInfo.getGoodsJson();
@@ -835,7 +847,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         String goodsJson = studentRepair.getGoodsJson();
         if (StringUtils.isNotEmpty(goodsJson)) {
             repairGoodsDtos = JSONObject.parseArray(goodsJson, RepairGoodsDto.class);
-            BigDecimal reduce = repairGoodsDtos.stream().map(e -> e.getGroupPurchasePrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
+            BigDecimal reduce = repairGoodsDtos.stream().map(RepairGoodsDto::getGroupPurchasePrice).reduce(BigDecimal.ZERO, BigDecimal::add);
             amount = amount.add(reduce);
         }
         amount = amount.subtract(studentRepair.getExemptionAmount());
@@ -952,7 +964,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             }
         }
 
-        if (studentPaymentOrderDetailList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(studentPaymentOrderDetailList)) {
             studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
         }
 
@@ -987,11 +999,11 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
 
-        Map<String, BigDecimal> classFee = new HashMap<>();
+        /*Map<String, BigDecimal> classFee = new HashMap<>();
         classFee.put("course", BigDecimal.ZERO);
         classFee.put("instrument", BigDecimal.ZERO);
         classFee.put("accessories", BigDecimal.ZERO);
-        classFee.put("other", amount);
+        classFee.put("other", amount);*/
 
         Map payMap = payService.getPayMap(
                 amount,
@@ -1080,7 +1092,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
             //增加商品库存
             List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(studentPaymentOrder.getId());
-            String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
+            String goodsIds = studentPaymentOrderDetailList.stream().map(StudentPaymentOrderDetail::getMinuendStockGoodsIdList).filter(StringUtils::isNotBlank).collect(Collectors.joining(","));
             if (StringUtils.isNotBlank(goodsIds)) {
 //                GoodsProcurement goodsProcurement = null;
                 List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
@@ -1120,7 +1132,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                     goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
                 }*/
 
-                if (batchUpdateGoodsMap.size() > 0) {
+                if (!batchUpdateGoodsMap.isEmpty()) {
                     goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
                 }
             }
@@ -1241,7 +1253,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             if (repairInfo.getType().equals(1)) { //线上
                 imContent = repairInfo.getStudentName() + "学员您好,请尽快寄送乐器至维修点,我们会尽快完成保养维修\n" +
                         "联系人:" + repairInfo.getEmployeeName() + "(" + repairInfo.getEmployeePhone() + ")\n" +
-                        "地址:" + repairInfo.getEmployeeAddress() + "";
+                        "地址:" + repairInfo.getEmployeeAddress();
 
                 sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_REPAIR_ONLINE_PAYMENT_SUCCESS, map, null, 0, null, "STUDENT",
                         repairInfo.getStudentName(), repairInfo.getEmployeeName(), repairInfo.getEmployeePhone(), repairInfo.getEmployeeAddress());

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

@@ -6,7 +6,9 @@ import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.SubjectChangeQueryInfo;
 import com.ym.mec.biz.service.*;
+import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.IdGeneratorService;
@@ -14,15 +16,16 @@ 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 org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
+import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -134,15 +137,19 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Map payChange(SubjectChangeParamDto subjectChangeParamDto) throws Exception {
+    public HttpResponseResult payChange(SubjectChangeParamDto subjectChangeParamDto) throws Exception {
         Date date = new Date();
         SubjectChange subjectChange = subjectChangeDao.get(subjectChangeParamDto.getId());
         if (subjectChangeParamDto.getRepay()) {
             StudentPaymentOrder studentPaymentOrder = studentPaymentOrderService.get(subjectChange.getOrderId().longValue());
 
             if (studentPaymentOrder != null && studentPaymentOrder.getStatus() == DealStatusEnum.ING) {
+                HttpResponseResult result = studentPaymentOrderService.checkRepeatPay(studentPaymentOrder, true);
+                if (result.getCode() != 200) {
+                    return result;
+                }
                 // 查询订单状态
-                PayStatus payStatus = studentPaymentOrderService.queryPayStatus(studentPaymentOrder);
+                /*PayStatus payStatus = studentPaymentOrderService.queryPayStatus(studentPaymentOrder);
                 if (payStatus == PayStatus.SUCCESSED) {
                     throw new BizException("订单已支付成功,请勿重复支付");
                 }
@@ -176,7 +183,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         				batchUpdateGoodsMap.put(goods.getId(), goods);
         				
         				// 进货清单
-        				/*goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
+        				*//*goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
         				if(goodsProcurement != null){
         					if(goodsProcurementMap.get(goodsProcurement.getId()) != null){
         						goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
@@ -184,18 +191,18 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         					goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
         					goodsProcurement.setUpdateTime(date);
         					goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
-        				}*/
+        				}*//*
         				
                 	}
                 	
-                	/*if(goodsProcurementMap.size() > 0){
+                	*//*if(goodsProcurementMap.size() > 0){
                 		goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
-                	}*/
+                	}*//*
                     
                     if(batchUpdateGoodsMap.size() > 0){
                     	goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
                     }
-                }
+                }*/
             }
         }
 
@@ -209,7 +216,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         HashSet<String> musicGroupIds = new HashSet<>();
         musicGroupIds.add(subjectChange.getMusicGroupId());
         List<MusicGroupPurchaseList> musicGroupPurchaseListCount = musicGroupPurchaseListDao.getCount(musicGroupIds);
-        if (musicGroupPurchaseListCount.size() > 0) {
+        if (CollectionUtils.isNotEmpty(musicGroupPurchaseListCount)) {
             throw new BizException("乐团当前状态不能缴声部更改费用");
         }
         BigDecimal amount = subjectChange.getGoodsMargin().add(subjectChange.getCourseMargin());
@@ -289,12 +296,12 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         	}
         }
     	
-    	if(subjectChange.getChangeMusical() != subjectChange.getOriginalMusical()){
+    	if(!Objects.equals(subjectChange.getChangeMusical(), subjectChange.getOriginalMusical())){
     		changeGoodsList.add(subjectChange.getChangeMusical()+"");
     	}
         
-        if(changeGoodsList.size() > 0){
-            String goodsIdsStr = changeGoodsList.stream().map(t -> t.toString()).collect(Collectors.joining(","));
+        if(CollectionUtils.isNotEmpty(changeGoodsList)){
+            String goodsIdsStr = String.join(",", changeGoodsList);
         	List<Goods> goodsList = goodsService.findGoodsByIds(goodsIdsStr);
         	Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
         	Goods goods = null;
@@ -361,7 +368,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
                 studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
         	}
             
-            if(studentPaymentOrderDetailList.size() > 0){
+            if(CollectionUtils.isNotEmpty(studentPaymentOrderDetailList)){
             	studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
             }
         }
@@ -375,7 +382,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
             notifyMap.put("orderNo", "");
             studentPaymentOrderService.updateOrder(notifyMap);
             notifyMap.put("orderNo", orderNo);
-            return notifyMap;
+            return BaseController.failed(HttpStatus.CREATED, notifyMap, "恭喜您,支付成功!");
         }
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
@@ -395,7 +402,7 @@ public class SubjectChangeServiceImpl extends BaseServiceImpl<Integer, SubjectCh
         studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
         studentPaymentOrder.setUpdateTime(date);
         studentPaymentOrderService.update(studentPaymentOrder);
-        return payMap;
+        return BaseController.succeed(payMap);
     }
 
     @Override

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

@@ -315,7 +315,8 @@ public class SubjectServiceImpl extends BaseServiceImpl<Integer, Subject> implem
         List<StudentSubjectDto> subjects = subjectDao.getSubjectByStudentId(studentIds);
         Map<Integer, StudentSubjectDto> map = new HashMap<>();
         if (!CollectionUtils.isEmpty(subjects)) {
-            map = subjects.stream().collect(Collectors.toMap(StudentSubjectDto::getStudentId, Function.identity()));
+            map = subjects.stream().filter(o->o.getSubjectId() !=null)
+                    .collect(Collectors.toMap(StudentSubjectDto::getStudentId, Function.identity()));
         }
         return map;
     }

+ 34 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreServiceImpl.java

@@ -808,4 +808,38 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
             throw new BizException("内容平台服务异常");
         }
     }
+
+    /**
+     * 获取所有乐器编码
+     *
+     * @return List<MusicSheetWrapper.InstrumentCode>
+     */
+    @Override
+    public List<MusicSheetWrapper.InstrumentCode> getAllInstrumentCode() {
+
+        // 构建乐器编码查询参数
+        CbsMusicalInstrumentWrapper.MusicalInstrumentQuery musicalInstrumentQuery = new CbsMusicalInstrumentWrapper.MusicalInstrumentQuery();
+        musicalInstrumentQuery.setPage(1);
+        musicalInstrumentQuery.setRows(999);
+
+        // 调用音乐服务查询乐器编码
+        List<CbsMusicalInstrumentWrapper.MusicalInstrumentQueryDto> rows = musicFeignClientService.musicalInstrumentPage(musicalInstrumentQuery).feignData().getRows();
+        if (CollectionUtils.isEmpty(rows)) {
+            return Collections.emptyList();
+        }
+
+        return rows.stream().map(x -> {
+            // 构建乐器编码
+            return MusicSheetWrapper.InstrumentCode.builder()
+                .id(x.getId())
+                .name(x.getName())
+                .code(x.getCode())
+                .subjectId(x.getSubjectId())
+                .subjectName(x.getSubjectName())
+                .orientation(x.getOrientation())
+                .transferFlag(x.getTransferFlag())
+                .build();
+        }).collect(Collectors.toList());
+
+    }
 }

+ 6 - 15
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherServiceImpl.java

@@ -11,7 +11,6 @@ import com.ym.mec.biz.dal.dao.ImUserFriendDao;
 import com.ym.mec.biz.dal.dao.MusicGroupDao;
 import com.ym.mec.biz.dal.dao.OrganizationDao;
 import com.ym.mec.biz.dal.dao.SchoolDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dao.StudentExtracurricularExercisesSituationDao;
 import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
 import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
@@ -19,18 +18,7 @@ import com.ym.mec.biz.dal.dao.StudentTeacherMapperDao;
 import com.ym.mec.biz.dal.dao.SubjectDao;
 import com.ym.mec.biz.dal.dao.SysUserCashAccountDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
-import com.ym.mec.biz.dal.dto.BaseMapDto;
-import com.ym.mec.biz.dal.dto.BasicUserDto;
-import com.ym.mec.biz.dal.dto.ImUserFriendDto;
-import com.ym.mec.biz.dal.dto.MusicGroupStudentApplyDto;
-import com.ym.mec.biz.dal.dto.MusicGroupTeacherAttendanceDto;
-import com.ym.mec.biz.dal.dto.MusicGroupTeachersDto;
-import com.ym.mec.biz.dal.dto.SysUserDto;
-import com.ym.mec.biz.dal.dto.TeacherBasicDto;
-import com.ym.mec.biz.dal.dto.TeacherCloseDto;
-import com.ym.mec.biz.dal.dto.TeacherDefaultSalaryDto;
-import com.ym.mec.biz.dal.dto.TeacherExercisesServiceDto;
-import com.ym.mec.biz.dal.dto.TeacherMusicStudentOverViewDto;
+import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.CourseHomework;
 import com.ym.mec.biz.dal.entity.ImUserFriend;
 import com.ym.mec.biz.dal.entity.MusicGroup;
@@ -54,6 +42,7 @@ import com.ym.mec.biz.service.TeacherService;
 import com.ym.mec.biz.service.TenantInfoService;
 import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.dto.RealnameAuthenticationDto;
 import com.ym.mec.common.entity.ImGroupModel;
 import com.ym.mec.common.entity.ImResult;
 import com.ym.mec.common.entity.ImUserModel;
@@ -65,7 +54,6 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.common.tenant.TenantContextHolder;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
-import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
 import com.ym.mec.util.idcard.IdcardValidator;
@@ -733,7 +721,10 @@ public class TeacherServiceImpl extends BaseServiceImpl<Integer, Teacher> implem
             throw new BizException("身份证校验失败");
         }
 
-        realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(realName, idcardNo);
+//        realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(realName, idcardNo);
+        // 取消第三方实名认证
+        RealnameAuthenticationDto.verify(realName, idcardNo);
+
 
         Date date = new Date();
 

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

@@ -259,7 +259,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
             //升级机构协议版本号
             tenantContractTemplateService.upgradeContractVersion(tenantId);
             //添加签章信息
-            contractService.addTsign(tenantInfo.getUserId(), dto.getTsignCode(), dto.getTsignName(), tenantId);
+//            contractService.addTsign(tenantInfo.getUserId(), dto.getTsignCode(), dto.getTsignName(), tenantId);
         }
 
         //机构状态 1已缴费,并且 机构注册的手机号与本次修改后的手机号不同,就证明本次修改了手机号 则需要修改机构的账号信息
@@ -461,7 +461,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();
 
@@ -666,6 +666,9 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
      * 获取协议变量参数
      */
     private Map<String, Object> getContractParam(TenantInfoPageVo tenantInfo) {
+        if (tenantInfo.getStudentUpLimit() == null) {
+            tenantInfo.setStudentUpLimit(0);
+        }
         //将数据转换为Map
         Map<String, Object> param = WrapperUtil.toMap(tenantInfo);
         //购买服务的时长单位
@@ -748,7 +751,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
         log.info("getContractAndUpLoad >>>>ok  tenantId:{} en:{} val:{}", tenantId, en, val);
         Date now = new Date();
         //创建PDF本次缓存地址
-        String srcPdfPath = contractBaseDir + lexiaoyaContract + DateUtils.formatDate(now, "yyyyMMddHHmmss") + "/" + tenantId + "_" + java.time.LocalDateTime.now().getSecond() + ".pdf";
+        String srcPdfPath = contractBaseDir + "/" + lexiaoyaContract + "/" + DateUtils.formatDate(now, "yyyyMMddHHmmss") + "/" + tenantId + "_" + java.time.LocalDateTime.now().getSecond() + ".pdf";
         //生成文件
         File srcFile = new File(srcPdfPath);
         if (!srcFile.getParentFile().exists()) {
@@ -761,7 +764,7 @@ public class TenantInfoServiceImpl extends ServiceImpl<TenantInfoDao, TenantInfo
             PDFUtil.renderToPDFByData(TenantInfoServiceImpl.class.getResource("/").getFile(), contractHtml, srcPdfPath, "simsun.ttc");
         } catch (IOException e) {
             FileUtils.deleteQuietly(srcFile);
-            throw new BizException("生成产品协议失败");
+            log.error("生成产品协议失败", e);
         }
         //上传到云服务器后获取上传地址
         String dateStrOss = DateUtils.formatDate(now, "yyyy/MM/dd");

+ 75 - 85
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantOrderRecordServiceImpl.java

@@ -1,79 +1,44 @@
 package com.ym.mec.biz.service.impl;
 
-import java.math.BigDecimal;
-import java.security.PrivateKey;
-import java.security.PublicKey;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Consumer;
-
-import com.alibaba.fastjson.JSONObject;
-import com.huifu.adapay.core.AdapayCore;
-import com.huifu.adapay.core.util.AdapaySign;
-import com.yeepay.g3.sdk.yop.encrypt.DigitalEnvelopeDTO;
-import com.yeepay.g3.sdk.yop.utils.DigitalEnvelopeUtils;
-import com.yeepay.g3.sdk.yop.utils.RSAKeyUtils;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.joda.time.LocalDateTime;
-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.transaction.annotation.Transactional;
-
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.microsvc.toolkit.middleware.payment.common.api.BasePaymentService;
+import com.microsvc.toolkit.middleware.payment.common.api.PaymentServiceContext;
+import com.microsvc.toolkit.middleware.payment.common.api.entity.PaymentResp;
+import com.microsvc.toolkit.middleware.payment.common.api.enums.PaymentStatus;
 import com.ym.mec.biz.dal.dao.CloudTeacherOrderDao;
 import com.ym.mec.biz.dal.dao.TenantOrderRecordDao;
 import com.ym.mec.biz.dal.dto.TenantOrderRecordDto;
-import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
-import com.ym.mec.biz.dal.entity.PlatformServe;
-import com.ym.mec.biz.dal.entity.PlatformServeDetail;
-import com.ym.mec.biz.dal.entity.TenantAssetsInfo;
-import com.ym.mec.biz.dal.entity.TenantConfig;
-import com.ym.mec.biz.dal.entity.TenantInfo;
-import com.ym.mec.biz.dal.entity.TenantOrderRecord;
-import com.ym.mec.biz.dal.entity.TenantProductInfo;
-import com.ym.mec.biz.dal.entity.TenantProxyDividend;
-import com.ym.mec.biz.dal.entity.TenantProxyUserRelation;
+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.PeriodEnum;
 import com.ym.mec.biz.dal.enums.TenantOrderRecordEnum;
-import com.ym.mec.biz.service.CloudTeacherOrderService;
-import com.ym.mec.biz.service.HfMerchantConfigService;
-import com.ym.mec.biz.service.PlatformServeDetailService;
-import com.ym.mec.biz.service.PlatformServeService;
-import com.ym.mec.biz.service.SysMessageService;
-import com.ym.mec.biz.service.TenantAssetsInfoService;
-import com.ym.mec.biz.service.TenantConfigService;
-import com.ym.mec.biz.service.TenantInfoService;
-import com.ym.mec.biz.service.TenantOrderRecordService;
-import com.ym.mec.biz.service.TenantProductInfoService;
-import com.ym.mec.biz.service.TenantProxyDividendService;
-import com.ym.mec.biz.service.TenantProxyUserRelationService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 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.adapay.entity.HfMerchantConfig;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.joda.time.LocalDateTime;
+import org.redisson.api.RBucket;
+import org.redisson.api.RedissonClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
-import javax.servlet.http.HttpServletRequest;
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
 
 /**
  * 机构付款记录表(TenantOrderRecord)表服务实现类
@@ -85,36 +50,34 @@ import javax.servlet.http.HttpServletRequest;
 public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordDao, TenantOrderRecord> implements TenantOrderRecordService {
     private static final Logger log = LoggerFactory.getLogger(TenantOrderRecordServiceImpl.class);
 
-    @Autowired
+    @Resource
     private TenantProductInfoService tenantProductInfoService;
-    @Autowired
+    @Resource
     private PlatformServeService platformServeService;
-    @Autowired
+    @Resource
     private PlatformServeDetailService platformServeDetailService;
-    @Autowired
+    @Resource
     private TenantInfoService tenantInfoService;
-    @Autowired
+    @Resource
     private RedissonClient redissonClient;
-    @Autowired
+    @Resource
     private TenantAssetsInfoService assetsInfoService;
-    @Autowired
+    @Resource
     private TenantConfigService tenantConfigService;
-    @Autowired
+    @Resource
     private SysMessageService sysMessageService;
-    @Autowired
+    @Resource
     private CloudTeacherOrderDao cloudTeacherOrderDao;
-    @Autowired
+    @Resource
     private CloudTeacherOrderService cloudTeacherOrderService;
-    @Autowired
+    @Resource
     private TenantProxyDividendService tenantProxyDividendService;
-    @Autowired
+    @Resource
     private TenantProxyUserRelationService tenantProxyUserRelationService;
-
-    @Autowired
-    private HfMerchantConfigService hfMerchantConfigService;
-    
-    @Autowired
+    @Resource
     private TenantOrderRecordDao tenantOrderRecordDao;
+    @Resource
+    private PaymentServiceContext paymentServiceContext;
 
     //订单不存在
     private static final String PAYMENT_ID_NOT_EXISTS = "payment_id_not_exists";
@@ -230,13 +193,13 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
 
     //开通成功
     @Transactional(rollbackFor = Exception.class)
-    private void open(TenantOrderRecord record) {
+    public void open(TenantOrderRecord record) {
         tenantInfoService.tenantOpenSuccess(record.getTenantId());
     }
 
     //续费成功
     @Transactional(rollbackFor = Exception.class)
-    private void renew(TenantOrderRecord record) {
+    public void renew(TenantOrderRecord record) {
         //机构产品信息
         TenantProductInfo productInfo = tenantProductInfoService.getOne(new WrapperUtil<TenantProductInfo>()
                 .hasEq("tenant_id_", record.getTenantId()).queryWrapper().eq("using_", 0));
@@ -355,7 +318,22 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
 
     //主动去第三方查询订单状态
     private void checkTransOrderState(TenantOrderRecord orderRecord) {
-        Map<String, Object> payment = new HashMap<String, Object>();
+        BasePaymentService paymentService = paymentServiceContext.getPaymentService(orderRecord.getPaymentChannel() + "_" + orderRecord.getTenantId());
+        if (paymentService == null) {
+            throw new BizException("支付渠道[{}]找不到", orderRecord.getPaymentChannel());
+        }
+        PaymentResp paymentResp = paymentService.query(orderRecord.getOrderNo(), orderRecord.getOrderNo());
+        if (Objects.isNull(paymentResp)) {
+            throw new BizException("订单支付状态获取异常,稍后请重试");
+        }
+        if (paymentResp.getPaymentStatus() == PaymentStatus.SUCCESSED) {
+            orderRecord.setOrderState(1);
+        }else if (paymentResp.getPaymentStatus() == PaymentStatus.PENDDING) {
+            orderRecord.setOrderState(0);
+        }else {
+            orderRecord.setOrderState(2);
+        }
+        /*Map<String, Object> payment = new HashMap<String, Object>();
         try {
             Integer tenantId = orderRecord.getTenantId();
             HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(tenantId, orderRecord.getPaymentChannel());
@@ -402,7 +380,7 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
             log.info("    >>>>> checkTenantOrder  orderRecord >>>>> {}", JSON.toJSONString(orderRecord));
         } catch (Exception e) {
             log.error("    >>>>> checkTenantOrder  payment error>>>>> {}", JSON.toJSONString(orderRecord));
-        }
+        }*/
     }
 
     //超时返回true
@@ -466,19 +444,31 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
      */
     @Override
     @Transactional(rollbackFor = Exception.class)
-	public String callback(String orderNo, HttpServletRequest request) {
-
-		TenantOrderRecord record = this.getOne(Wrappers.<TenantOrderRecord> lambdaQuery().eq(TenantOrderRecord::getOrderNo, orderNo));
-		if (Objects.isNull(record)) {
-			return "failed";
-		}
+	public void callback(TenantOrderRecord record, PaymentResp paymentResp) {
 		record = tenantOrderRecordDao.getLockedById(record.getId());
 		// 只处理未支付状态的订单
 		if (!record.getOrderState().equals(0)) {
-			return "succeeded";
+			return;
 		}
+        PaymentStatus paymentStatus = paymentResp.getPaymentStatus();
+        if (paymentStatus == PaymentStatus.SUCCESSED) {
+            Consumer<TenantOrderRecord> consumer = checkOrder.get(record.getOrderType());
+            if (Objects.nonNull(consumer)) {
+                consumer.accept(record);
+            }
+            LocalDateTime now = LocalDateTime.now();
+            record.setPayDate(now.toLocalDate().toDate());
+            record.setPayTime(now.toDate());
+            // 修改流水
+            record.setOrderState(1);
+            baseMapper.updateById(record);
+        } else if (paymentStatus == PaymentStatus.FAILED) {
+            // 修改流水
+            record.setOrderState(2);
+            baseMapper.updateById(record);
+        }
 
-		PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(record.getPaymentChannel());
+        /*PaymentChannelEnum paymentChannel = PaymentChannelEnum.codeOf(record.getPaymentChannel());
 
 		try {
 
@@ -574,7 +564,7 @@ public class TenantOrderRecordServiceImpl extends ServiceImpl<TenantOrderRecordD
 			return e.getMessage();
 		}
 
-		return "succeeded";
+		return "succeeded";*/
 	}
 
 }

+ 17 - 49
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TenantPaymentOrderServiceImpl.java

@@ -1,33 +1,10 @@
 package com.ym.mec.biz.service.impl;
 
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import com.ym.mec.biz.service.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.alibaba.fastjson.JSON;
-import com.ym.mec.biz.dal.dao.StudentPaymentRouteOrderDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dao.TenantEntryActivitiesDao;
 import com.ym.mec.biz.dal.dao.TenantPaymentOrderDao;
 import com.ym.mec.biz.dal.dto.PageInfoOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
-import com.ym.mec.biz.dal.entity.SysTenantAccountDetail.TransType;
 import com.ym.mec.biz.dal.entity.Teacher;
 import com.ym.mec.biz.dal.entity.TenantEntryActivities;
 import com.ym.mec.biz.dal.entity.TenantEntryActivities.SuitableUser;
@@ -36,55 +13,46 @@ import com.ym.mec.biz.dal.entity.TenantPaymentOrder.TenantPaymentType;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.PaymentChannelEnum;
 import com.ym.mec.biz.dal.page.TenantPaymentOrderQueryInfo;
+import com.ym.mec.biz.service.PayService;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.TenantPaymentOrderService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
-import com.ym.mec.thirdparty.adapay.ConfigInit;
-import com.ym.mec.thirdparty.adapay.Payment;
-import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
-import com.ym.mec.thirdparty.yqpay.Msg;
-import com.ym.mec.thirdparty.yqpay.RsqMsg;
-import com.ym.mec.thirdparty.yqpay.YqPayFeignService;
-import com.ym.mec.thirdparty.yqpay.YqPayUtil;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.date.DateUtil;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.util.*;
 
 @Service
 public class TenantPaymentOrderServiceImpl extends BaseServiceImpl<Long, TenantPaymentOrder> implements TenantPaymentOrderService {
 
-    private static final Logger logger = LoggerFactory.getLogger(TenantPaymentOrderServiceImpl.class);
-
-    @Autowired
+    @Resource
     private TenantPaymentOrderDao tenantPaymentOrderDao;
 
-    @Autowired
+    @Resource
     private TenantEntryActivitiesDao tenantEntryActivitiesDao;
 
-    @Autowired
+    @Resource
     private IdGeneratorService idGeneratorService;
 
-    @Autowired
+    @Resource
     private PayService payService;
 
-    @Autowired
+    @Resource
     private SysConfigDao sysConfigDao;
 
-    @Autowired
+    @Resource
     private TeacherDao teacherDao;
 
-    @Autowired
-    private SysTenantAccountService sysTenantAccountService;
-
-    @Autowired
-    private YqPayFeignService yqPayFeignService;
-    @Autowired
-    private StudentPaymentRouteOrderDao studentPaymentRouteOrderDao;
-    
-    @Autowired
-    private HfMerchantConfigService hfMerchantConfigService;
-
     @Override
     public BaseDAO<Long, TenantPaymentOrder> getDAO() {
         return tenantPaymentOrderDao;

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

@@ -719,7 +719,6 @@ public class VipGroupActivityServiceImpl extends BaseServiceImpl<Integer, VipGro
 				sysUserCashAccountService.updateBalance(studentPaymentOrder.getUserId(), studentPaymentOrder.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, studentPaymentOrder.getMemo() + "支付失败,退还余额");
 			}
 			sysCouponCodeService.quit(studentPaymentOrder.getCouponCodeId());
-			return;
 		}
 	}
 

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

@@ -2786,11 +2786,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                 }
             }
         }
-        try {
+        /*try {
             contractService.register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
         } catch (Exception e) {
             businessLogger.error("[{}]课程购买协议生成错误:{}", vipGroup.getId(), e.getCause());
-        }
+        }*/
 
         String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
         //分类费用 course,instrument,accessories,other

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

@@ -33,8 +33,13 @@
 
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="HfMerchantConfig">
-		SELECT * FROM hf_merchant_config WHERE payer_name_ = #{payerName} ORDER
-		BY id_
+		SELECT * FROM hf_merchant_config
+		<where>
+			<if test="payerName != null and payerName != ''">
+				AND payer_name_ = #{payerName}
+			</if>
+		</where>
+		ORDER BY id_
 	</select>
 
 	<!-- 向数据库增加一条记录 -->

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

@@ -30,8 +30,8 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.MusicGroupPaymentEntities" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO music_group_payment_entities (id_,music_group_id_,name_,payment_method_,amount_,memo_,create_time_,update_time_,tenant_id_)
-		VALUES(#{id},#{musicGroupId},#{name},#{paymentMethod, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{amount},#{memo},now(),now(),#{tenantId})
+		INSERT INTO music_group_payment_entities (music_group_id_,name_,payment_method_,amount_,memo_,create_time_,update_time_,tenant_id_)
+		VALUES(#{musicGroupId},#{name},#{paymentMethod, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{amount},#{memo},now(),now(),#{tenantId})
 	</insert>
     <insert id="batchAdd">
 		INSERT INTO music_group_payment_entities (music_group_id_,name_,payment_method_,amount_,memo_,create_time_,update_time_,tenant_id_)

+ 15 - 17
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -611,21 +611,21 @@
 
     <select id="queryStudentInfo" resultMap="StudentInfo">
         SELECT sut.name_ real_name_,
-        sut.card_no_ id_card_no_,
-        u.*,
-        sr.name_,
-        sr.current_class_,
-        sr.current_grade_,
-        sr.actual_subject_id_,
-        sr.parents_name_,
-        s.name_ subject_name_
+               sut.card_no_ id_card_no_,
+               u.*,
+               sr.name_,
+               sr.current_class_,
+               sr.current_grade_,
+               sr.actual_subject_id_,
+               sr.parents_name_,
+               s.name_ subject_name_
         FROM sys_user u
-        LEFT JOIN student_registration sr ON u.id_ = sr.user_id_
-        LEFT JOIN subject s ON sr.actual_subject_id_ = s.id_
-        LEFT JOIN sys_user_tsign sut ON sut.user_id_ = u.id_
+                 LEFT JOIN student_registration sr ON u.id_ = sr.user_id_
+                 LEFT JOIN subject s ON sr.actual_subject_id_ = s.id_
+                 LEFT JOIN sys_user_tsign sut ON sut.user_id_ = u.id_
         WHERE u.id_ = #{userId}
         ORDER BY sr.create_time_ DESC
-        limit 1
+            limit 1
     </select>
 
     <select id="queryByUserIdAndMusicGroupId" resultMap="StudentRegistration">
@@ -890,17 +890,15 @@
         SELECT su.id_,
         CASE WHEN sut.name_ IS NULL THEN su.real_name_ ELSE sut.name_ END parents_name_,
         su.phone_,
-        sr.current_grade_,
-        sr.current_grade_num_,
-        sr.current_class_,
+        st.current_grade_num_,
+        st.current_class_,
         su.username_ name_,
         su.birthdate_,
         su.gender_
         FROM sys_user su
         LEFT JOIN sys_user_tsign sut ON sut.user_id_ = su.id_
-        LEFT JOIN student_registration sr ON sr.user_id_ = su.id_
+        LEFT JOIN student st ON st.user_id_ = su.id_
         WHERE su.phone_ = #{mobile}
-        ORDER BY sr.id_ DESC
         LIMIT 1
     </select>
     <select id="queryPurchaseTypeMap" resultType="java.util.Map">

+ 5 - 5
mec-common/audit-log/src/main/java/com/yonge/log/interceptor/AuditLogInterceptor.java

@@ -16,13 +16,9 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.net.InetAddress;
 import java.nio.charset.Charset;
 import java.text.SimpleDateFormat;
 import java.util.*;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 /**
  * 日志审计的拦截器
@@ -41,7 +37,11 @@ public class AuditLogInterceptor extends HandlerInterceptorAdapter {
 
     @Override
     public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
-        syncSaveLog(request, handler);
+        // 如果不是HandlerMethod类型,直接返回,不进行日志记录
+        // ResourceHttpRequestHandler是处理静态资源的Handler,不需要记录日志
+        if (handler instanceof HandlerMethod) {
+            syncSaveLog(request, handler);
+        }
     }
 
     public void syncSaveLog(HttpServletRequest request, Object handler) {

+ 21 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/dto/RealnameAuthenticationDto.java

@@ -0,0 +1,21 @@
+package com.ym.mec.common.dto;
+
+import com.microsvc.toolkit.common.webportal.exception.BizException;
+
+public class  RealnameAuthenticationDto  {
+	public static boolean verify(String realname, String idcardNo) {
+		//取消第三方实名认证,通过正则校验
+		if (realname == null || idcardNo == null) {
+			return false;
+		}
+		//校验身份证号码
+		if (!idcardNo.matches("(^\\d{6}(18|19|20)\\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])\\d{3}(\\d|X|x)$)|(^\\d{6}\\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\\d|3[01])\\d{3}$)")) {
+			throw new BizException("身份证格式不正确");
+		}
+		//校验姓名
+		if (!realname.matches("^[\u4e00-\u9fa5]{2,4}$")) {
+			throw new BizException("姓名格式不正确");
+		}
+		return true;
+	}
+}

+ 1 - 1
mec-mall/mall-common/pom.xml

@@ -82,7 +82,7 @@
         <dependency>
             <groupId>org.redisson</groupId>
             <artifactId>redisson-spring-boot-starter</artifactId>
-            <version>3.16.4</version>
+            <version>${redisson.version}</version>
         </dependency>
     </dependencies>
 

+ 8 - 17
mec-mall/mall-portal/src/main/java/com/yonge/cooleshow/portal/controller/PaymentController.java

@@ -1,6 +1,5 @@
 package com.yonge.cooleshow.portal.controller;
 
-import cn.hutool.core.map.MapUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.huifu.adapay.core.AdapayCore;
@@ -8,30 +7,25 @@ import com.huifu.adapay.core.util.AdapaySign;
 import com.yeepay.g3.sdk.yop.encrypt.DigitalEnvelopeDTO;
 import com.yeepay.g3.sdk.yop.utils.DigitalEnvelopeUtils;
 import com.yeepay.g3.sdk.yop.utils.RSAKeyUtils;
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.common.controller.BaseController;
-import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.exception.BizException;
 import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
 import com.ym.mec.web.WebFeignService;
 import com.yonge.cooleshow.mall.common.enums.OrderCacheEnum;
 import com.yonge.cooleshow.mbg.model.UserOrderPayment;
-import com.yonge.cooleshow.portal.dto.OrderPayRes;
 import com.yonge.cooleshow.portal.service.OmsPortalOrderService;
 import com.yonge.cooleshow.portal.service.UserOrderPaymentService;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
 import org.redisson.api.RLock;
 import org.redisson.api.RedissonClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import javax.validation.Valid;
 import java.math.BigDecimal;
 import java.security.PrivateKey;
 import java.security.PublicKey;
@@ -49,19 +43,16 @@ import java.util.concurrent.TimeUnit;
 public class PaymentController extends BaseController {
     private final static Logger log = LoggerFactory.getLogger(PaymentController.class);
 
-    @Autowired
-    private SysUserFeignService sysUserFeignService;
-
-    @Autowired
+    @Resource
     private OmsPortalOrderService orderService;
 
-    @Autowired
+    @Resource
     private RedissonClient redissonClient;
 
-    @Autowired
+    @Resource
     private UserOrderPaymentService userOrderPaymentService;
 
-    @Autowired
+    @Resource
     private WebFeignService webFeignService;
 
 

+ 16 - 0
mec-mall/mall-portal/src/main/resources/bootstrap-dev.properties

@@ -0,0 +1,16 @@
+#\u6307\u5b9a\u5f00\u53d1\u73af\u5883
+#spring.profiles.active=dev
+#\u670d\u52a1\u5668\u5730\u5740
+spring.cloud.nacos.config.server-addr=10.206.0.17:8848
+#\u9ed8\u8ba4\u4e3aPublic\u547d\u540d\u7a7a\u95f4,\u53ef\u4ee5\u7701\u7565\u4e0d\u5199
+spring.cloud.nacos.config.namespace=470509f8-ea21-42cb-9c64-924c5ccc68ce
+#\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}
+spring.cloud.nacos.config.prefix=mall-portal
+#\u6307\u5b9a\u6587\u4ef6\u540e\u7f00
+spring.cloud.nacos.config.file-extension=yaml
+#\u662f\u5426\u52a8\u6001\u5237\u65b0
+spring.cloud.nacos.config.refresh.enabled=true
+#\u662f\u5426\u542f\u7528nacos\u914d\u7f6e\u4e2d\u5fc3
+spring.cloud.nacos.config.enabled=true

+ 11 - 1
mec-mall/pom.xml

@@ -24,7 +24,17 @@
     </properties>
 
     <dependencies>
-
+        <dependency>
+            <groupId>com.microsvc.toolkit.middleware</groupId>
+            <artifactId>microsvc-middleware-payment</artifactId>
+            <version>${microsvc.version}</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>mybatis-plus-annotation</artifactId>
+                    <groupId>com.baomidou</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-aop</artifactId>

+ 6 - 6
mec-thirdparty/pom.xml

@@ -94,7 +94,7 @@
 			<systemPath>
 				${project.basedir}/libs/SADK-3.2.5.2.jar</systemPath>
 		</dependency>
-
+<!--
 		<dependency>
 			<groupId>com.yeepay.yop</groupId>
 			<artifactId>yop-java-sdk</artifactId>
@@ -111,14 +111,14 @@
 			<version>
 				1.2.10</version>
 		</dependency>
-	
-		<!-- https://mvnrepository.com/artifact/com.huifu.adapay/adapay-java-sdk -->
+
+		&lt;!&ndash; https://mvnrepository.com/artifact/com.huifu.adapay/adapay-java-sdk &ndash;&gt;
 		<dependency>
 			<groupId>com.huifu.adapay</groupId>
 			<artifactId>
 				adapay-java-sdk</artifactId>
 			<version>1.2.10</version>
-		</dependency>
+		</dependency>-->
 		
 		<dependency>
 		    <groupId>
@@ -156,11 +156,11 @@
 			<version>0.8.14</version>
 		</dependency>
 
-		<dependency>
+		<!--<dependency>
 			<groupId>com.alipay.sdk</groupId>
 			<artifactId>alipay-sdk-java</artifactId>
 			<version>4.35.154.ALL</version>
-		</dependency>
+		</dependency>-->
 	</dependencies>
 
 </project>

+ 2 - 11
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/AdapayInit.java

@@ -1,14 +1,5 @@
 package com.ym.mec.thirdparty.adapay;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.huifu.adapay.Adapay;
-import com.huifu.adapay.model.MerConfig;
-import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
-import com.ym.mec.thirdparty.exception.ThirdpartyException;
-
 /**
  * 系统初始化
  */
@@ -39,7 +30,7 @@ public class AdapayInit {
 		return init;
 	}
 
-	public boolean initWithMerConfig(List<HfMerchantConfig> adapayMerConfigList) {
+	/*public boolean initWithMerConfig(List<HfMerchantConfig> adapayMerConfigList) {
 		
 		Adapay.debug = debug;
 		Adapay.prodMode = prodMode;
@@ -62,5 +53,5 @@ public class AdapayInit {
 		}
 
 		return true;
-	}
+	}*/
 }

+ 7 - 11
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/ConfigInit.java

@@ -1,13 +1,9 @@
 package com.ym.mec.thirdparty.adapay;
 
-import com.huifu.adapay.Adapay;
-import com.huifu.adapay.model.MerConfig;
-
-
 public class ConfigInit {
 
 
-    private static ConfigInit instance;
+//    private static ConfigInit instance;
     public final static Integer organId = 16; //商户对应的分部
     public final static String merNo = "B09767221"; //商户对应的分部
     public final static String appId = "app_756972d1-882e-44c6-9f52-e6a6b93c8756";
@@ -15,7 +11,7 @@ public class ConfigInit {
     public final static String wxAppId = "wx751141096e75a4ee";
     public final static String wxAppSecret = "e882d76c95d1613607a85338b1bed3ff";
     public final static String wxMpOAuth2AccessTokenUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code";
-    public final static MerConfig merConfig = new MerConfig();
+    /*public final static MerConfig merConfig = new MerConfig();
 
     static {
         try {
@@ -32,9 +28,9 @@ public class ConfigInit {
         } else {
             return instance;
         }
-        /**
+        *//**
          *添加商户配置,一个商户只需要 添加一次,添加以后在内存中。
-         */
+         *//*
 
         String apiKey = "api_live_bfc3c02f-657b-4731-9fcd-ea9503aa3bb9";
         String mockApiKey = "api_test_d09b9f68-9798-43b3-93b7-a22ef406a20c";
@@ -44,13 +40,13 @@ public class ConfigInit {
         merConfig.setApiMockKey(mockApiKey);
         merConfig.setRSAPrivateKey(rsaPrivateKey);
         Adapay.initWithMerConfig(merConfig);
-        /**
+        *//**
          *启动MQTT,一个商户只需要 启动一次,启动完成以后一直在服务器后端运行
-         */
+         *//*
         // notifyCallback = new NotifyCallback();
         //Adapay.startMqttListener(merConfig, notifyCallback);
         return instance;
-    }
+    }*/
 
     public ConfigInit() {
     }

+ 2 - 14
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/CorpMemberService.java

@@ -1,25 +1,13 @@
 package com.ym.mec.thirdparty.adapay;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
-import com.huifu.adapay.core.exception.BaseAdaPayException;
-import com.huifu.adapay.model.AdapayCommon;
-import com.huifu.adapay.model.CorpMember;
-import com.ym.mec.thirdparty.adapay.entity.EnterpriseUser;
-import com.ym.mec.thirdparty.exception.ThirdpartyException;
-
 /**
  * 企业用户相关服务
  */
 @Service
 public class CorpMemberService {
-
+/*
 	private final static Logger logger = LoggerFactory.getLogger(CorpMemberService.class);
 
 	public boolean create(String merchantKey, String appId, EnterpriseUser req, String notifyUrl) {
@@ -134,6 +122,6 @@ public class CorpMemberService {
 		}
 
 		return null;
-	}
+	}*/
 	
 }

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

@@ -1,26 +1,16 @@
 package com.ym.mec.thirdparty.adapay;
 
-import java.math.BigDecimal;
-import java.util.*;
-
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.google.common.collect.Lists;
-import com.huifu.adapay.core.exception.BaseAdaPayException;
-import com.huifu.adapay.core.util.StringUtil;
-import com.huifu.adapay.model.PaymentReverse;
-import com.huifu.adapay.model.Refund;
-import com.ym.mec.thirdparty.adapay.entity.BaseResult;
 import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
-import com.ym.mec.thirdparty.exception.ThirdpartyException;
-
-import org.apache.commons.lang3.StringUtils;
-import org.joda.time.DateTime;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.util.CollectionUtils;
 import org.springframework.util.DigestUtils;
 
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
 public class Payment {
 
 	private final static Logger LOGGER = LoggerFactory.getLogger(Payment.class);
@@ -30,7 +20,7 @@ public class Payment {
      * @return 创建的支付对象
      * @throws Exception 异常
      */
-    public static Map<String, Object> executePayment(String appId, String merchantKey, Map<String, Object> paymentParams) throws Exception {
+    /*public static Map<String, Object> executePayment(String appId, String merchantKey, Map<String, Object> paymentParams) throws Exception {
         paymentParams.put("app_id", appId);
 
         LOGGER.info("汇付[创建支付对象] Req:{}", paymentParams);
@@ -51,12 +41,12 @@ public class Payment {
     }
 
 
-    /**
+    *//**
      * 创建确认对象
      *
      * @return 查询的支付对象
      * @throws Exception 异常
-     */
+     *//*
     public static Map<String, Object> createConfirm(Map<String, Object> confirm, String merchantKey) throws Exception {
         confirm = com.huifu.adapay.model.Payment.createConfirm(confirm, merchantKey);
 
@@ -68,13 +58,12 @@ public class Payment {
         return confirm;
     }
 
-    /**
+    *//**
      * 查询一个支付交易
      *
-     * @param paymentId 要查询的支付id
      * @return 查询的支付对象
      * @throws Exception 异常
-     */
+     *//*
     public static Map<String, Object> queryPayment(String paymentId, String merchantKey) throws Exception {
         LOGGER.info("=======query payment begin=======");
         //查询支付对象的参数,全部参数请参考 https://docs.adapay.tech/api/04-trade.html#id7
@@ -95,10 +84,10 @@ public class Payment {
         }
         LOGGER.info("queryPayment >>> =======query payment end=======");
         return payment;
-    }
+    }*/
 
 
-    public static Map<String, Object> queryList(String appId, String merchantKey, Integer pageIndex, Long createdGte, Long createdLte) throws Exception {
+    /*public static Map<String, Object> queryList(String appId, String merchantKey, Integer pageIndex, Long createdGte, Long createdLte) throws Exception {
         Map<java.lang.String, java.lang.Object> paymentParams = new HashMap<>();
         paymentParams.put("app_id", appId);
         paymentParams.put("page_index", pageIndex);
@@ -112,8 +101,8 @@ public class Payment {
             throw new ThirdpartyException(errorMsg);
         }
         return payment;
-    }
-
+    }*/
+/*
     public static Map<String, Object> queryConfirmList(String appId, String merchantKey, String paymentId) throws Exception {
         Map<String, Object> paymentParams = new HashMap<>();
         paymentParams.put("app_id", appId);
@@ -126,13 +115,13 @@ public class Payment {
             throw new ThirdpartyException(errorMsg);
         }
         return payment;
-    }
+    }*/
 
     public static Map<String, Object> getPayMap(HfMerchantConfig hfMerchantConfig, BigDecimal amount, String orderNo, String returnUrl, String orderSubject, String orderBody) throws Exception {
 
         Map<String, Object> paymentParams = new LinkedHashMap<>();
         paymentParams.put("appId", hfMerchantConfig.getAppId());
-        paymentParams.put("amount", amount.setScale(2, BigDecimal.ROUND_HALF_UP));
+        paymentParams.put("amount", amount.setScale(2, RoundingMode.HALF_UP));
         paymentParams.put("orderNo", orderNo);
 //        paymentParams.put("notifyUrl", notifyUrl);
         paymentParams.put("returnUrl", returnUrl);
@@ -149,7 +138,7 @@ public class Payment {
         paymentParams.remove("appId");
         return paymentParams;
     }
-
+/*
     public static BaseResult<Map<String ,Object>> refundPayment(Map<String, Object> refundParams) {
 
         LOGGER.info("退款对象信息:{}",refundParams);
@@ -203,7 +192,7 @@ public class Payment {
     }
 
 
-    /**
+    *//**
      *
      针对已经创建的 支付对象,您可以调用关单接口进行交易的关闭。调用此接口后,该用户订单将不再能支付成功。 对于关单功能的使用有如下规则:
      1.存在关单记录,不能再次关单
@@ -216,7 +205,7 @@ public class Payment {
      * @param reason 原因
      * @param merchantKey 商户Key
      * @return Map<String, Object>
-     */
+     *//*
     public static Map<String ,String> closeWithKey(String transNo, String reason, String merchantKey) {
 
 
@@ -258,6 +247,6 @@ public class Payment {
         result.put("status", "success");
 
         return result;
-    }
+    }*/
 
 }

+ 2 - 10
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/adapay/SettleAccountService.java

@@ -1,22 +1,14 @@
 package com.ym.mec.thirdparty.adapay;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
-import com.huifu.adapay.core.exception.BaseAdaPayException;
-import com.ym.mec.thirdparty.adapay.entity.AccountInfo;
-import com.ym.mec.thirdparty.exception.ThirdpartyException;
-
 /**
  * 结算账户服务
  * 注:若用户想更新银行卡,则需要先调用删除结算账户对象,再使用原 member_id 重新创建结算账户对象,且必须与原创建结算账户使用的身份证和银行卡户名保持一致。
  */
 @Service
 public class SettleAccountService {
-
+/*
 	public String create(String merchantKey, String appId, AccountInfo accountInfo) {
 		Map<String, Object> settleCountParams = new HashMap<String, Object>();
 		Map<String, Object> accountInfoMap = new HashMap<String, Object>();
@@ -60,5 +52,5 @@ public class SettleAccountService {
 			new ThirdpartyException("结算账户删除失败:{}", e, e.getMessage());
 		}
 		return false;
-	}
+	}*/
 }

+ 0 - 1
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/eseal/provider/TsignPlugin.java

@@ -262,7 +262,6 @@ public class TsignPlugin implements ESealPlugin, InitializingBean, DisposableBea
      * @return
      */
     public boolean userSign(String accountId, String sealData, String srcPdfPath, String destPdfPath) {
-
         SignPDFFileBean signPDFStreamBean = new SignPDFFileBean();
         // C:test_signed.pdf为平台自身签署后路径
         signPDFStreamBean.setSrcPdfFile(srcPdfPath);

+ 3 - 14
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yeepay/YeepayMerchantService.java

@@ -1,26 +1,15 @@
 package com.ym.mec.thirdparty.yeepay;
 
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
-import com.alibaba.fastjson.JSONObject;
-import com.yeepay.g3.sdk.yop.client.YopRequest;
-import com.yeepay.g3.sdk.yop.client.YopResponse;
-import com.yeepay.g3.sdk.yop.client.YopRsaClient;
-import com.yeepay.g3.sdk.yop.exception.YopClientException;
-import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
-import com.ym.mec.thirdparty.yeepay.entity.MerchantInfo;
-
 @Service
 public class YeepayMerchantService {
 
-	private static final Logger LOGGER = LoggerFactory.getLogger(YeepayMerchantService.class);
 
+	private static final Logger LOGGER = LoggerFactory.getLogger(YeepayMerchantService.class);
+/*
 	public JSONObject registerQueryV2(HfMerchantConfig hfMerchantConfig, String requestNo) throws IOException {
 
 		YopRequest request = new YopRequest(hfMerchantConfig.getAppId(), hfMerchantConfig.getRsaPrivateKey());
@@ -103,6 +92,6 @@ public class YeepayMerchantService {
 
 	public void merchantInfoModify(String merchantNo, MerchantInfo merchantInfo, String notifyURL) throws YopClientException {
 
-	}
+	}*/
 
 }

+ 4 - 21
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yeepay/YeepayPaymentService.java

@@ -1,27 +1,10 @@
 package com.ym.mec.thirdparty.yeepay;
 
-import java.io.IOException;
-import java.util.*;
-
-import com.google.common.collect.Lists;
-import org.apache.commons.lang3.StringUtils;
-import org.joda.time.DateTime;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.yeepay.g3.sdk.yop.client.YopRequest;
-import com.yeepay.g3.sdk.yop.client.YopResponse;
-import com.yeepay.g3.sdk.yop.client.YopRsaClient;
-import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
-import com.ym.mec.thirdparty.exception.ThirdpartyException;
-import com.ym.mec.util.date.DateUtil;
-
 @Service
 public class YeepayPaymentService {
-
+/*
 	private static final Logger LOGGER = LoggerFactory.getLogger(YeepayPaymentService.class);
 
 	public Map<String, Object> prePay(HfMerchantConfig hfMerchantConfig, Map<String, Object> params) throws IOException {
@@ -107,12 +90,12 @@ public class YeepayPaymentService {
 	}
 
 
-    /**
+    *//**
      * 关闭订单
      * @param transNo 交易流水号
      * @param reason 原因
      * @return Map<String, Object>
-     */
+     *//*
     public Map<String,String> close(HfMerchantConfig hfMerchantConfig,String transNo, String reason, String outTransNo) {
 
 
@@ -162,5 +145,5 @@ public class YeepayPaymentService {
 
 
         return result;
-    }
+    }*/
 }

+ 2 - 11
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yeepay/YeepayUploadService.java

@@ -1,23 +1,14 @@
 package com.ym.mec.thirdparty.yeepay;
 
-import java.io.File;
-import java.io.IOException;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 
-import com.alibaba.fastjson.JSONObject;
-import com.yeepay.g3.sdk.yop.client.YopRequest;
-import com.yeepay.g3.sdk.yop.client.YopResponse;
-import com.yeepay.g3.sdk.yop.client.YopRsaClient;
-import com.ym.mec.thirdparty.adapay.entity.HfMerchantConfig;
-
 @Service
 public class YeepayUploadService {
 	
 	private static final Logger LOGGER = LoggerFactory.getLogger(YeepayUploadService.class);
-
+/*
 	public String upload(HfMerchantConfig hfMerchantConfig, File file) {
 		
 		YopRequest request = new YopRequest(hfMerchantConfig.getAppId(), hfMerchantConfig.getRsaPrivateKey());
@@ -37,5 +28,5 @@ public class YeepayUploadService {
         
         return null;
 		
-	}
+	}*/
 }

+ 0 - 1
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/CFCARAUtil.java

@@ -6,7 +6,6 @@ import cfca.sadk.lib.crypto.JCrypto;
 import cfca.sadk.system.FileHelper;
 import cfca.sadk.util.*;
 import cfca.sadk.x509.certificate.X509Cert;
-import org.hibernate.validator.internal.util.privilegedactions.GetClassLoader;
 import org.springframework.core.io.ClassPathResource;
 
 import javax.crypto.spec.SecretKeySpec;

+ 6 - 4
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/YqPayFeignService.java

@@ -4,15 +4,17 @@ import feign.Logger;
 import feign.codec.Encoder;
 import feign.form.spring.SpringFormEncoder;
 import org.springframework.beans.factory.ObjectFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.cloud.openfeign.support.SpringEncoder;
 import org.springframework.context.annotation.Bean;
 import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
-
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
 
+import javax.annotation.Resource;
 import java.util.Map;
 
 @FeignClient(value = "YqPayFeignService",url = "https://qyfquery.95epay.com",configuration = YqPayFeignService.FormSupportConfig.class)
@@ -34,7 +36,7 @@ public interface YqPayFeignService {
     class FormSupportConfig {
 
 
-        @Autowired
+        @Resource
         private ObjectFactory<HttpMessageConverters> messageConverters;
         // new一个form编码器,实现支持form表单提交
         @Bean

+ 1 - 6
pom.xml

@@ -25,8 +25,8 @@
 		<docker.host>http://127.0.0.1:2375</docker.host>
 		<docker.registry.repository>127.0.0.1:5000</docker.registry.repository>
 		<docker.maven.plugin.version>1.2.2</docker.maven.plugin.version>
-		<com.microsvc.toolkit.version>1.0.8-RC1</com.microsvc.toolkit.version>
 		<cbs.version>1.0.26</cbs.version>
+		<microsvc.version>1.2.0</microsvc.version>
 	</properties>
 
 	<dependencyManagement>
@@ -313,11 +313,6 @@
 		</dependency>
 
 		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-test</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
 			<groupId>com.google.guava</groupId>
 			<artifactId>guava</artifactId>
 			<version>20.0</version>