feat: 东区缴费分支初始化
This commit is contained in:
+9
@@ -123,6 +123,15 @@ public class EduBillController {
|
||||
return ResultBean.buildSuccess(eduBillStudentService.exportBillPayData(billStudentSelectPageDTO, response));
|
||||
}
|
||||
|
||||
@GetMapping(value = "sendBillNotice")
|
||||
@ApiOperation(value = "账单催缴")
|
||||
public ResultBean<String> sendBillNotice(
|
||||
@ApiParam(value = "账单id", required = true) @RequestParam Long billId,
|
||||
@ApiParam(value = "推送标题", required = true) @RequestParam String noticeTitle) {
|
||||
eduBillStudentService.sendBillNotice(billId, noticeTitle);
|
||||
return ResultBean.buildSuccess();
|
||||
}
|
||||
|
||||
@PostMapping(value = "listBillOrderPage")
|
||||
@ApiOperation(value = "查询账单订单列表数据")
|
||||
public ResultBean<IPage<BillOrderSelectPageVO>> listBillOrderPage(BillOrderSelectPageDTO dto) {
|
||||
|
||||
+15
@@ -53,4 +53,19 @@ public interface EduBillOrderItemMapper extends BaseMapper<EduBillOrderItem> {
|
||||
*/
|
||||
List<BillPayVO> listItemPayInfo(@Param("billId") Long billId,
|
||||
@Param("studentId") Long studentId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询学生是否有对应账单项目的缴费信息
|
||||
*
|
||||
* @param billId 账单id
|
||||
* @param studentId 学生id
|
||||
* @param itemId 项目id
|
||||
* @return int
|
||||
* @author ZYJ
|
||||
* @date 2023/9/19 14:58
|
||||
*/
|
||||
int countItemPayInfo(@Param("billId") Long billId,
|
||||
@Param("studentId") Long studentId,
|
||||
@Param("itemId") Long itemId);
|
||||
}
|
||||
|
||||
+4
-2
@@ -62,12 +62,14 @@ public interface EduBillOrderMapper extends BaseMapper<EduBillOrder> {
|
||||
* 查询账单缴费人数
|
||||
* 缴费金额大于0
|
||||
*
|
||||
* @param billId 账单id
|
||||
* @param billId 账单id
|
||||
* @param studentIds 学生id集合
|
||||
* @return java.lang.Long
|
||||
* @author ZYJ
|
||||
* @date 2022/4/18 16:30
|
||||
*/
|
||||
Long sumPayStudentNumber(@Param("billId") Long billId);
|
||||
Long sumPayStudentNumber(@Param("billId") Long billId,
|
||||
@Param("studentIds") List<Long> studentIds);
|
||||
|
||||
/**
|
||||
* 查询所有已经超时订单
|
||||
|
||||
+12
@@ -48,4 +48,16 @@ public interface EduBillOrderItemService extends IService<EduBillOrderItem> {
|
||||
* @date 2022/4/19 17:04
|
||||
*/
|
||||
List<BillPayVO> listItemPayInfo(Long billId, Long studentId);
|
||||
|
||||
/**
|
||||
* 查询学生是否有对应账单项目的缴费信息
|
||||
*
|
||||
* @param billId 账单id
|
||||
* @param studentId 学生id
|
||||
* @param itemId 项目id
|
||||
* @return int
|
||||
* @author ZYJ
|
||||
* @date 2023/9/19 14:57
|
||||
*/
|
||||
int countItemPayInfo(Long billId, Long studentId, Long itemId);
|
||||
}
|
||||
|
||||
+4
-2
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yida.data.common.core.entity.mall.EduBillOrder;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -45,12 +46,13 @@ public interface EduBillOrderService extends IService<EduBillOrder> {
|
||||
/**
|
||||
* 查询账单缴费人数
|
||||
*
|
||||
* @param billId 账单id
|
||||
* @param billId 账单id
|
||||
* @param studentIds 学生id集合
|
||||
* @return java.lang.Long
|
||||
* @author ZYJ
|
||||
* @date 2022/4/18 16:29
|
||||
*/
|
||||
Long sumPayStudentNumber(Long billId);
|
||||
Long sumPayStudentNumber(Long billId, List<Long> studentIds);
|
||||
|
||||
/**
|
||||
* 银联支付通知结果回调
|
||||
|
||||
+13
@@ -2,10 +2,12 @@ package com.yida.data.mall.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yida.data.common.core.entity.constant.FebsConstant;
|
||||
import com.yida.data.common.core.entity.mall.EduBillStudent;
|
||||
import com.yida.data.mall.dto.BillStudentSelectPageDTO;
|
||||
import com.yida.data.mall.dto.BillUserSaveDTO;
|
||||
import com.yida.data.mall.vo.BillStudentInfoVO;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
@@ -79,4 +81,15 @@ public interface EduBillStudentService extends IService<EduBillStudent> {
|
||||
* @date 2022/10/11 17:29
|
||||
*/
|
||||
String exportBillPayData(BillStudentSelectPageDTO billStudentSelectPageDTO, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 账单催缴
|
||||
*
|
||||
* @param billId 账单id
|
||||
* @param noticeTitle 推送标题
|
||||
* @author ZYJ
|
||||
* @date 2023/7/14 14:30
|
||||
*/
|
||||
@Async(FebsConstant.ASYNC_POOL)
|
||||
void sendBillNotice(Long billId, String noticeTitle);
|
||||
}
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ public interface H5EduBillService {
|
||||
H5BillOrderInfoVO getH5BillOrderInfo(Long billOrderId, String orderCode);
|
||||
|
||||
/**
|
||||
* 继续支付
|
||||
* continuePayOrder
|
||||
*
|
||||
* @param orderCode 订单号
|
||||
* @param deptId 学校id
|
||||
|
||||
+5
@@ -38,4 +38,9 @@ public class EduBillOrderItemServiceImpl extends ServiceImpl
|
||||
public List<BillPayVO> listItemPayInfo(Long billId, Long studentId) {
|
||||
return baseMapper.listItemPayInfo(billId, studentId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countItemPayInfo(Long billId, Long studentId, Long itemId) {
|
||||
return baseMapper.countItemPayInfo(billId, studentId, itemId);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -65,8 +65,8 @@ public class EduBillOrderServiceImpl extends ServiceImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long sumPayStudentNumber(Long billId) {
|
||||
return baseMapper.sumPayStudentNumber(billId);
|
||||
public Long sumPayStudentNumber(Long billId, List<Long> studentIds) {
|
||||
return baseMapper.sumPayStudentNumber(billId, studentIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,7 +76,7 @@ public class EduBillOrderServiceImpl extends ServiceImpl
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
for (EduBillOrder order : list) {
|
||||
// 微信订单
|
||||
if (PayWay.WEI_XIN.getValue().equals(order.getPayWay())) {
|
||||
if (PayWay.WEIXIN.getValue().equals(order.getPayWay())) {
|
||||
updateWxBillOrderStatus(order);
|
||||
} else if (PayWay.UNION.getValue().equals(order.getPayWay())) {
|
||||
updateUnionBillOrderStatus(order);
|
||||
@@ -210,7 +210,7 @@ public class EduBillOrderServiceImpl extends ServiceImpl
|
||||
if (CollUtil.isNotEmpty(refundOrderList)) {
|
||||
refundOrderList.forEach(billRefundOrderVO -> {
|
||||
// 微信
|
||||
if (PayWay.WEI_XIN.getValue().equals(billRefundOrderVO.getPayWay())) {
|
||||
if (PayWay.WEIXIN.getValue().equals(billRefundOrderVO.getPayWay())) {
|
||||
updateWxRefundStatus(billRefundOrderVO);
|
||||
} else if (PayWay.UNION.getValue().equals(billRefundOrderVO.getPayWay())) {
|
||||
updateUnionRefundStatus(billRefundOrderVO);
|
||||
|
||||
+4
-7
@@ -89,7 +89,7 @@ public class EduBillServiceImpl extends ServiceImpl
|
||||
billSelectPageVO.setTotalNumber(totalNumber);
|
||||
// 缴费人数 缴费金额大于0
|
||||
if (totalNumber > 0) {
|
||||
billSelectPageVO.setPayNumber(eduBillOrderService.sumPayStudentNumber(billSelectPageVO.getId()));
|
||||
billSelectPageVO.setPayNumber(eduBillOrderService.sumPayStudentNumber(billSelectPageVO.getId(), studentIds));
|
||||
}
|
||||
});
|
||||
return page;
|
||||
@@ -199,10 +199,8 @@ public class EduBillServiceImpl extends ServiceImpl
|
||||
new LambdaQueryWrapper<>(new EduBillStudent()).eq(EduBillStudent::getBillId, billSaveDTO.getId()));
|
||||
}
|
||||
saveOrUpdate(eduBill);
|
||||
boolean flag = Objects.isNull(billSaveDTO.getId()) ||
|
||||
(Objects.nonNull(billSaveDTO.getId()) &&
|
||||
(Objects.isNull(billSaveDTO.getOldBillStartDate())
|
||||
|| billSaveDTO.getOldBillStartDate().isAfter(LocalDateTime.now())));
|
||||
boolean flag = Objects.isNull(billSaveDTO.getId()) || Objects.isNull(billSaveDTO.getOldBillStartDate())
|
||||
|| billSaveDTO.getOldBillStartDate().isAfter(LocalDateTime.now());
|
||||
List<EduBillItem> saveItemList = new ArrayList<>();
|
||||
if (flag) {
|
||||
// 保存对应的缴费项目数据
|
||||
@@ -282,8 +280,7 @@ public class EduBillServiceImpl extends ServiceImpl
|
||||
if (BillStatusEnum.ENABLE_STATUS.getStatus().equals(bill.getEnableStatus())) {
|
||||
throw new FebsException("当前账单已启用, 无法删除!");
|
||||
}
|
||||
if (Objects.isNull(bill.getBillStartDate()) ||
|
||||
Objects.nonNull(bill.getBillStartDate()) && bill.getBillStartDate().isAfter(LocalDateTime.now())) {
|
||||
if (Objects.isNull(bill.getBillStartDate()) || bill.getBillStartDate().isAfter(LocalDateTime.now())) {
|
||||
// 删除项目子选项
|
||||
eduBillItemSubService.remove(
|
||||
new LambdaQueryWrapper<>(new EduBillItemSub()).eq(EduBillItemSub::getBillId, billId));
|
||||
|
||||
-2
@@ -123,8 +123,6 @@ public class EduBillStatisticsServiceImpl implements EduBillStatisticsService {
|
||||
// 查询指定账单数据
|
||||
billList.add(eduBillService.getById(billId));
|
||||
}
|
||||
// 查询已开始的账单
|
||||
// List<EduBill> billList = eduBillMapper.selectStartBill();
|
||||
|
||||
if (CollUtil.isNotEmpty(billList)) {
|
||||
for (EduBill eduBill : billList) {
|
||||
|
||||
+92
-5
@@ -2,6 +2,7 @@ package com.yida.data.mall.service.impl;
|
||||
|
||||
import cc.mrbird.febs.common.redis.service.RedisService;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
@@ -15,10 +16,16 @@ import com.yida.data.common.core.entity.constant.StringConstant;
|
||||
import com.yida.data.common.core.entity.mall.EduBill;
|
||||
import com.yida.data.common.core.entity.mall.EduBillOrder;
|
||||
import com.yida.data.common.core.entity.mall.EduBillStudent;
|
||||
import com.yida.data.common.core.entity.notice.app.AppNotice;
|
||||
import com.yida.data.common.core.entity.notice.app.inside.PushMessage;
|
||||
import com.yida.data.common.core.entity.system.EduYidaApp;
|
||||
import com.yida.data.common.core.entity.user.EduParent;
|
||||
import com.yida.data.common.core.entity.user.EduStudent;
|
||||
import com.yida.data.common.core.enums.OrderStatusEnum;
|
||||
import com.yida.data.common.core.exception.FebsException;
|
||||
import com.yida.data.common.core.utils.AppUtil;
|
||||
import com.yida.data.common.core.utils.FebsUtil;
|
||||
import com.yida.data.common.service.CommonService;
|
||||
import com.yida.data.mall.dto.BillStudentSelectPageDTO;
|
||||
import com.yida.data.mall.dto.BillUserSaveDTO;
|
||||
import com.yida.data.mall.mapper.EduBillMapper;
|
||||
@@ -31,11 +38,13 @@ import com.yida.data.mall.vo.BillItemInfoVO;
|
||||
import com.yida.data.mall.vo.BillStudentInfoVO;
|
||||
import com.yida.data.mall.vo.h5.H5BillItemVO;
|
||||
import com.yida.data.system.feign.RemoteCommonService;
|
||||
import com.yida.data.user.dto.ListStudentDTO;
|
||||
import com.yida.data.user.feign.RemoteStudentService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -44,10 +53,7 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -63,8 +69,8 @@ import java.util.stream.Collectors;
|
||||
public class EduBillStudentServiceImpl extends ServiceImpl
|
||||
<EduBillStudentMapper, EduBillStudent> implements EduBillStudentService {
|
||||
|
||||
private final CommonService commonService;
|
||||
private final RemoteStudentService remoteStudentService;
|
||||
private final RemoteCommonService remoteCommonService;
|
||||
|
||||
private final EduBillOrderService eduBillOrderService;
|
||||
private final EduBillOrderItemService eduBillOrderItemService;
|
||||
@@ -77,6 +83,12 @@ public class EduBillStudentServiceImpl extends ServiceImpl
|
||||
|
||||
private final RedisService redisService;
|
||||
|
||||
@Value("${febs.pushUrl}")
|
||||
private String pushUrl;
|
||||
|
||||
@Value("${febs.billUrl}")
|
||||
private String billUrl;
|
||||
|
||||
@Override
|
||||
public IPage<BillStudentInfoVO> listBillUserPage(BillStudentSelectPageDTO dto) {
|
||||
// 查询学生信息
|
||||
@@ -363,4 +375,79 @@ public class EduBillStudentServiceImpl extends ServiceImpl
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendBillNotice(Long billId, String noticeTitle) {
|
||||
EduBill bill = eduBillService.getById(billId);
|
||||
if (Objects.isNull(bill) || bill.getBillEndDate().isAfter(LocalDateTime.now())) {
|
||||
log.error("当前账单无法进行催缴功能!");
|
||||
}
|
||||
// 查询学生信息
|
||||
ListStudentDTO studentDTO = ListStudentDTO.builder().schoolId(FebsUtil.getDeptId())
|
||||
.isQueryUserDept(false).isQuerySchoolName(false)
|
||||
.build();
|
||||
List<EduStudent> studentList = remoteStudentService.listStudent(studentDTO).getData();
|
||||
|
||||
// 学生分组
|
||||
Map<Long, List<EduStudent>> studentMap = studentList.stream().collect(
|
||||
Collectors.groupingBy(EduStudent::getId));
|
||||
if (CollUtil.isNotEmpty(studentList)) {
|
||||
// 需要推送的家长集合
|
||||
List<EduParent> parentList = new ArrayList<>();
|
||||
// 查询账单人员列表
|
||||
List<BillStudentInfoVO> list = baseMapper.listBillUserPage(null,
|
||||
BillStudentSelectPageDTO.builder()
|
||||
.billId(billId)
|
||||
.build(),
|
||||
studentList);
|
||||
list.forEach(billStudentInfoVO -> {
|
||||
// 匹配学生信息
|
||||
EduStudent student = studentMap.get(billStudentInfoVO.getStudentId()).get(0);
|
||||
BigDecimal payOrderPrice = eduBillOrderService.sumPayOrderPrice(billId, student.getId());
|
||||
if (Objects.isNull(payOrderPrice) && CollUtil.isNotEmpty(student.getParents())) {
|
||||
// 添加需要推送的家长信息
|
||||
parentList.addAll(student.getParents());
|
||||
}
|
||||
});
|
||||
|
||||
// 推送消息
|
||||
List<String> appUserIds = parentList.stream().map(EduParent::getYidaAppUserId)
|
||||
.filter(StringUtils::isNotBlank).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(appUserIds)) {
|
||||
EduYidaApp yidaApp = new EduYidaApp();
|
||||
yidaApp.setAppUrl(pushUrl);
|
||||
// 创建发送对象
|
||||
AppNotice notice = new AppNotice();
|
||||
// 消息主体
|
||||
PushMessage message = new PushMessage();
|
||||
message.setTitle(noticeTitle);
|
||||
message.setContent(String.format("您有一条待缴费信息:%s,截止日期:%s,点击查询详情。", bill.getBillTitle(),
|
||||
LocalDateTimeUtil.format(bill.getBillEndDate(), "yyyy年MM月dd日HH时mm分秒")));
|
||||
message.setUrl(billUrl);
|
||||
message.setMsgType(PushMessage.NORMAL);
|
||||
message.setMsgSubType(PushMessage.H5_SUB_MSG_TYPE);
|
||||
notice.setPushMessage(message);
|
||||
notice.setUserIdList(appUserIds);
|
||||
AppUtil.sendPushMsg(notice, yidaApp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
EduYidaApp yidaApp = new EduYidaApp();
|
||||
yidaApp.setAppUrl("https://push.pzhdqrmtzx.com");
|
||||
// 创建发送对象
|
||||
AppNotice notice = new AppNotice();
|
||||
// 消息主体
|
||||
PushMessage message = new PushMessage();
|
||||
message.setTitle("测试");
|
||||
message.setContent(String.format("您有一条待缴费信息:%s,截止日期:%s,点击查询详情。", "sdad",
|
||||
LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy年MM月dd日HH时mm分秒")));
|
||||
message.setUrl("https://jyjf.pzhdqrmtzx.com/view/billApp/#/index?deptId=10548&loginType=2");
|
||||
message.setMsgType(PushMessage.NORMAL);
|
||||
message.setMsgSubType(PushMessage.H5_SUB_MSG_TYPE);
|
||||
notice.setPushMessage(message);
|
||||
notice.setUserIdList(CollUtil.toList("f15f25a55fad4b61a527c67abbf1dcd1"));
|
||||
AppUtil.sendPushMsg(notice, yidaApp);
|
||||
}
|
||||
}
|
||||
|
||||
+39
-13
@@ -7,6 +7,7 @@ import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
@@ -20,6 +21,7 @@ import com.yida.data.common.core.common.ResultMsgType;
|
||||
import com.yida.data.common.core.entity.CurrentUser;
|
||||
import com.yida.data.common.core.entity.apply.EduApplyProductOrder;
|
||||
import com.yida.data.common.core.entity.constant.CachePrefixConstant;
|
||||
import com.yida.data.common.core.entity.constant.LockPrefixConstant;
|
||||
import com.yida.data.common.core.entity.constant.StringConstant;
|
||||
import com.yida.data.common.core.entity.constant.UnionPayConstant;
|
||||
import com.yida.data.common.core.entity.mall.*;
|
||||
@@ -80,12 +82,12 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
|
||||
private final EduBillService eduBillService;
|
||||
private final EduBillItemService eduBillItemService;
|
||||
private final EduBillItemSubService eduBillItemSubService;
|
||||
private final EduBillOrderService eduBillOrderService;
|
||||
private final EduBillItemSubService eduBillItemSubService;
|
||||
private final EduBillOrderItemService eduBillOrderItemService;
|
||||
private final EduBillOrderRefundService eduBillOrderRefundService;
|
||||
private final EduBillOrderItemSubService eduBillOrderItemSubService;
|
||||
private final EduBillOrderStudentService eduBillOrderStudentService;
|
||||
private final EduBillOrderRefundService eduBillOrderRefundService;
|
||||
|
||||
private final EduBillMapper eduBillMapper;
|
||||
private final EduBillOrderMapper eduBillOrderMapper;
|
||||
@@ -183,16 +185,26 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
public BillPayInfoVO createBillOrder(CreateBillOrderDTO createBillOrderDTO) {
|
||||
|
||||
CurrentUser currentUser = FebsUtil.getCurrentUser();
|
||||
// 判断学生账单订单锁
|
||||
String lockKey = LockPrefixConstant.STUDENT_BILL_ORDER_LOCK + createBillOrderDTO.getStudentId() + StringConstant.DOT + createBillOrderDTO.getBillId();
|
||||
Asserts.isFalse(redisService.hasKey(lockKey), "该学生正在缴费中,请稍后再试!");
|
||||
// 加锁
|
||||
redisService.lock(lockKey);
|
||||
|
||||
// 判断是否有下单缓存信息
|
||||
BillOrderStudentCacheVO existBillOrderStudent = (BillOrderStudentCacheVO) redisService.get(
|
||||
CachePrefixConstant.BILL_ORDER_STUDENT + createBillOrderDTO.getStudentId().toString()
|
||||
+ StringConstant.DOT + createBillOrderDTO.getBillId().toString());
|
||||
if (Objects.nonNull(existBillOrderStudent)) {
|
||||
// 解锁
|
||||
redisService.unlock(lockKey);
|
||||
throw new FebsException(String.format("%s%s正在支付中, 请耐心等待",
|
||||
existBillOrderStudent.getStudentName(), existBillOrderStudent.getParentType()));
|
||||
}
|
||||
if (StringUtils.isEmpty(createBillOrderDTO.getPayWay()) ||
|
||||
PayWay.ALIPAY.getValue().equals(createBillOrderDTO.getPayWay())) {
|
||||
// 解锁
|
||||
redisService.unlock(lockKey);
|
||||
throw new FebsException(ResultMsgType.PAY_TYPE_ERROR.getValue());
|
||||
}
|
||||
// 查询账单信息
|
||||
@@ -200,11 +212,15 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
if (Objects.isNull(bill)
|
||||
|| BillStatusEnum.DISABLE_STATUS.getStatus().equals(bill.getEnableStatus())
|
||||
|| bill.getBillEndDate().isBefore(LocalDateTime.now())) {
|
||||
// 解锁
|
||||
redisService.unlock(lockKey);
|
||||
throw new FebsException("当前账单暂时无法缴费");
|
||||
}
|
||||
// 查询学生信息
|
||||
EduStudent student = remoteStudentService.getStudentNoPermission(createBillOrderDTO.getStudentId()).getData();
|
||||
if (Objects.isNull(student)) {
|
||||
// 解锁
|
||||
redisService.unlock(lockKey);
|
||||
throw new FebsException("学生信息错误");
|
||||
}
|
||||
// 家长信息
|
||||
@@ -212,6 +228,8 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
EduParent orderParent = parents.stream().filter(
|
||||
x -> currentUser.getMobile().equals(x.getMobile())).collect(Collectors.toList()).get(0);
|
||||
if (Objects.isNull(orderParent)) {
|
||||
// 解锁
|
||||
redisService.unlock(lockKey);
|
||||
throw new FebsException("家长信息错误");
|
||||
}
|
||||
|
||||
@@ -219,7 +237,7 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
try {
|
||||
// 订单号 需要根据支付方式生成不同的订单号
|
||||
String orderNo = "";
|
||||
if (PayWay.WEI_XIN.getValue().equals(createBillOrderDTO.getPayWay())) {
|
||||
if (PayWay.WEIXIN.getValue().equals(createBillOrderDTO.getPayWay())) {
|
||||
// 微信
|
||||
orderNo = String.valueOf(ORDER_CODE_GENERATOR.nextId());
|
||||
} else if (PayWay.UNION.getValue().equals(createBillOrderDTO.getPayWay())) {
|
||||
@@ -258,6 +276,9 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
redisService.del(CachePrefixConstant.BILL_ORDER_FLAG + orderCode);
|
||||
}
|
||||
throw new FebsException(e.getMessage());
|
||||
} finally {
|
||||
// 解锁
|
||||
redisService.unlock(lockKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,6 +311,11 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
for (CreateBillOrderDTO.CreateBillOrderItemDTO itemDTO : createBillOrderDTO.getItemList()) {
|
||||
// 根据项目id查询具体信息
|
||||
EduBillItem billItem = eduBillItemService.getById(itemDTO.getItemId());
|
||||
// TODO: 2023/9/19 判断当前费项是否缴费(排除多项选择多项,此处直接查询主费项)
|
||||
int itemPayCount = eduBillOrderItemService.countItemPayInfo(bill.getId(), student.getId(), itemDTO.getItemId());
|
||||
if (itemPayCount > 0) {
|
||||
throw new FebsException(String.format("【%s】已支付,请刷新页面后重新操作", billItem.getItemName()));
|
||||
}
|
||||
String itemFamilyType = billItem.getFamilyType();
|
||||
// 判断当前学生能否减免
|
||||
boolean reductionFlag = false;
|
||||
@@ -495,7 +521,7 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
// 下单返回信息
|
||||
String result = "";
|
||||
try {
|
||||
if (PayWay.WEI_XIN.getValue().equals(eduBillOrder.getPayWay())) {
|
||||
if (PayWay.WEIXIN.getValue().equals(eduBillOrder.getPayWay())) {
|
||||
// 微信支付
|
||||
EduPayWxConfig config = commonService.getPayWxConfigBySchool(student.getSchoolId());
|
||||
EduApplyProductOrder order = new EduApplyProductOrder();
|
||||
@@ -553,7 +579,7 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
public BillPayInfoVO getPayInfo(String orderCode, String billOrderFlag, Long deptId,
|
||||
boolean needToPay, String payWay, Integer payType) {
|
||||
BillPayInfoVO billPayInfoVO = null;
|
||||
if (PayWay.WEI_XIN.getValue().equals(payWay)) {
|
||||
if (PayWay.WEIXIN.getValue().equals(payWay)) {
|
||||
// 微信
|
||||
billPayInfoVO = getWxJsSign(orderCode, billOrderFlag, deptId, needToPay, payType);
|
||||
} else if (PayWay.UNION.getValue().equals(payWay)) {
|
||||
@@ -587,7 +613,7 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
BillPayInfoVO infoVO = new BillPayInfoVO();
|
||||
infoVO.setOrderCode(orderCode);
|
||||
infoVO.setNeedToPay(needToPay);
|
||||
infoVO.setPayWay(PayWay.WEI_XIN.getValue());
|
||||
infoVO.setPayWay(PayWay.WEIXIN.getValue());
|
||||
infoVO.setPayType(wxPayType);
|
||||
|
||||
// js api类型
|
||||
@@ -621,7 +647,7 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
|
||||
if (Objects.nonNull(order)
|
||||
&& (OrderStatusEnum.NOT_PAY.getStatus().equals(order.getOrderStatus()) || OrderStatusEnum.USER_PAYING.getStatus().equals(order.getOrderStatus()))) {
|
||||
if (PayWay.WEI_XIN.getValue().equals(order.getPayWay())) {
|
||||
if (PayWay.WEIXIN.getValue().equals(order.getPayWay())) {
|
||||
// 微信
|
||||
wxBillOrderSuccess(order);
|
||||
} else if (PayWay.UNION.getValue().equals(order.getPayWay())) {
|
||||
@@ -675,7 +701,7 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
if (flag) {
|
||||
break;
|
||||
}
|
||||
Thread.sleep(1000L);
|
||||
ThreadUtil.sleep(1000L);
|
||||
} catch (Exception e) {
|
||||
log.error("账单订单(微信支付方式)完成失败, orderNo: {}", orderCode, e);
|
||||
}
|
||||
@@ -734,9 +760,9 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
if (flag) {
|
||||
break;
|
||||
}
|
||||
Thread.sleep(1000L);
|
||||
ThreadUtil.sleep(1000L);
|
||||
} catch (Exception e) {
|
||||
log.error("账单订单(云闪付支付方式)完成失败, orderNo: {}", orderCode, e);
|
||||
log.error("账单订单(微信支付方式)完成失败, orderNo: {}", orderCode, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -814,7 +840,7 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
eduBillOrderService.updateById(order);
|
||||
try {
|
||||
// 判断支付方式
|
||||
if (PayWay.WEI_XIN.getValue().equals(order.getPayWay())) {
|
||||
if (PayWay.WEIXIN.getValue().equals(order.getPayWay())) {
|
||||
// 关闭微信订单
|
||||
WxPayUtil.closeOrder(commonService.getPayWxConfigBySchool(order.getDeptId()), order.getOrderCode());
|
||||
} else if (PayWay.UNION.getValue().equals(order.getPayWay())
|
||||
@@ -851,7 +877,7 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
eduBillOrderRefund.setOrderCode(orderCode);
|
||||
// 生成退款订单号
|
||||
String refundOrderCode = "";
|
||||
if (PayWay.WEI_XIN.getValue().equals(order.getPayWay())) {
|
||||
if (PayWay.WEIXIN.getValue().equals(order.getPayWay())) {
|
||||
// 微信
|
||||
refundOrderCode = "R" + orderCode;
|
||||
} else if (PayWay.UNION.getValue().equals(order.getPayWay())) {
|
||||
@@ -873,7 +899,7 @@ public class H5EduBillServiceImpl implements H5EduBillService {
|
||||
PayWay.class.getMethod("getValue"));
|
||||
switch (Objects.requireNonNull(payWay)) {
|
||||
// 微信
|
||||
case WEI_XIN:
|
||||
case WEIXIN:
|
||||
// 查询学校微信支付配置
|
||||
EduPayWxConfig config = commonService.getPayWxConfigBySchool(order.getDeptId());
|
||||
WxPayUtil.refund(config, eduBillOrderRefund.getOrderCode(),
|
||||
|
||||
+15
-1
@@ -125,5 +125,19 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 查询学生是否有对应账单项目的缴费信息 -->
|
||||
<select id="countItemPayInfo" resultType="int">
|
||||
SELECT
|
||||
count(DISTINCT o.order_id)
|
||||
FROM
|
||||
edu_bill_order_item i
|
||||
LEFT JOIN edu_bill_order o ON i.order_id = o.order_id
|
||||
WHERE
|
||||
o.pay_status = '1'
|
||||
AND o.bill_id = #{billId}
|
||||
AND o.student_id = #{studentId}
|
||||
AND i.item_id = #{itemId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
AND s.del_flag = 0
|
||||
AND o.pay_status = '1'
|
||||
AND o.bill_id = #{billId}
|
||||
AND s.student_id IN
|
||||
<foreach collection="studentIds" open="(" close=")" item="item" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- 前端查询账单订单列表数据 -->
|
||||
|
||||
Reference in New Issue
Block a user