浏览代码

Merge branch 'master' of http://git.dayaedu.com/yonge/cooleshow

liujunchi 3 年之前
父节点
当前提交
2290060670
共有 47 个文件被更改,包括 1223 次插入101 次删除
  1. 4 0
      cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/SubjectController.java
  2. 7 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleDao.java
  3. 49 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java
  4. 6 6
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserAccountServiceImpl.java
  5. 6 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java
  6. 4 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserWithdrawalServiceImpl.java
  7. 3 3
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonEvaluateServiceImpl.java
  8. 6 6
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonPurchaseRecordServiceImpl.java
  9. 40 0
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/support/DistributedLock.java
  10. 1 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/StudentHomePage.java
  11. 8 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  12. 1 2
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleRepliedMapper.xml
  13. 2 0
      cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/PaymentController.java
  14. 14 19
      cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/UserOrderController.java
  15. 16 2
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/UserBankCardController.java
  16. 1 0
      toolset/pom.xml
  17. 2 1
      toolset/thirdparty-component/src/main/java/com/yonge/toolset/thirdparty/user/realname/provider/LinkfaceRealnameAuthenticationPlugin.java
  18. 1 1
      toolset/toolset-mybatis/pom.xml
  19. 33 0
      toolset/toolset-payment/payment-adapay/pom.xml
  20. 133 0
      toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/AdapayTemplate.java
  21. 48 0
      toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/config/HuifuConfiguration.java
  22. 27 0
      toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/model/DeviceInfo.java
  23. 55 0
      toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/model/DivMember.java
  24. 73 0
      toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/model/PaymentConfirmParam.java
  25. 168 0
      toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/model/PaymentReq.java
  26. 149 0
      toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/props/HuifuProperties.java
  27. 18 0
      toolset/toolset-payment/payment-core/pom.xml
  28. 0 14
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/config/PaymentConfiguration.java
  29. 9 9
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/PaymentTemplate.java
  30. 1 1
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/constant/PaymentConstant.java
  31. 9 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/dao/SysConfigPaymentDao.java
  32. 95 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/entity/SysConfigPayment.java
  33. 2 2
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/enums/OpenEnum.java
  34. 1 1
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/enums/PayChannelEnum.java
  35. 10 1
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/enums/TradeStatusEnum.java
  36. 2 2
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/ClosePayment.java
  37. 27 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/DeviceInfo.java
  38. 55 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/DivMember.java
  39. 49 2
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/Payment.java
  40. 2 2
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/RefundBill.java
  41. 3 3
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/res/ClosePaymentRes.java
  42. 3 3
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/res/PaymentRes.java
  43. 3 3
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/res/RefundBillRes.java
  44. 22 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/service/SysConfigPaymentService.java
  45. 53 0
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/service/impl/SysConfigPaymentServiceImpl.java
  46. 0 8
      toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/props/PaymentProperties.java
  47. 2 0
      toolset/toolset-payment/pom.xml

+ 4 - 0
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/SubjectController.java

@@ -43,6 +43,10 @@ public class SubjectController extends BaseController {
 	@PreAuthorize("@pcs.hasPermissions('subject/queryPage')")
 	public HttpResponseResult<PageInfo<Subject>> queryPage(SubjectQueryInfo queryInfo) {
 		PageInfo<Subject> pageInfo = subjectService.queryPage(queryInfo);
+		
+		if(pageInfo.getRows().size() == 0){
+			return succeed(pageInfo);
+		}
 
 		Map<Long, Subject> map = subjectService.findBySubjectByIdList(pageInfo.getRows().stream().map(t -> t.getParentSubjectId()).collect(Collectors.toList())).stream()
 				.collect(Collectors.toMap(Subject::getId, t -> t));

+ 7 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleDao.java

@@ -13,6 +13,7 @@ import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
 import com.yonge.cooleshow.biz.dal.vo.*;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -175,7 +176,7 @@ public interface CourseScheduleDao extends BaseMapper<CourseSchedule> {
     List<SysUser> selectTeacher(String tomorrow);
 
     //根据老师id统计明日课程
-    List<CountVo> selectTypeCount(@Param("teacherId")Long teacherId,@Param("tomorrow") String tomorrow);
+    List<CountVo> selectTypeCount(@Param("teacherId") Long teacherId, @Param("tomorrow") String tomorrow);
 
 
     List<TodayNotRepliedAndNotDecorateHomeworkVo> selectTodayNotRepliedAndNotDecorateHomework();
@@ -188,14 +189,19 @@ public interface CourseScheduleDao extends BaseMapper<CourseSchedule> {
 
     /**
      * 按年查询首页课程数据
+     *
      * @param param
      */
     List<CourseHomeVo.CourseHomeInfoVo> queryCourseHomeOfYear(@Param("param") Map<String, Object> param);
 
     /**
      * 按月查询首页课程数据
+     *
      * @param param
      */
     List<CourseHomeVo.CourseHomeInfoVo> queryCourseHomeOfMonth(@Param("param") Map<String, Object> param);
+
+    //查询老师声部价格
+    BigDecimal selectPrice(@Param("teacherId") Long teacherId, @Param("subjectId") Long subjectId);
 }
 

+ 49 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -828,6 +828,38 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
     }
 
     /**
+     * 批量检查老师课时在数据库是否重复
+     *
+     * @param teacherId 老师id
+     * @param timeList  时间集合
+     */
+    private <T> void batchCheckTeacherCourseTime(Long teacherId, List<T> timeList, Function<T, Date> startTimeFun, Function<T, Date> endTimeFun) {
+        //再校验数据库中课程时间和传入时间是否有交集
+        timeList.forEach(o -> {
+            boolean checkDataTime = this.checkTeacherCourseTime(teacherId, startTimeFun.apply(o), endTimeFun.apply(o));
+            if (checkDataTime) {
+                throw new BizException("预计安排在" + DateUtil.dateToString(startTimeFun.apply(o), "yyyy年MM月dd号 HH点mm分") + "的课程时间存在冲突!");
+            }
+        });
+    }
+
+    /**
+     * 批量检查学生课时在数据库是否重复
+     *
+     * @param studentId 老师id
+     * @param timeList  时间集合
+     */
+    private <T> void batchCheckStudentCourseTime(Long studentId, List<T> timeList, Function<T, Date> startTimeFun, Function<T, Date> endTimeFun) {
+        //再校验数据库中课程时间和传入时间是否有交集
+        timeList.forEach(o -> {
+            boolean checkDataTime = this.checkStudentCourseTime(studentId, startTimeFun.apply(o), endTimeFun.apply(o));
+            if (checkDataTime) {
+                throw new BizException("预计安排在" + DateUtil.dateToString(startTimeFun.apply(o), "yyyy年MM月dd号 HH点mm分") + "的课程时间存在冲突!");
+            }
+        });
+    }
+
+    /**
      * @Description: 学生购买陪练课
      * @Author: cy
      * @Date: 2022/4/21
@@ -842,8 +874,24 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 
         ObjectMapper objectMapper = new ObjectMapper();
         PracticeScheduleDto scheduleDto = objectMapper.convertValue(orderReqInfo.getBizContent(), PracticeScheduleDto.class);
+        List<CourseScheduleDate> dateList = scheduleDto.getClassTime();
+        Integer courseNum = scheduleDto.getCourseNum();//课程数
+
+        //校验课时数
+        if (dateList.size() != courseNum) {
+            throw new BizException("课程数与课时数不符");
+        }
+        BigDecimal price=baseMapper.selectPrice(scheduleDto.getTeacherId(), scheduleDto.getSubjectId());//老师设置声部价格
+        BigDecimal decimal = new BigDecimal(courseNum);//选购课程节数
+        BigDecimal multiply = price.multiply(decimal);//预计总价
+        if (multiply.compareTo(scheduleDto.getCoursePrice())!=0){
+            throw new BizException("价格异常。预计价格:{},实际价格:{}",multiply,scheduleDto.getCoursePrice());
+        }
 
-        //校验课程数与价格
+        //批量检查老师课时在数据库是否重复
+        batchCheckTeacherCourseTime(scheduleDto.getTeacherId(), dateList, CourseScheduleDate::getStartTime, CourseScheduleDate::getEndTime);
+        //批量检查学生课时在数据库是否重复
+        batchCheckStudentCourseTime(studentId, dateList, CourseScheduleDate::getStartTime, CourseScheduleDate::getEndTime);
 
         String orderNo = orderReqInfo.getOrderNo();
         scheduleDto.setType(CourseScheduleEnum.PRACTICE.getCode());

+ 6 - 6
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserAccountServiceImpl.java

@@ -61,12 +61,12 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
             throw new BizException("缺少参数");
         }
 
-        Future<HttpResponseResult<UserAccountRecord>> httpResponseResultFuture = DistributedLock.of(redissonClient)
-                .callIfLockCanGet(CacheNameEnum.LOCK_CHANGE_ACCOUNT.getRedisKey(accountRecordDto.getUserId())
-                        , () -> doAccountChange(accountRecordDto), 60L, TimeUnit.SECONDS);
-
         try {
-            return httpResponseResultFuture.get();
+            return DistributedLock.of(redissonClient)
+                    .runIfLockCanGet(CacheNameEnum.LOCK_CHANGE_ACCOUNT.getRedisKey(accountRecordDto.getUserId())
+                            , () -> doAccountChange(accountRecordDto), 60L, TimeUnit.SECONDS);
+        } catch (BizException e) {
+            return HttpResponseResult.failed(e.getMessage());
         } catch (Exception e) {
             e.printStackTrace();
             throw new BizException("账户变更失败");
@@ -94,7 +94,7 @@ public class UserAccountServiceImpl extends ServiceImpl<UserAccountDao, UserAcco
         }
         AccountTotal total = new AccountTotal();
 
-        total.setTotalInAmount(practiceAmount.add(liveAmount).add(musicAmount));
+        total.setTotalInAmount(practiceAmount.add(liveAmount).add(videoAmount).add(musicAmount));
         if (total.getTotalInAmount().doubleValue() > 0) {
             total.setPracticeAmount(practiceAmount);
             BigDecimal practiceRate = total.getPracticeAmount()

+ 6 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java

@@ -199,7 +199,6 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
     }
 
 
-
     @Override
     public void setSuccessStatus() {
         OrderSearch query = new OrderSearch();
@@ -251,6 +250,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
     @Override
     @Transactional(rollbackFor = Exception.class)
     public HttpResponseResult<UserOrder> executeOrder(OrderReq orderReq) throws Exception {
+        long start = System.currentTimeMillis();
         log.info("订单[创建订单] Req:{}", JSONObject.toJSONString(orderReq));
         //订单号生成
         Long orderNo = idGeneratorService.generatorId("userOrder");
@@ -261,6 +261,8 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
             if (Objects.isNull(createFunction)) {
                 return HttpResponseResult.failed("订单商品信息获取失败");
             }
+
+
             info.setOrderNo(Long.toString(orderNo));
             info.setUserId(orderReq.getUserId());
             HttpResponseResult<OrderCreateRes> createResult = createFunction.apply(info);
@@ -290,6 +292,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
                 afterFunction.accept(orderDetailVo);
             }
         }
+        log.info("下单请求 start is {} end is {}", start, System.currentTimeMillis());
         return HttpResponseResult.succeed(orderVo);
     }
 
@@ -433,6 +436,8 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
         }
         //关闭订单
         doOrderCancel(detail, OrderStatusEnum.CLOSE, "订单超时");
+        //关闭订单付款单
+        orderPaymentService.closePayment(orderNo, "订单超时");
     }
 
     private HttpResponseResult<OrderPayRes> doOrderPayWaitPay(OrderPayReq payReq, UserOrderVo detail) {

+ 4 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserWithdrawalServiceImpl.java

@@ -76,12 +76,11 @@ public class UserWithdrawalServiceImpl extends ServiceImpl<UserWithdrawalDao, Us
     public HttpResponseResult<WithdrawalInfoRes> getWithdrawalInfo(Long userId) {
         WithdrawalInfoRes withdrawalInfoRes = new WithdrawalInfoRes();
         UserBankCardVo defaultBank = bankCardDao.getDefaultBankByUserId(userId);
-        if (null == defaultBank) {
-            return HttpResponseResult.failed("用户未绑定银行卡");
+        if (null != defaultBank) {
+            defaultBank.setPhone(ValueUtil.fuzzyMobile(defaultBank.getPhone()));
+            defaultBank.setBankCard(ValueUtil.fuzzyBankCard(defaultBank.getBankCard()));
+            withdrawalInfoRes.setUserBankCard(defaultBank);
         }
-        defaultBank.setPhone(ValueUtil.fuzzyMobile(defaultBank.getPhone()));
-        defaultBank.setBankCard(ValueUtil.fuzzyBankCard(defaultBank.getBankCard()));
-        withdrawalInfoRes.setUserBankCard(defaultBank);
         //获取平台提现手续费
         BigDecimal withdrawalServiceFee = getWithdrawalServiceFee();
         withdrawalInfoRes.setWithdrawalServiceFee(withdrawalServiceFee);

+ 3 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonEvaluateServiceImpl.java

@@ -60,7 +60,7 @@ public class VideoLessonEvaluateServiceImpl extends ServiceImpl<VideoLessonEvalu
         Long teacherId = videoLessonPurchaseRecordDao.selectTeacherByDetail(videoId);
 
         //校验用户是否已购该课或未本课老师
-        if (userId != teacherId && !studentIdList.contains(userId)) {
+        if (!(userId.equals(teacherId)) && !studentIdList.contains(userId)) {
             throw new RuntimeException("未购买该课程无法参与讨论");
         }
 
@@ -69,7 +69,7 @@ public class VideoLessonEvaluateServiceImpl extends ServiceImpl<VideoLessonEvalu
 //            evaluate.setIsTeacher(YesOrNoEnum.YES);
 //        }
         //当前用户为课程创建者  是:老师  否:学生
-        if (teacherId==userId){
+        if (teacherId == userId) {
             evaluate.setIsTeacher(YesOrNoEnum.YES);
         }
 
@@ -83,6 +83,6 @@ public class VideoLessonEvaluateServiceImpl extends ServiceImpl<VideoLessonEvalu
      * @Date: 2022/4/11
      */
     public IPage<VideoLessonEvaluateVo> selectEvaluate(IPage<VideoLessonEvaluateVo> page, VideoLessonEvaluateSearch search) {
-        return page.setRecords(baseMapper.selectEvaluate(page,search));
+        return page.setRecords(baseMapper.selectEvaluate(page, search));
     }
 }

+ 6 - 6
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/VideoLessonPurchaseRecordServiceImpl.java

@@ -90,12 +90,12 @@ public class VideoLessonPurchaseRecordServiceImpl extends ServiceImpl<VideoLesso
         }
 
         //校验课程是否购买
-//        VideoLessonPurchaseRecord isAlreadyBuy = videoLessonPurchaseRecordDao.selectOne(Wrappers.<VideoLessonPurchaseRecord>lambdaQuery()
-//                .eq(VideoLessonPurchaseRecord::getStudentId, studentId)
-//                .eq(VideoLessonPurchaseRecord::getVideoLessonGroupId, groupId));
-//        if (!ObjectUtil.isEmpty(isAlreadyBuy)) {
-//            throw new BizException("已购买过该课程");
-//        }
+        VideoLessonPurchaseRecord isAlreadyBuy = videoLessonPurchaseRecordDao.selectOne(Wrappers.<VideoLessonPurchaseRecord>lambdaQuery()
+                .eq(VideoLessonPurchaseRecord::getStudentId, studentId)
+                .eq(VideoLessonPurchaseRecord::getVideoLessonGroupId, groupId));
+        if (!ObjectUtil.isEmpty(isAlreadyBuy)) {
+            throw new BizException("已购买过该课程,或存在该课程未完成订单");
+        }
 
         purchaseRecord.setOrderNo(orderNo);
         purchaseRecord.setStudentId(studentId);

+ 40 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/support/DistributedLock.java

@@ -1,5 +1,7 @@
 package com.yonge.cooleshow.biz.dal.support;
 
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.toolset.base.exception.BizException;
 import org.redisson.api.RLock;
 import org.redisson.api.RedissonClient;
 import org.slf4j.Logger;
@@ -74,6 +76,43 @@ public class DistributedLock {
     }
 
     /**
+     * 分布式锁-同步
+     *
+     * @param lockName lockKey
+     * @param callable 任务
+     * @param timeout  超时时间
+     * @param unit     超时时间单位
+     * @return Future 异步任务
+     */
+    public <T> T runIfLockCanGet(final String lockName, Callable<T> callable, final long timeout, TimeUnit unit) {
+        RLock lock = redissonClient.getLock(lockName);
+        if (Objects.isNull(lock)) {
+            log.info("callIfLockCanGet lock is null lockName : {}", lockName);
+            return null;
+        }
+        ExecutorService executor = Executors.newCachedThreadPool();
+        try {
+            if (lock.tryLock(0, timeout, unit)) {
+                log.info("callIfLockCanGet lock lockName : {} time is {}", lockName, System.currentTimeMillis());
+                Future<T> submit = executor.submit(callable);
+                return submit.get();
+            } else {
+                return null;
+            }
+        } catch (BizException e) {
+            throw e;
+        } catch (ExecutionException e) {
+            throw new BizException(e.getCause().getMessage());
+        } catch (Exception e) {
+            log.error("callIfLockCanGet error lockKey {}", lockName);
+            throw new RuntimeException("任务执行异常");
+        } finally {
+            executor.shutdown();
+            unlock(lock);
+        }
+    }
+
+    /**
      * 分布式锁-异步
      *
      * @param lockName lockKey
@@ -91,6 +130,7 @@ public class DistributedLock {
         ExecutorService executor = Executors.newCachedThreadPool();
         try {
             if (lock.tryLock(0, timeout, unit)) {
+                log.info("callIfLockCanGet lock lockName : {} time is {}", lockName, System.currentTimeMillis());
                 return executor.submit(callable);
             } else {
                 return null;

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/StudentHomePage.java

@@ -26,9 +26,9 @@ public class StudentHomePage implements Serializable {
         private Long teacherId;
         @ApiModelProperty(value = "老师姓名")
         private String teacherName;
-        private String realName;
         @ApiModelProperty(value = "老师头像")
         private String avatar;
+        private String realName;
 
         @ApiModelProperty(value = "课程id")
         private Long courseId;

+ 8 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -690,5 +690,12 @@
         <![CDATA[ AND class_date_ <= #{param.endDate} ]]>
         group by class_date_
     </select>
-
+    <select id="selectPrice" resultType="java.math.BigDecimal">
+        SELECT p.subject_price_
+        FROM teacher_free_time t
+        LEFT JOIN teacher_subject_price p ON t.id_=p.teacher_free_time_id
+        WHERE t.teacher_id_=#{teacherId}
+        AND p.subject_id_=#{subjectId}
+        AND t.default_flag_=1
+    </select>
 </mapper>

+ 1 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleRepliedMapper.xml

@@ -154,8 +154,7 @@
         LEFT JOIN course_schedule s ON t.course_schedule_id_=s.id_
         LEFT JOIN course_group g ON t.course_group_id_=g.id_
         LEFT JOIN `subject` sb ON g.subject_id_=sb.id_
-        WHERE t.student_id_=#{studentId}
-        AND t.course_schedule_id_=#{courseScheduleId}
+        WHERE t.course_schedule_id_=#{courseScheduleId}
         AND t.course_group_id_=#{courseGroupId}
         AND t.course_group_type_=#{courseGroupType}
     </select>

+ 2 - 0
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/PaymentController.java

@@ -98,4 +98,6 @@ public class PaymentController extends BaseController {
             e.printStackTrace();
         }
     }
+    //支付宝授权回调地址
+    //aliCallback
 }

+ 14 - 19
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/UserOrderController.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
 import com.yonge.cooleshow.biz.dal.dto.req.OrderPayReq;
-import com.yonge.cooleshow.biz.dal.dto.req.OrderRefundReq;
 import com.yonge.cooleshow.biz.dal.dto.req.OrderReq;
 import com.yonge.cooleshow.biz.dal.dto.search.OrderSearch;
 import com.yonge.cooleshow.biz.dal.entity.UserOrder;
@@ -25,6 +24,8 @@ import com.yonge.toolset.utils.string.StringUtil;
 import com.yonge.toolset.utils.web.WebUtil;
 import io.swagger.annotations.*;
 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.*;
@@ -37,8 +38,6 @@ import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.temporal.TemporalAdjusters;
 import java.util.Date;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -49,6 +48,8 @@ import java.util.concurrent.TimeUnit;
 @RequestMapping("/userOrder")
 @Api(value = "订单接口", tags = "订单接口")
 public class UserOrderController extends BaseController {
+    private final static Logger log = LoggerFactory.getLogger(UserOrderController.class);
+
     @Autowired
     private SysUserFeignService sysUserFeignService;
     @Autowired
@@ -66,15 +67,12 @@ public class UserOrderController extends BaseController {
         orderReq.setUserId(user.getId());
 
         try {
-            Future<HttpResponseResult<UserOrder>> httpResponseResultFuture = DistributedLock.of(redissonClient)
-                    .callIfLockCanGet(CacheNameEnum.LOCK_EXECUTE_ORDER.getRedisKey(user.getId())
+            return DistributedLock.of(redissonClient)
+                    .runIfLockCanGet(CacheNameEnum.LOCK_EXECUTE_ORDER.getRedisKey(user.getId())
                             , () -> userOrderService.executeOrder(orderReq), 60L, TimeUnit.SECONDS);
-            return httpResponseResultFuture.get();
         } catch (BizException e) {
             return HttpResponseResult.failed(e.getMessage());
-        } catch (ExecutionException e) {
-            return HttpResponseResult.failed(e.getCause().getMessage());
-        } catch (Exception e) {
+        }  catch (Exception e) {
             e.printStackTrace();
             return HttpResponseResult.failed("下单失败");
         }
@@ -94,14 +92,11 @@ public class UserOrderController extends BaseController {
         payReq.setIpAddress(WebUtil.getRemoteIp(request));
 
         try {
-            Future<HttpResponseResult<OrderPayRes>> httpResponseResultFuture = DistributedLock.of(redissonClient)
-                    .callIfLockCanGet(CacheNameEnum.LOCK_EXECUTE_ORDER.getRedisKey(user.getId())
+            return DistributedLock.of(redissonClient)
+                    .runIfLockCanGet(CacheNameEnum.LOCK_EXECUTE_ORDER.getRedisKey(user.getId())
                             , () -> userOrderService.orderPay(payReq), 60L, TimeUnit.SECONDS);
-            return httpResponseResultFuture.get();
         } catch (BizException e) {
             return HttpResponseResult.failed(e.getMessage());
-        } catch (ExecutionException e) {
-            return HttpResponseResult.failed(e.getCause().getMessage());
         } catch (Exception e) {
             e.printStackTrace();
             return HttpResponseResult.failed("付款失败");
@@ -151,12 +146,12 @@ public class UserOrderController extends BaseController {
         }
         payReq.setUserId(user.getId());
 
-        Future<HttpResponseResult<Boolean>> httpResponseResultFuture = DistributedLock.of(redissonClient)
-                .callIfLockCanGet(CacheNameEnum.LOCK_EXECUTE_ORDER.getRedisKey(user.getId())
-                        , () -> userOrderService.orderCancel(payReq), 60L, TimeUnit.SECONDS);
-
         try {
-            return httpResponseResultFuture.get();
+            return DistributedLock.of(redissonClient)
+                    .runIfLockCanGet(CacheNameEnum.LOCK_EXECUTE_ORDER.getRedisKey(user.getId())
+                            , () -> userOrderService.orderCancel(payReq), 60L, TimeUnit.SECONDS);
+        } catch (BizException e) {
+            return HttpResponseResult.failed(e.getMessage());
         } catch (Exception e) {
             e.printStackTrace();
             return HttpResponseResult.failed("取消订单失败");

+ 16 - 2
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/UserBankCardController.java

@@ -13,6 +13,8 @@ import com.yonge.cooleshow.biz.dal.support.PageUtil;
 import com.yonge.cooleshow.biz.dal.vo.UserBankCardVo;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.toolset.base.exception.BizException;
+import com.yonge.toolset.base.exception.ThirdpartyException;
 import com.yonge.toolset.base.page.PageInfo;
 import com.yonge.toolset.utils.string.StringUtil;
 import io.swagger.annotations.Api;
@@ -73,7 +75,15 @@ public class UserBankCardController extends BaseController {
 			return failed(HttpStatus.FORBIDDEN, "请登录");
 		}
 		bankCard.setUserId(user.getId());
-		return userBankCardService.bankCard(bankCard);
+		try {
+			return userBankCardService.bankCard(bankCard);
+		}catch (ThirdpartyException e){
+			return HttpResponseResult.failed(e.getMessage());
+		}catch (BizException e){
+			return HttpResponseResult.failed(e.getMessage());
+		}catch (Exception e){
+			return HttpResponseResult.failed("绑卡失败");
+		}
 	}
 
 	@PostMapping("/unBind")
@@ -94,8 +104,12 @@ public class UserBankCardController extends BaseController {
 		bankCard.setUserId(user.getId());
 		try {
 			return userBankCardService.unBind(bankCard);
+		}catch (ThirdpartyException e){
+			return HttpResponseResult.failed(e.getMessage());
+		}catch (BizException e){
+			return HttpResponseResult.failed(e.getMessage());
 		}catch (Exception e){
-			return HttpResponseResult.failed("姓名与身份证号不一致");
+			return HttpResponseResult.failed("解绑失败");
 		}
 	}
 

+ 1 - 0
toolset/pom.xml

@@ -18,6 +18,7 @@
 	<url>http://maven.apache.org</url>
 
 	<properties>
+		<project.toolset.version>1.0</project.toolset.version>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 	</properties>
 

+ 2 - 1
toolset/thirdparty-component/src/main/java/com/yonge/toolset/thirdparty/user/realname/provider/LinkfaceRealnameAuthenticationPlugin.java

@@ -98,7 +98,8 @@ public class LinkfaceRealnameAuthenticationPlugin implements RealnameAuthenticat
                     msg = "查无此身份证号";
                 }
             } else {
-                msg = reason.get(status);
+                //msg = reason.get(status);
+                msg = "身份证号和姓名不一致";
             }
             throw new ThirdpartyException("实名认证失败,原因:{}", msg);
         }

+ 1 - 1
toolset/toolset-mybatis/pom.xml

@@ -10,7 +10,7 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>toolset-mybatis</artifactId>
-    <version>1.0</version>
+    <version>${project.toolset.version}</version>
     <name>toolset-mybatis</name>
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

+ 33 - 0
toolset/toolset-payment/payment-adapay/pom.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>toolset-payment</artifactId>
+        <groupId>com.yonge.toolset</groupId>
+        <version>1.0</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>payment-adapay</artifactId>
+    <packaging>jar</packaging>
+    <version>${project.toolset.version}</version>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.yonge.toolset</groupId>
+            <artifactId>payment-core</artifactId>
+            <version>1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.huifu.adapay</groupId>
+            <artifactId>adapay-java-sdk</artifactId>
+            <version>1.2.10</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alipay.sdk</groupId>
+            <artifactId>alipay-sdk-java</artifactId>
+            <version>4.23.0.ALL</version>
+        </dependency>
+    </dependencies>
+</project>

+ 133 - 0
toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/AdapayTemplate.java

@@ -0,0 +1,133 @@
+package com.yonge.toolset.payment.adapay;
+
+import com.alibaba.fastjson.JSONObject;
+import com.alipay.api.AlipayClient;
+import com.huifu.adapay.core.exception.BaseAdaPayException;
+import com.huifu.adapay.core.util.StringUtil;
+import com.huifu.adapay.model.Refund;
+import com.yonge.toolset.base.result.BaseResult;
+import com.yonge.toolset.payment.adapay.config.HuifuConfiguration;
+import com.yonge.toolset.payment.adapay.model.DeviceInfo;
+import com.yonge.toolset.payment.core.PaymentTemplate;
+import com.yonge.toolset.payment.core.enums.TradeStatusEnum;
+import com.yonge.toolset.payment.core.model.ClosePayment;
+import com.yonge.toolset.payment.core.model.Payment;
+import com.yonge.toolset.payment.core.model.RefundBill;
+import com.yonge.toolset.payment.core.model.res.ClosePaymentRes;
+import com.yonge.toolset.payment.core.model.res.PaymentRes;
+import com.yonge.toolset.payment.core.model.res.RefundBillRes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Component
+public class AdapayTemplate implements PaymentTemplate {
+    private final static Logger log = LoggerFactory.getLogger(AdapayTemplate.class);
+    @Autowired
+    private AlipayClient alipayClient;
+
+    @Override
+    public BaseResult<PaymentRes> executePayment(Payment payment) throws Exception {
+        Map<String, Object> paymentMap = new HashMap<>();
+        paymentMap.put("order_no", payment.getOrderNo());
+        paymentMap.put("app_id", HuifuConfiguration.getHuifuProperties().getAppId());
+        paymentMap.put("pay_channel", payment.getPayChannel().getCode());
+        paymentMap.put("pay_amt", payment.getPayAmt());
+        paymentMap.put("goods_title", payment.getOrderTitle());
+        paymentMap.put("goods_desc", payment.getOrderDesc());
+        paymentMap.put("div_members", JSONObject.toJSONString(payment.getDivMembers()));
+        paymentMap.put("description", payment.getDescription());
+        paymentMap.put("device_info", payment.getDeviceInfo());
+        paymentMap.put("expend", payment.getExpend());
+        paymentMap.put("notify_url", StringUtil.isEmpty(payment.getNotifyUrl()) ? HuifuConfiguration.getHuifuProperties().getNotifyUrl() : payment.getNotifyUrl());
+
+        log.info("汇付[创建支付对象] Req:{}", JSONObject.toJSONString(paymentMap));
+        //调用sdk方法,创建支付,得到支付对象
+        Map<String, Object> res;
+        try {
+            res = com.huifu.adapay.model.Payment.create(paymentMap);
+        } catch (BaseAdaPayException e) {
+            return BaseResult.failed(e.getMessage());
+        }
+        if (CollectionUtils.isEmpty(res)) {
+            return BaseResult.failed("请求失败");
+        }
+        log.info("汇付[创建支付对象] Resp:{}", res);
+        String errorCode = (String) res.get("error_code");
+        if (null != errorCode) {
+            String errorMsg = (String) res.get("error_msg");
+            return BaseResult.failed(errorMsg);
+        }
+        PaymentRes paymentRes = new PaymentRes();
+        BeanUtils.copyProperties(payment, paymentRes);
+        paymentRes.setId(res.get("id").toString());
+        paymentRes.setStatus(TradeStatusEnum.getByName(res.get("status").toString()));
+        return BaseResult.succeed(paymentRes);
+    }
+
+    @Override
+    public BaseResult<ClosePaymentRes> closePayment(ClosePayment closePayment) throws Exception {
+
+        Map<String, Object> paymentParams = new HashMap<>(10);
+        paymentParams.put("payment_id", closePayment.getPaymentId());
+        paymentParams.put("reason", closePayment.getReason());
+        paymentParams.put("expend", closePayment.getExpend());
+        paymentParams.put("notify_url", StringUtil.isEmpty(closePayment.getNotifyUrl()) ? HuifuConfiguration.getHuifuProperties().getNotifyUrl() : closePayment.getNotifyUrl());
+
+        Map<String, Object> res;
+        try {
+            res = com.huifu.adapay.model.Payment.close(paymentParams);
+        } catch (BaseAdaPayException e) {
+            return BaseResult.failed(e.getMessage());
+        }
+        if (CollectionUtils.isEmpty(res)) {
+            return BaseResult.failed("请求失败");
+        }
+        log.info("汇付[支付关单] Resp:{}", res);
+        String errorCode = (String) res.get("error_code");
+        if (null != errorCode) {
+            String errorMsg = (String) res.get("error_msg");
+            return BaseResult.failed(errorMsg);
+        }
+        ClosePaymentRes paymentRes = new ClosePaymentRes();
+        BeanUtils.copyProperties(closePayment, paymentRes);
+
+        paymentRes.setStatus(TradeStatusEnum.getByName(res.get("status").toString()));
+        return BaseResult.succeed(paymentRes);
+    }
+
+    @Override
+    public BaseResult<RefundBillRes> refundPayment(RefundBill refundBill) throws Exception {
+        Map<String, Object> refundParams = new HashMap<>(10);
+        refundParams.put("refund_amt", refundBill.getRefundAmt());
+        refundParams.put("refund_order_no", refundBill.getRefundNo());
+        refundParams.put("notify_url", StringUtil.isEmpty(refundBill.getNotifyUrl()) ? HuifuConfiguration.getHuifuProperties().getNotifyUrl() : refundBill.getNotifyUrl());
+
+        Map<String, Object> res;
+        try {
+            res = Refund.create(refundBill.getPaymentId(), refundParams);
+        } catch (BaseAdaPayException e) {
+            return BaseResult.failed(e.getMessage());
+        }
+        if (CollectionUtils.isEmpty(res)) {
+            return BaseResult.failed("请求失败");
+        }
+        log.info("汇付[支付退款] Resp:{}", res);
+        String errorCode = (String) res.get("error_code");
+        if (null != errorCode) {
+            String errorMsg = (String) res.get("error_msg");
+            return BaseResult.failed(errorMsg);
+        }
+
+        RefundBillRes billRes = new RefundBillRes();
+        BeanUtils.copyProperties(refundBill, billRes);
+        billRes.setStatus(TradeStatusEnum.getByName(res.get("status").toString()));
+        return BaseResult.succeed(billRes);
+    }
+}

+ 48 - 0
toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/config/HuifuConfiguration.java

@@ -0,0 +1,48 @@
+package com.yonge.toolset.payment.adapay.config;
+
+import com.alipay.api.AlipayClient;
+import com.alipay.api.DefaultAlipayClient;
+import com.huifu.adapay.Adapay;
+import com.huifu.adapay.model.MerConfig;
+import com.yonge.toolset.payment.adapay.props.HuifuProperties;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * 路由配置信息
+ */
+@Configuration
+@EnableConfigurationProperties({HuifuProperties.class})
+public class HuifuConfiguration {
+	private static HuifuProperties huifuProperties;
+	@Bean
+	public MerConfig merConfig(HuifuProperties authProperties) {
+		this.huifuProperties = authProperties;
+
+		MerConfig merConfig = new MerConfig();
+		merConfig.setApiKey(authProperties.getApiKey());
+		merConfig.setApiMockKey(authProperties.getMockApiKey());
+		merConfig.setRSAPrivateKey(authProperties.getRsaPrivateKey());
+		try {
+			Adapay.initWithMerConfig(merConfig);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return merConfig;
+	}
+
+	@Bean
+	public AlipayClient alipayClient(HuifuProperties authProperties){
+		AlipayClient alipayClient = new DefaultAlipayClient(
+				"https://openapi.alipay.com/gateway.do",
+				authProperties.getAliAppid(),
+				authProperties.getAliPrivatekey(),
+				"json","GBK",authProperties.getAliPublickey(),"RSA2");
+		return alipayClient;
+	}
+
+	public static HuifuProperties getHuifuProperties(){
+		return huifuProperties;
+	}
+}

+ 27 - 0
toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/model/DeviceInfo.java

@@ -0,0 +1,27 @@
+package com.yonge.toolset.payment.adapay.model;
+
+import java.io.Serializable;
+
+/**
+ * 交易设备信息
+ * @Author: liweifan
+ * @Data: 2022/3/31 11:36
+ */
+public class DeviceInfo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /***
+     * 交易设备所在的公网 IP
+     * @author liweifan
+     * @updateTime 2022/3/31 11:07
+     */
+    private String device_ip;
+
+    public String getDevice_ip() {
+        return device_ip;
+    }
+
+    public void setDevice_ip(String device_ip) {
+        this.device_ip = device_ip;
+    }
+}

+ 55 - 0
toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/model/DivMember.java

@@ -0,0 +1,55 @@
+package com.yonge.toolset.payment.adapay.model;
+
+import java.io.Serializable;
+
+/**
+ * 分账对象
+ * @Author: liweifan
+ * @Data: 2022/3/31 11:26
+ */
+public class DivMember implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 分账用户 Member对象 的 id;若是商户本身时,传入0
+     * @author liweifan
+     * @updateTime 2022/3/31 11:27
+     */
+    private String member_id;
+    /**
+     * 分账金额,精确到分,如0.50,1.00等,分账总金额必须等于主交易金额,金额不能为0.00
+     * @author liweifan
+     * @updateTime 2022/3/31 11:28
+     */
+    private String amount;
+    /**
+     * 是否手续费承担方,N-否,Y-是,手续费承担方有且只能有一个
+     * @author liweifan
+     * @updateTime 2022/3/31 11:28
+     */
+    private String fee_flag;
+
+    public String getMember_id() {
+        return member_id;
+    }
+
+    public void setMember_id(String member_id) {
+        this.member_id = member_id;
+    }
+
+    public String getAmount() {
+        return amount;
+    }
+
+    public void setAmount(String amount) {
+        this.amount = amount;
+    }
+
+    public String getFee_flag() {
+        return fee_flag;
+    }
+
+    public void setFee_flag(String fee_flag) {
+        this.fee_flag = fee_flag;
+    }
+}

+ 73 - 0
toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/model/PaymentConfirmParam.java

@@ -0,0 +1,73 @@
+package com.yonge.toolset.payment.adapay.model;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @Author: liweifan
+ * @Data: 2022/3/11 17:44
+ */
+public class PaymentConfirmParam implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    //Adapay生成的支付对象id
+    private String payment_id;
+    //请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
+    private String order_no;
+    //确认金额,必须大于0,保留两位小数点,如0.10、100.05等。必须小于等于原支付金额-已确认金额-已撤销金额。
+    private String confirm_amt;
+    //附加说明
+    private String description;
+    //分账对象信息列表,一次请求最多仅支持7个分账方
+    private List<DivMember> div_members;
+    //手续费收取模式:O-商户手续费账户扣取手续费,I-交易金额中扣取手续费;值为空时,默认值为I;若为O时,分账对象列表中不支持传入手续费承担方
+    private String fee_mode;
+
+    public String getPayment_id() {
+        return payment_id;
+    }
+
+    public void setPayment_id(String payment_id) {
+        this.payment_id = payment_id;
+    }
+
+    public String getOrder_no() {
+        return order_no;
+    }
+
+    public void setOrder_no(String order_no) {
+        this.order_no = order_no;
+    }
+
+    public String getConfirm_amt() {
+        return confirm_amt;
+    }
+
+    public void setConfirm_amt(String confirm_amt) {
+        this.confirm_amt = confirm_amt;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public List<DivMember> getDiv_members() {
+        return div_members;
+    }
+
+    public void setDiv_members(List<DivMember> div_members) {
+        this.div_members = div_members;
+    }
+
+    public String getFee_mode() {
+        return fee_mode;
+    }
+
+    public void setFee_mode(String fee_mode) {
+        this.fee_mode = fee_mode;
+    }
+}

+ 168 - 0
toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/model/PaymentReq.java

@@ -0,0 +1,168 @@
+package com.yonge.toolset.payment.adapay.model;
+
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ * 创建支付对象请求参数
+ * @Author: liweifan
+ * @Data: 2022/3/31 10:58
+ */
+public class PaymentReq implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /***
+     * 请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
+     * @author liweifan
+     * @updateTime 2022/3/31 11:00
+     */
+    private String order_no;
+    /***
+     * 控制台 主页面应用的app_id
+     * @author liweifan
+     * @updateTime 2022/3/31 11:00
+     */
+    private String app_id;
+    /***
+     * 支付渠道,参见 支付渠道
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String pay_channel;
+    /***
+     * 交易金额,必须大于0,保留两位小数点,如0.10、100.05等
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String pay_amt;
+    /***
+     * 商品标题
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String goods_title;
+    /***
+     * 商品描述信息,微信小程序和微信公众号该字段最大长度42个字符
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String goods_desc;
+    /***
+     * 分账对象信息列表,最多仅支持7个分账方,json 数组形式,详见 分账对象信息列表
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String div_members;
+    /***
+     * 订单附加说明
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String description;
+    /***
+     * 前端设备信息,详见 设备信息
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private DeviceInfo device_info;
+    /***
+     * 支付渠道额外参数,JSON格式,条件可输入,详见 支付渠道 expend参数
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private Map<String,Object> expend;
+    /***
+     * 异步通知地址,url为http/https路径,服务器POST回调,URL 上请勿附带参数
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private String notify_url;
+
+    public String getOrder_no() {
+        return order_no;
+    }
+
+    public void setOrder_no(String order_no) {
+        this.order_no = order_no;
+    }
+
+    public String getApp_id() {
+        return app_id;
+    }
+
+    public void setApp_id(String app_id) {
+        this.app_id = app_id;
+    }
+
+    public String getPay_amt() {
+        return pay_amt;
+    }
+
+    public void setPay_amt(String pay_amt) {
+        this.pay_amt = pay_amt;
+    }
+
+    public String getGoods_title() {
+        return goods_title;
+    }
+
+    public void setGoods_title(String goods_title) {
+        this.goods_title = goods_title;
+    }
+
+    public String getGoods_desc() {
+        return goods_desc;
+    }
+
+    public void setGoods_desc(String goods_desc) {
+        this.goods_desc = goods_desc;
+    }
+
+    public String getDiv_members() {
+        return div_members;
+    }
+
+    public void setDiv_members(String div_members) {
+        this.div_members = div_members;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public DeviceInfo getDevice_info() {
+        return device_info;
+    }
+
+    public void setDevice_info(DeviceInfo device_info) {
+        this.device_info = device_info;
+    }
+
+    public Map<String, Object> getExpend() {
+        return expend;
+    }
+
+    public void setExpend(Map<String, Object> expend) {
+        this.expend = expend;
+    }
+
+    public String getNotify_url() {
+        return notify_url;
+    }
+
+    public void setNotify_url(String notify_url) {
+        this.notify_url = notify_url;
+    }
+
+    public String getPay_channel() {
+        return pay_channel;
+    }
+
+    public void setPay_channel(String pay_channel) {
+        this.pay_channel = pay_channel;
+    }
+}

+ 149 - 0
toolset/toolset-payment/payment-adapay/src/main/java/com/yonge/toolset/payment/adapay/props/HuifuProperties.java

@@ -0,0 +1,149 @@
+package com.yonge.toolset.payment.adapay.props;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+
+@RefreshScope
+@ConfigurationProperties("huifu")
+public class HuifuProperties {
+	/***
+	 * 汇付 控制台 主页面应用的app_id
+	 * @author liweifan
+	 * @updateTime 2022/3/31 11:19
+	 */
+	private String appId;
+	/***
+	 * 汇付 控制台->商户信息管理->证书管理中的API Key(prod模式的API KEY)
+	 * @author liweifan
+	 * @updateTime 2022/3/31 11:19
+	 */
+	private String apiKey;
+	/***
+	 * 汇付 控制台->商户信息管理->证书管理中的API Key(mock模式的API KEY)
+	 * @author liweifan
+	 * @updateTime 2022/3/31 11:19
+	 */
+	private String mockApiKey;
+	/***
+	 * 商户发起请求时,用于请求参数加签所需要的RSA私钥
+	 * @author liweifan
+	 * @updateTime 2022/3/31 11:24
+	 */
+	private String rsaPrivateKey;
+	/***
+	 * 付款成功回调地址
+	 * @author liweifan
+	 * @updateTime 2022/3/31 11:24
+	 */
+	private String notifyUrl;
+	/***
+	 * 微信appid
+	 * @author liweifan
+	 * @updateTime 2022/3/31 11:24
+	 */
+	private String wxAppid;
+	/***
+	 * 微信secret
+	 * @author liweifan
+	 * @updateTime 2022/3/31 11:24
+	 */
+	private String wxSecret;
+	/***
+	 * 支付宝appid
+	 * @author liweifan
+	 * @updateTime 2022/3/31 11:24
+	 */
+	private String aliAppid;
+	/***
+	 * 支付宝开发者私钥(由开发者自己生成)
+	 * @author liweifan
+	 * @updateTime 2022/3/31 11:24
+	 */
+	private String aliPrivatekey;
+	/***
+	 * 支付宝公钥(由支付宝生成)
+	 * @author liweifan
+	 * @updateTime 2022/3/31 11:24
+	 */
+	private String aliPublickey;
+
+	public String getApiKey() {
+		return apiKey;
+	}
+
+	public void setApiKey(String apiKey) {
+		this.apiKey = apiKey;
+	}
+
+	public String getMockApiKey() {
+		return mockApiKey;
+	}
+
+	public void setMockApiKey(String mockApiKey) {
+		this.mockApiKey = mockApiKey;
+	}
+
+	public String getRsaPrivateKey() {
+		return rsaPrivateKey;
+	}
+
+	public void setRsaPrivateKey(String rsaPrivateKey) {
+		this.rsaPrivateKey = rsaPrivateKey;
+	}
+
+	public String getAppId() {
+		return appId;
+	}
+
+	public void setAppId(String appId) {
+		this.appId = appId;
+	}
+
+	public String getWxAppid() {
+		return wxAppid;
+	}
+
+	public void setWxAppid(String wxAppid) {
+		this.wxAppid = wxAppid;
+	}
+
+	public String getWxSecret() {
+		return wxSecret;
+	}
+
+	public void setWxSecret(String wxSecret) {
+		this.wxSecret = wxSecret;
+	}
+
+	public String getNotifyUrl() {
+		return notifyUrl;
+	}
+
+	public void setNotifyUrl(String notifyUrl) {
+		this.notifyUrl = notifyUrl;
+	}
+
+	public String getAliAppid() {
+		return aliAppid;
+	}
+
+	public void setAliAppid(String aliAppid) {
+		this.aliAppid = aliAppid;
+	}
+
+	public String getAliPrivatekey() {
+		return aliPrivatekey;
+	}
+
+	public void setAliPrivatekey(String aliPrivatekey) {
+		this.aliPrivatekey = aliPrivatekey;
+	}
+
+	public String getAliPublickey() {
+		return aliPublickey;
+	}
+
+	public void setAliPublickey(String aliPublickey) {
+		this.aliPublickey = aliPublickey;
+	}
+}

+ 18 - 0
toolset/toolset-payment/payment-core/pom.xml

@@ -10,8 +10,20 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>payment-core</artifactId>
+    <packaging>jar</packaging>
+    <version>${project.toolset.version}</version>
+
+
+    <properties>
+        <redisson.version>3.16.4</redisson.version>
+    </properties>
 
     <dependencies>
+        <dependency>
+            <groupId>com.yonge.toolset</groupId>
+            <artifactId>toolset-mybatis</artifactId>
+            <version>${project.toolset.version}</version>
+        </dependency>
         <!-- mybatis-plus -->
         <dependency>
             <groupId>com.baomidou</groupId>
@@ -19,5 +31,11 @@
             <version>3.0.7.1</version>
             <scope>provided</scope>
         </dependency>
+        <!-- redisson -->
+        <dependency>
+            <groupId>org.redisson</groupId>
+            <artifactId>redisson-spring-boot-starter</artifactId>
+            <version>${redisson.version}</version>
+        </dependency>
     </dependencies>
 </project>

+ 0 - 14
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/config/PaymentConfiguration.java

@@ -1,14 +0,0 @@
-package com.yonge.toolset.payment.config;
-
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * Sms配置类
- *
- * @author Chill
- */
-@Configuration
-@EnableConfigurationProperties(PaymentConfiguration.class)
-public class PaymentConfiguration {
-}

+ 9 - 9
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/PaymentTemplate.java → toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/PaymentTemplate.java

@@ -1,12 +1,12 @@
-package com.yonge.toolset.payment;
+package com.yonge.toolset.payment.core;
 
 import com.yonge.toolset.base.result.BaseResult;
-import com.yonge.toolset.payment.model.ClosePayment;
-import com.yonge.toolset.payment.model.Payment;
-import com.yonge.toolset.payment.model.RefundBill;
-import com.yonge.toolset.payment.model.res.ClosePaymentRes;
-import com.yonge.toolset.payment.model.res.PaymentRes;
-import com.yonge.toolset.payment.model.res.RefundBillRes;
+import com.yonge.toolset.payment.core.model.ClosePayment;
+import com.yonge.toolset.payment.core.model.Payment;
+import com.yonge.toolset.payment.core.model.RefundBill;
+import com.yonge.toolset.payment.core.model.res.ClosePaymentRes;
+import com.yonge.toolset.payment.core.model.res.PaymentRes;
+import com.yonge.toolset.payment.core.model.res.RefundBillRes;
 
 /**
  * @Author: liweifan
@@ -26,7 +26,7 @@ public interface PaymentTemplate {
      * @author liweifan
      * @param: closePayment
      * @updateTime 2022/5/10 15:34
-     * @return: com.yonge.toolset.base.result.BaseResult<com.yonge.toolset.payment.model.res.ClosePaymentRes>
+     * @return: com.yonge.toolset.base.result.BaseResult<com.yonge.toolset.payment.core.model.res.ClosePaymentRes>
      */
     BaseResult<ClosePaymentRes> closePayment(ClosePayment closePayment) throws Exception;
 
@@ -35,7 +35,7 @@ public interface PaymentTemplate {
      * @author liweifan
      * @param: closePayment
      * @updateTime 2022/5/10 15:34
-     * @return: com.yonge.toolset.base.result.BaseResult<com.yonge.toolset.payment.model.res.ClosePaymentRes>
+     * @return: com.yonge.toolset.base.result.BaseResult<com.yonge.toolset.payment.core.model.res.ClosePaymentRes>
      */
     BaseResult<RefundBillRes> refundPayment(RefundBill refundBill) throws Exception;
 

+ 1 - 1
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/constant/PaymentConstant.java → toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/constant/PaymentConstant.java

@@ -1,4 +1,4 @@
-package com.yonge.toolset.payment.constant;
+package com.yonge.toolset.payment.core.constant;
 
 /**
  * @Author: liweifan

+ 9 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/dao/SysConfigPaymentDao.java

@@ -0,0 +1,9 @@
+package com.yonge.toolset.payment.core.dao;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yonge.toolset.payment.core.entity.SysConfigPayment;
+
+public interface SysConfigPaymentDao extends BaseMapper<SysConfigPayment> {
+
+}

+ 95 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/entity/SysConfigPayment.java

@@ -0,0 +1,95 @@
+package com.yonge.toolset.payment.core.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * 支付服务配置参数
+ */
+@TableName("sys_config_payment")
+public class SysConfigPayment implements Serializable {
+	private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id_", type = IdType.AUTO)
+    private Long id;
+	@TableField(value = "open_type_")
+    private String openType;
+	@TableField(value = "param_name_")
+    private String paramName;
+	@TableField(value = "param_value_")
+    private String paramValue;
+	@TableField(value = "description_")
+    private String description;
+	@TableField(value = "create_time_")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date createTime;
+	@TableField(value = "update_time_")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date updateTime;
+
+	public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+    
+	public String getOpenType() {
+        return openType;
+    }
+
+    public void setOpenType(String openType) {
+        this.openType = openType;
+    }
+    
+	public String getParamName() {
+        return paramName;
+    }
+
+    public void setParamName(String paramName) {
+        this.paramName = paramName;
+    }
+    
+	public String getParamValue() {
+        return paramValue;
+    }
+
+    public void setParamValue(String paramValue) {
+        this.paramValue = paramValue;
+    }
+    
+	public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+    
+	public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+    
+	public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+    
+}

+ 2 - 2
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/enums/OpenEnum.java → toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/enums/OpenEnum.java

@@ -1,4 +1,4 @@
-package com.yonge.toolset.payment.enums;
+package com.yonge.toolset.payment.core.enums;
 
 import com.yonge.toolset.base.enums.BaseEnum;
 
@@ -9,7 +9,7 @@ import com.yonge.toolset.base.enums.BaseEnum;
  */
 public enum OpenEnum implements BaseEnum<String, OpenEnum> {
     ORIGINAL("ORIGINAL","微信支付宝"),
-    adapay("ADAPAY","汇付")
+    ADAPAY("ADAPAY","汇付")
     ;
     private String code;
     private String msg;

+ 1 - 1
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/enums/PayChannelEnum.java → toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/enums/PayChannelEnum.java

@@ -1,4 +1,4 @@
-package com.yonge.toolset.payment.enums;
+package com.yonge.toolset.payment.core.enums;
 
 import com.baomidou.mybatisplus.annotation.EnumValue;
 import com.yonge.toolset.base.enums.BaseEnum;

+ 10 - 1
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/enums/TradeStatusEnum.java → toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/enums/TradeStatusEnum.java

@@ -1,4 +1,4 @@
-package com.yonge.toolset.payment.enums;
+package com.yonge.toolset.payment.core.enums;
 
 import com.baomidou.mybatisplus.annotation.EnumValue;
 import com.yonge.toolset.base.enums.BaseEnum;
@@ -39,4 +39,13 @@ public enum TradeStatusEnum implements BaseEnum<String, TradeStatusEnum> {
     public String getCode() {
         return this.code;
     }
+
+    public static TradeStatusEnum getByName(String name) {
+        for (TradeStatusEnum statusEnum : TradeStatusEnum.values()) {
+            if (statusEnum.getCode().equals(name)) {
+                return statusEnum;
+            }
+        }
+        return null;
+    }
 }

+ 2 - 2
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/ClosePayment.java → toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/ClosePayment.java

@@ -1,6 +1,6 @@
-package com.yonge.toolset.payment.model;
+package com.yonge.toolset.payment.core.model;
 
-import com.yonge.toolset.payment.enums.PayChannelEnum;
+import com.yonge.toolset.payment.core.enums.PayChannelEnum;
 
 import java.io.Serializable;
 

+ 27 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/DeviceInfo.java

@@ -0,0 +1,27 @@
+package com.yonge.toolset.payment.core.model;
+
+import java.io.Serializable;
+
+/**
+ * 交易设备信息
+ * @Author: liweifan
+ * @Data: 2022/3/31 11:36
+ */
+public class DeviceInfo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /***
+     * 交易设备所在的公网 IP
+     * @author liweifan
+     * @updateTime 2022/3/31 11:07
+     */
+    private String device_ip;
+
+    public String getDevice_ip() {
+        return device_ip;
+    }
+
+    public void setDevice_ip(String device_ip) {
+        this.device_ip = device_ip;
+    }
+}

+ 55 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/DivMember.java

@@ -0,0 +1,55 @@
+package com.yonge.toolset.payment.core.model;
+
+import java.io.Serializable;
+
+/**
+ * 分账对象
+ * @Author: liweifan
+ * @Data: 2022/3/31 11:26
+ */
+public class DivMember implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 分账用户 Member对象 的 id;若是商户本身时,传入0
+     * @author liweifan
+     * @updateTime 2022/3/31 11:27
+     */
+    private String member_id;
+    /**
+     * 分账金额,精确到分,如0.50,1.00等,分账总金额必须等于主交易金额,金额不能为0.00
+     * @author liweifan
+     * @updateTime 2022/3/31 11:28
+     */
+    private String amount;
+    /**
+     * 是否手续费承担方,N-否,Y-是,手续费承担方有且只能有一个
+     * @author liweifan
+     * @updateTime 2022/3/31 11:28
+     */
+    private String fee_flag;
+
+    public String getMember_id() {
+        return member_id;
+    }
+
+    public void setMember_id(String member_id) {
+        this.member_id = member_id;
+    }
+
+    public String getAmount() {
+        return amount;
+    }
+
+    public void setAmount(String amount) {
+        this.amount = amount;
+    }
+
+    public String getFee_flag() {
+        return fee_flag;
+    }
+
+    public void setFee_flag(String fee_flag) {
+        this.fee_flag = fee_flag;
+    }
+}

+ 49 - 2
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/Payment.java → toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/Payment.java

@@ -1,11 +1,14 @@
-package com.yonge.toolset.payment.model;
+package com.yonge.toolset.payment.core.model;
 
-import com.yonge.toolset.payment.enums.PayChannelEnum;
+import com.yonge.toolset.payment.core.enums.PayChannelEnum;
 
 import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 统一支付对象
+ *
  * @Author: liweifan
  * @Data: 2022/5/10 15:06
  */
@@ -46,6 +49,7 @@ public class Payment implements Serializable {
      * @updateTime 2022/3/31 11:01
      */
     private String description;
+
     /***
      * 异步通知地址,url为http/https路径,服务器POST回调,URL 上请勿附带参数
      * @author liweifan
@@ -53,6 +57,25 @@ public class Payment implements Serializable {
      */
     private String notifyUrl;
 
+    /***
+     * 分账对象信息列表
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private List<DivMember> divMembers;
+    /***
+     * 前端设备信息
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private DeviceInfo deviceInfo;
+    /***
+     * 支付渠道额外参数
+     * @author liweifan
+     * @updateTime 2022/3/31 11:01
+     */
+    private Map<String,Object> expend;
+
 
     public String getOrderNo() {
         return orderNo;
@@ -109,4 +132,28 @@ public class Payment implements Serializable {
     public void setPayChannel(PayChannelEnum payChannel) {
         this.payChannel = payChannel;
     }
+
+    public List<DivMember> getDivMembers() {
+        return divMembers;
+    }
+
+    public void setDivMembers(List<DivMember> divMembers) {
+        this.divMembers = divMembers;
+    }
+
+    public DeviceInfo getDeviceInfo() {
+        return deviceInfo;
+    }
+
+    public void setDeviceInfo(DeviceInfo deviceInfo) {
+        this.deviceInfo = deviceInfo;
+    }
+
+    public Map<String, Object> getExpend() {
+        return expend;
+    }
+
+    public void setExpend(Map<String, Object> expend) {
+        this.expend = expend;
+    }
 }

+ 2 - 2
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/RefundBill.java → toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/RefundBill.java

@@ -1,6 +1,6 @@
-package com.yonge.toolset.payment.model;
+package com.yonge.toolset.payment.core.model;
 
-import com.yonge.toolset.payment.enums.PayChannelEnum;
+import com.yonge.toolset.payment.core.enums.PayChannelEnum;
 
 import java.io.Serializable;
 import java.math.BigDecimal;

+ 3 - 3
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/res/ClosePaymentRes.java → toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/res/ClosePaymentRes.java

@@ -1,7 +1,7 @@
-package com.yonge.toolset.payment.model.res;
+package com.yonge.toolset.payment.core.model.res;
 
-import com.yonge.toolset.payment.enums.TradeStatusEnum;
-import com.yonge.toolset.payment.model.ClosePayment;
+import com.yonge.toolset.payment.core.enums.TradeStatusEnum;
+import com.yonge.toolset.payment.core.model.ClosePayment;
 
 /**
  * 支付关单返回对象

+ 3 - 3
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/res/PaymentRes.java → toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/res/PaymentRes.java

@@ -1,7 +1,7 @@
-package com.yonge.toolset.payment.model.res;
+package com.yonge.toolset.payment.core.model.res;
 
-import com.yonge.toolset.payment.enums.TradeStatusEnum;
-import com.yonge.toolset.payment.model.Payment;
+import com.yonge.toolset.payment.core.enums.TradeStatusEnum;
+import com.yonge.toolset.payment.core.model.Payment;
 
 /**
  * 支付返回对象

+ 3 - 3
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/model/res/RefundBillRes.java → toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/model/res/RefundBillRes.java

@@ -1,7 +1,7 @@
-package com.yonge.toolset.payment.model.res;
+package com.yonge.toolset.payment.core.model.res;
 
-import com.yonge.toolset.payment.enums.TradeStatusEnum;
-import com.yonge.toolset.payment.model.RefundBill;
+import com.yonge.toolset.payment.core.enums.TradeStatusEnum;
+import com.yonge.toolset.payment.core.model.RefundBill;
 
 /**
  * @Author: liweifan

+ 22 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/service/SysConfigPaymentService.java

@@ -0,0 +1,22 @@
+package com.yonge.toolset.payment.core.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.yonge.toolset.payment.core.entity.SysConfigPayment;
+import com.yonge.toolset.payment.core.enums.OpenEnum;
+
+/**
+ * 支付服务配置参数 服务类
+ * @author liweifan
+ * @date 2022-05-10
+ */
+public interface SysConfigPaymentService extends IService<SysConfigPayment>  {
+	/***
+	 * 获取支付配置
+	 * @author liweifan
+	 * @param: openType 支付服务提供方
+	 * @param: paramName 配置名称
+	 * @updateTime 2022/5/10 22:55
+	 * @return: com.yonge.toolset.payment.core.entity.SysConfigPayment
+	 */
+	SysConfigPayment getPaymentConfig(OpenEnum openType,String paramName);
+}

+ 53 - 0
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/core/service/impl/SysConfigPaymentServiceImpl.java

@@ -0,0 +1,53 @@
+package com.yonge.toolset.payment.core.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yonge.toolset.payment.core.dao.SysConfigPaymentDao;
+import com.yonge.toolset.payment.core.entity.SysConfigPayment;
+import com.yonge.toolset.payment.core.enums.OpenEnum;
+import com.yonge.toolset.payment.core.service.SysConfigPaymentService;
+import com.yonge.toolset.utils.string.StringUtil;
+import org.redisson.api.RedissonClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.PostConstruct;
+import java.util.List;
+
+
+@Service
+public class SysConfigPaymentServiceImpl extends ServiceImpl<SysConfigPaymentDao, SysConfigPayment> implements SysConfigPaymentService {
+
+    private final static Logger log = LoggerFactory.getLogger(SysConfigPaymentServiceImpl.class);
+
+    @Autowired
+    private RedissonClient redissonClient;
+
+    private static final String REDIS_KEY = "CONFIG_PAYMENT";
+
+    @PostConstruct
+    private void init() {
+        List<SysConfigPayment> sysConfigPayments = baseMapper.selectList(Wrappers.emptyWrapper());
+        for (SysConfigPayment configPayment : sysConfigPayments) {
+            redissonClient.getBucket(REDIS_KEY + ":" + configPayment.getOpenType()+ ":" + configPayment.getParamName()).set(configPayment);
+        }
+    }
+
+    @Override
+    public SysConfigPayment getPaymentConfig(OpenEnum openType, String paramName) {
+        if (null == openType || StringUtil.isEmpty(paramName)) {
+            return null;
+        }
+        SysConfigPayment configPayment = (SysConfigPayment) redissonClient.getBucket(REDIS_KEY + ":" + openType.getCode() + ":" + paramName).get();
+        if (null == configPayment) {
+            configPayment = baseMapper.selectOne(Wrappers.<SysConfigPayment>lambdaQuery()
+                    .eq(SysConfigPayment::getOpenType, openType.getCode())
+                    .eq(SysConfigPayment::getParamName, paramName)
+            );
+            redissonClient.getBucket(REDIS_KEY + ":" + openType.getCode() + ":" + paramName).set(configPayment);
+        }
+        return configPayment;
+    }
+}

+ 0 - 8
toolset/toolset-payment/payment-core/src/main/java/com/yonge/toolset/payment/props/PaymentProperties.java

@@ -1,8 +0,0 @@
-package com.yonge.toolset.payment.props;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-@ConfigurationProperties(prefix = "sms")
-public class PaymentProperties {
-
-}

+ 2 - 0
toolset/toolset-payment/pom.xml

@@ -11,9 +11,11 @@
 
     <artifactId>toolset-payment</artifactId>
     <packaging>pom</packaging>
+    <version>${project.toolset.version}</version>
 
     <modules>
         <module>payment-core</module>
+        <module>payment-adapay</module>
     </modules>
 
     <dependencies>