浏览代码

Merge branch 'online1' into edu_financial

river 4 年之前
父节点
当前提交
d586b817a7

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -588,8 +588,16 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
 
     /**
      * 获取报名缴费的相关人数
+     *
      * @param musicGroupIds
      * @return
      */
     List<MusicGroupRegAndMoneyDto> getRegisters(@Param("musicGroupIds") List<String> musicGroupIds);
+
+    /**
+     * 获取已缴费审核中的人数
+     * @param musicGroupId
+     * @return
+     */
+    int countPayAndCheckNum(@Param("musicGroupId") String musicGroupId);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentPaymentOrderExportDto.java

@@ -90,6 +90,8 @@ public class StudentPaymentOrderExportDto extends StudentPaymentOrder {
 
     private String feeFlag;
 
+    private Integer payingStatus;
+
     public BigDecimal getSporadicAmount() {
         return sporadicAmount;
     }
@@ -369,4 +371,12 @@ public class StudentPaymentOrderExportDto extends StudentPaymentOrder {
     public void setRechargeFee(BigDecimal rechargeFee) {
         this.rechargeFee = rechargeFee;
     }
+
+    public Integer getPayingStatus() {
+        return payingStatus;
+    }
+
+    public void setPayingStatus(Integer payingStatus) {
+        this.payingStatus = payingStatus;
+    }
 }

+ 18 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -8,6 +8,7 @@ import com.ym.mec.biz.dal.page.RegistrationOrPreQueryInfo;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.BaseService;
+import org.apache.ibatis.annotations.Param;
 
 import java.io.IOException;
 import java.math.BigDecimal;
@@ -413,4 +414,21 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
      */
     Boolean setNoneCloudTeacher(Long id);
 
+    /**
+     * 已付费解除审核增加缴费人数和0元缴费人数
+     * @param id
+     * @return
+     */
+    Boolean addPaidNum(Long id);
+
+
+    /**
+     * 获取学生乐团的注册信息
+     * @param musicGroupId
+     * @param studentId
+     * @return
+     */
+    StudentRegistration getStudentRegister(String musicGroupId, Integer studentId);
+
+
 }

+ 26 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -709,6 +709,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         StudentPaymentOrder studentPaymentOrder = studentRegistrationService.addOrder(studentRegistration, amount, orderNo, channelType, courseFee, goodsGroups, remitFee, courseRemitFee, newCourses, registerPayDto.getBuyMaintenance(), registerPayDto.getBuyCloudTeacher(), registerPayDto.getBuyCloudTeacherPlus());
         studentPaymentOrder = studentPaymentOrderService.get(studentPaymentOrder.getId());
+        boolean canPay = studentPaymentOrder.getClassGroupId() != null && studentPaymentOrder.getClassGroupId().equals(206);
 
         Date date = new Date();
         BigDecimal balance = BigDecimal.ZERO;
@@ -734,7 +735,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         studentPaymentOrder.setUpdateTime(date);
 
         if ("205".equals(studentPaymentOrder.getPaymentAccountNo())) {
-            studentPaymentOrder.setPaymentChannel("ADAPAY");
+            if(!canPay) {
+                studentPaymentOrder.setPaymentChannel("ADAPAY");
+            }
             studentRegistration.setPayingStatus(2);
         }
         studentPaymentOrderService.update(studentPaymentOrder);
@@ -751,10 +754,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.NO_BUY_CLOUD_TEACHER_MSG,
                     userPhoneMap, null, 0, null, null, musicGroup.getName(), studentRegistration.getName());
 
-            Map<String, String> notifyMap = new HashMap<>();
-            notifyMap.put("hasPaidZero", "205");
-            notifyMap.put("orderNo", studentPaymentOrder.getOrderNo());
-            return notifyMap;
+            if(!canPay){
+                Map<String, String> notifyMap = new HashMap<>();
+                notifyMap.put("hasPaidZero", "205");
+                notifyMap.put("orderNo", studentPaymentOrder.getOrderNo());
+                return notifyMap;
+            }
         }
 
         if (amount.compareTo(BigDecimal.ZERO) == 0) {
@@ -898,6 +903,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
 
         StudentPaymentOrder studentPaymentOrder = studentRegistrationService.addOrder(studentRegistration, amount, orderNo, channelType, courseFee, goodsGroups, remitFee, courseRemitFee, newCourses, registerPayDto.getBuyMaintenance(), registerPayDto.getBuyCloudTeacher(), registerPayDto.getBuyCloudTeacherPlus());
         studentPaymentOrder = studentPaymentOrderService.get(studentPaymentOrder.getId());
+        boolean canPay = studentPaymentOrder.getClassGroupId() != null && studentPaymentOrder.getClassGroupId().equals(206);
         Date date = new Date();
 
         BigDecimal balance = BigDecimal.ZERO;
@@ -923,7 +929,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         studentPaymentOrder.setUpdateTime(date);
 
         if ("205".equals(studentPaymentOrder.getPaymentAccountNo())) {
-            studentPaymentOrder.setPaymentChannel("ADAPAY");
+            if(!canPay) {
+                studentPaymentOrder.setPaymentChannel("ADAPAY");
+            }
             studentRegistration.setPayingStatus(2);
         }
         studentPaymentOrderService.update(studentPaymentOrder);
@@ -939,11 +947,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.NO_BUY_CLOUD_TEACHER_MSG,
                     userPhoneMap, null, 0, null, null, musicGroup.getName(), studentRegistration.getName());
 
-
-            Map<String, String> notifyMap = new HashMap<>();
-            notifyMap.put("hasPaidZero", "205");
-            notifyMap.put("orderNo", studentPaymentOrder.getOrderNo());
-            return notifyMap;
+            if(!canPay) {
+                Map<String, String> notifyMap = new HashMap<>();
+                notifyMap.put("hasPaidZero", "205");
+                notifyMap.put("orderNo", studentPaymentOrder.getOrderNo());
+                return notifyMap;
+            }
         }
 
         if (amount.compareTo(BigDecimal.ZERO) == 0) {
@@ -2897,6 +2906,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         } else {
             throw new BizException("当前乐团状态不支持此操作");
         }
+        //有已付费,在储备中的人,不容许到储备中
+        int payAndCheckNum = studentRegistrationDao.countPayAndCheckNum(musicGroupId);
+        if(payAndCheckNum > 0){
+            throw new BizException("有已付费,审核中的学生,请处理后再开团");
+        }
+
         //新建团:(乐团合作单位没有进行中 、暂停、关闭 的乐团)
         //若乐团新建团,则操作【确认开团】时,若【已缴费】学员达到98人,则无需对【未缴费】学员新增回访
         //若乐团不是新建团,则操作【确认开团】时,若【已缴费】学员达到58人,则无需对【未缴费】学员新增回访

+ 6 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -12,7 +12,7 @@ import java.util.Map;
 import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.dao.*;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.service.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,9 +25,6 @@ import com.ym.mec.biz.dal.dto.PageInfoOrder;
 import com.ym.mec.biz.dal.dto.SporadicChargeInfoDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderDto;
 import com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentRouteOrder;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
@@ -527,7 +524,12 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
     @Override
     public List<StudentPaymentOrderExportDto> getUserApplyOrders(Integer studentId, String musicGroupId) {
         List<StudentPaymentOrderExportDto> orders = studentPaymentOrderDao.getUserApplyOrders(studentId, musicGroupId);
+        StudentRegistration studentRegister = studentRegistrationService.getStudentRegister(musicGroupId, studentId);
         for (StudentPaymentOrderExportDto order : orders) {
+            if((DealStatusEnum.ING.equals(order.getStatus())||DealStatusEnum.SUCCESS.equals(order.getStatus())) &&
+                studentRegister.getPayingStatus().equals(2)){
+                order.setPayingStatus(2);
+            }
             if (order.getOrderDetailList() == null) continue;
             for (StudentPaymentOrderDetail studentPaymentOrderDetail : order.getOrderDetailList()) {
                 if (studentPaymentOrderDetail.getGoodsList() == null) continue;

+ 48 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -527,6 +527,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             studentPaymentOrder.setVersion(0);
             String code = studentRegistration.getNoneNeedCloudTeacher().equals(1) ? "200" : "205";
             studentPaymentOrder.setPaymentAccountNo(code);
+            if (code.equals("205") && !"".equals(maintenanceGoodsId)) {
+                studentPaymentOrder.setClassGroupId(206);
+            }
             studentPaymentOrderService.update(studentPaymentOrder);
         }
         return studentPaymentOrder;
@@ -1087,7 +1090,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             }
             studentRegistration.setPaymentStatus(YES);
             studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
-            studentRegistration.setPayingStatus(0);
+
+            if (studentPaymentOrder.getClassGroupId() == null || !studentPaymentOrder.getClassGroupId().equals(206)) {
+                studentRegistration.setPayingStatus(0);
+            }
 
             List<StudentPaymentOrderDetail> orderDetails = studentPaymentOrderDetailService.getOrderDetail(studentPaymentOrder.getId());
 
@@ -1838,21 +1844,21 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         int registerNum = studentRegistrationDao.getRegisterNum(queryInfo.getMusicGroupId());
         pageInfo.setRegNum(registerNum);
         RegisterDto registerOrPreMinTime = studentRegistrationDao.getRegisterOrPreMinTime(queryInfo.getMusicGroupId());
-        if(registerOrPreMinTime != null && registerOrPreMinTime.getMinPayTime() != null){
+        if (registerOrPreMinTime != null && registerOrPreMinTime.getMinPayTime() != null) {
             Date startTime = DateUtil.trunc(registerOrPreMinTime.getMinPayTime());
             Date endTime = DateUtil.getLastTimeWithDay(startTime);
             int firstPayNum = studentRegistrationDao.getFirstPayNum(queryInfo.getMusicGroupId(), startTime, endTime);
-            int totalPayNum = studentRegistrationDao.getFirstPayNum(queryInfo.getMusicGroupId(), startTime,null);
+            int totalPayNum = studentRegistrationDao.getFirstPayNum(queryInfo.getMusicGroupId(), startTime, null);
             pageInfo.setFirstDayPayNum(firstPayNum);
             pageInfo.setPayNum(totalPayNum);
-            pageInfo.setPayScale(new BigDecimal(firstPayNum).multiply(new BigDecimal(100)).divide(new BigDecimal(totalPayNum),2,BigDecimal.ROUND_HALF_UP));
+            pageInfo.setPayScale(new BigDecimal(firstPayNum).multiply(new BigDecimal(100)).divide(new BigDecimal(totalPayNum), 2, BigDecimal.ROUND_HALF_UP));
         }
 
         pageInfo.setTotal(count);
         params.put("offset", pageInfo.getOffset());
         if (queryInfo.getPage() <= pageInfo.getTotalPage()) {
-            Date firstPreTime = registerOrPreMinTime != null ?registerOrPreMinTime.getMinPerRegisterTime():null;
-            Date firstPayTime = registerOrPreMinTime != null ?registerOrPreMinTime.getMinPayTime():null;
+            Date firstPreTime = registerOrPreMinTime != null ? registerOrPreMinTime.getMinPerRegisterTime() : null;
+            Date firstPayTime = registerOrPreMinTime != null ? registerOrPreMinTime.getMinPayTime() : null;
             dataList = studentRegistrationDao.getRegisterOrPreList(params);
             for (RegisterDto registerDto : dataList) {
                 if (DateUtil.dateToString(registerDto.getPerRegisterTime()).equals("2099-12-31") ||
@@ -1887,7 +1893,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public Boolean setNoneCloudTeacher(Long id) {
         StudentRegistration studentRegistration = studentRegistrationDao.get(id);
         if (!studentRegistration.getPayingStatus().equals(2)) {
-            throw new BizException("该学生不在预约中");
+            throw new BizException("该学生不在审核中");
         }
         if (studentRegistration.getNoneNeedCloudTeacher().equals(1)) {
             throw new BizException("该学生已设置");
@@ -1898,4 +1904,39 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         }
         return true;
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean addPaidNum(Long id) {
+        StudentRegistration studentRegistration = studentRegistrationDao.get(id);
+        if (!studentRegistration.getPayingStatus().equals(2)) {
+            throw new BizException("该学生不在审核");
+        }
+        if (!studentRegistration.getPaymentStatus().equals(YES)) {
+            throw new BizException("该学生状态已更新,请刷新查看");
+        }
+        studentRegistration.setPayingStatus(0);
+        studentRegistrationDao.update(studentRegistration);
+        StudentPaymentOrder order = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
+        order.setPaymentAccountNo("200");
+        if(studentPaymentOrderService.update(order)<=0){
+            throw new BizException("订单处理失败,请重试");
+        }
+
+        MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getActualSubjectId());
+        int paidNum = musicOneSubjectClassPlan.getPaidStudentNum() == null ? 0 : musicOneSubjectClassPlan.getPaidStudentNum();
+        int paidZeroNum = musicOneSubjectClassPlan.getPaidZeroNum() == null ? 0 : musicOneSubjectClassPlan.getPaidZeroNum();
+        musicOneSubjectClassPlan.setPaidZeroNum(paidZeroNum + 1);
+        musicOneSubjectClassPlan.setPaidStudentNum(paidNum + 1);
+        int count = musicGroupSubjectPlanService.update(musicOneSubjectClassPlan);
+        if (count <= 0) {
+            throw new BizException("缴费人数更新失败,请重试");
+        }
+        return true;
+    }
+
+    @Override
+    public StudentRegistration getStudentRegister(String musicGroupId, Integer studentId) {
+        return studentRegistrationDao.getStudentRegister(musicGroupId,studentId);
+    }
 }

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

@@ -1499,4 +1499,13 @@
         AND music_group_status_ != 'QUIT'
         GROUP BY music_group_id_
     </select>
+
+    <select id="countPayAndCheckNum" resultType="int">
+        SELECT COUNT(*)
+        FROM student_registration
+        WHERE music_group_id_ = #{musicGroupId}
+          AND payment_status_ =2
+          AND paying_status_ = 2
+          AND music_group_status_ = 'NORMAL'
+    </select>
 </mapper>

+ 9 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -91,6 +91,8 @@ public class StudentOrderController extends BaseController {
     private ReplacementInstrumentActivityDao replacementInstrumentActivityDao;
     @Autowired
     private ChildrenDayDegreeDetailDao childrenDayDegreeDetailDao;
+    @Autowired
+    private StudentRegistrationDao studentRegistrationDao;
 
 
     @Value("${spring.profiles.active:dev}")
@@ -140,6 +142,13 @@ public class StudentOrderController extends BaseController {
         HashMap<String, Object> orderDetail = new HashMap<>();
         orderDetail.put("order", orderByOrderNo);
         orderDetail.put("groupType", orderByOrderNo.getGroupType());
+        if(OrderTypeEnum.APPLY.equals(orderByOrderNo.getType())){
+            StudentRegistration studentRegistration = studentRegistrationDao.getStudentRegister(orderByOrderNo.getMusicGroupId(),orderByOrderNo.getUserId());
+            if(studentRegistration.getPayingStatus().equals(2)) {
+                orderDetail.put("payingStatus",studentRegistration.getPayingStatus());
+            }
+        }
+
         if (orderByOrderNo.getGroupType().equals(GroupType.MUSIC)) {
             MusicGroup musicGroup = musicGroupService.get(orderByOrderNo.getMusicGroupId());
             List<Goods> goodsList = studentPaymentOrderDetailService.findApplyOrderGoods(orderByOrderNo.getId());

+ 10 - 3
mec-web/src/main/java/com/ym/mec/web/controller/StudentRegistrationController.java

@@ -6,6 +6,7 @@ import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.CourseViewTypeEnum;
+import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 import com.ym.mec.biz.dal.page.*;
 import com.ym.mec.biz.service.EmployeeService;
 
@@ -396,8 +397,8 @@ public class StudentRegistrationController extends BaseController {
         OutputStream outputStream = response.getOutputStream();
         HSSFWorkbook workbook = null;
         try {
-            String[] header = {"学员编号", "学员姓名", "声部", "预报名时间", "预报名时间差","预报名排名", "缴费时间", "缴费时间差","缴费排名"};
-            String[] body = {"userId", "studentName", "actualSubjectName", "perRegisterTime", "perRegIntervalStr","perRegSort", "payTime", "payIntervalStr","paySort"};
+            String[] header = {"学员编号", "学员姓名", "声部", "预报名时间", "预报名时间差", "预报名排名", "缴费时间", "缴费时间差", "缴费排名"};
+            String[] body = {"userId", "studentName", "actualSubjectName", "perRegisterTime", "perRegIntervalStr", "perRegSort", "payTime", "payIntervalStr", "paySort"};
             workbook = POIUtil.exportExcel(header, body, registerOrPreList.getRows());
             response.setContentType("application/octet-stream");
             response.setHeader("Content-Disposition", "attachment;filename=registerOrPer-" + DateUtil.getDate(new Date()) + ".xls");
@@ -425,6 +426,12 @@ public class StudentRegistrationController extends BaseController {
     @GetMapping("/setNoneCloudTeacher")
     @PreAuthorize("@pcs.hasPermissions('studentRegistration/setNoneCloudTeacher')")
     public HttpResponseResult<Boolean> setNoneCloudTeacher(Long id) {
-        return succeed(studentRegistrationService.setNoneCloudTeacher(id));
+        StudentRegistration studentRegistration = studentRegistrationService.get(id);
+        //已付费的增加,已缴费人数、和0元付费人数
+        if (studentRegistration.getPaymentStatus().equals(PaymentStatusEnum.YES)) {
+            return succeed(studentRegistrationService.addPaidNum(id));
+        } else {
+            return succeed(studentRegistrationService.setNoneCloudTeacher(id));
+        }
     }
 }