浏览代码

Merge remote-tracking branch 'origin/master' into yonge

Joburgess 5 年之前
父节点
当前提交
52b74e9fe4

+ 12 - 21
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -156,6 +156,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             notifyMap.put("channelType", channelType);
             notifyMap.put("orderNo", "");
             studentPaymentOrderService.updateOrder(notifyMap);
+            notifyMap.put("orderNo", orderNo);
             return notifyMap;
         }
 
@@ -218,12 +219,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 "联系人:" + studentRepair.getEmployeePhone() + "(" + studentRepair.getEmployeePhone() + ")\n\r" +
                 "地址:" + studentRepair.getEmployeeAddress() ;
 
-        if(studentRepair.getSendType().equals(0)) {
-            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_REPAIR_UNSEND_COMPLETED, map, null, 0, "1", "STUDENT",
-                    student.getUsername(), studentRepair.getEmployeeName(), studentRepair.getEmployeePhone(), studentRepair.getEmployeeAddress());
-        }else {
-            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_REPAIR_SEND_COMPLETED, map, null, 0, "1", "STUDENT",
-                    student.getUsername());
+        if(studentRepair.getSendType().equals(1)) {
             imContent = student.getUsername() + "学员您好,您的乐器已保养维修完毕,快递已寄出,请注意查收。";
         }
         sysMessageService.sendPrivateMessage(student.getId().toString(), imContent);
@@ -256,6 +252,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentDao.lockUser(studentRepair.getStudentId());
         BigDecimal amount = studentRepair.getAmount();
         String orderNo = idGeneratorService.generatorId("payment") + "";
+        studentRepair.setIsUseBalancePayment(repairInfo.getIsUseBalancePayment());
         studentRepair.setTransNo(orderNo);
         studentRepair.setRepairStatus(0);
         studentRepair.setPayStatus(1);
@@ -285,8 +282,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentPaymentOrderService.insert(studentPaymentOrder);
         studentPaymentOrder.setVersion(0);
 
-        if (repairInfo.getIsUseBalancePayment() && amount.compareTo(BigDecimal.ZERO) > 0) {
-            SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(repairInfo.getStudentId());
+        if (studentRepair.getIsUseBalancePayment() && amount.compareTo(BigDecimal.ZERO) > 0) {
+            SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(studentRepair.getStudentId());
             if (userCashAccount == null) {
                 throw new BizException("用户账户找不到");
             }
@@ -295,7 +292,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
                 amount = amount.subtract(balance);
                 studentPaymentOrder.setActualAmount(amount);
                 studentPaymentOrder.setBalancePaymentAmount(balance);
-                sysUserCashAccountService.updateBalance(repairInfo.getStudentId(), balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐器维修");
+                sysUserCashAccountService.updateBalance(studentRepair.getStudentId(), balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "乐器维修");
             }
         }
         studentPaymentOrderService.update(studentPaymentOrder);
@@ -308,6 +305,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             notifyMap.put("channelType", channelType);
             notifyMap.put("orderNo", "");
             studentPaymentOrderService.updateOrder(notifyMap);
+            notifyMap.put("orderNo", orderNo);
             return notifyMap;
         }
 
@@ -354,9 +352,9 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     @Override
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     public Boolean orderCallback(StudentPaymentOrder studentPaymentOrder) {
-        Date noDate = new Date();
+        Date nowDate = new Date();
         //更新订单信息
-        studentPaymentOrder.setUpdateTime(noDate);
+        studentPaymentOrder.setUpdateTime(nowDate);
         int updateCount = studentPaymentOrderService.update(studentPaymentOrder);
         if (updateCount <= 0) {
             throw new BizException("订单更新失败");
@@ -372,14 +370,13 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
         if (studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS) {
             repairInfo.setPayStatus(2);
-            repairInfo.setUpdateTime(noDate);
+            repairInfo.setUpdateTime(nowDate);
             if (this.update(repairInfo) <= 0) {
                 throw new BizException("维修单更新失败");
             }
 
             //插入交易明细
             BigDecimal amount = studentPaymentOrder.getActualAmount();
-            Date nowDate = new Date();
             SysUserCashAccount cashAccount = sysUserCashAccountService.get(userId);
             //充值
             SysUserCashAccountDetail rechargeDetail = new SysUserCashAccountDetail();
@@ -417,16 +414,10 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
             String imContent = sysUser.getUsername() + "学员您好,您的乐器维修已受理,我们会尽快完成保养维修";
 
-            if(repairInfo.getType().equals(0)) {
-                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_REPAIR_OFFLINE_PAYMENT_SUCCESS, map, null, 0, "1", "STUDENT",
-                        sysUser.getUsername());
-            } else {
+            if(repairInfo.getType().equals(1)){
                 imContent = sysUser.getUsername() + "学员您好,请尽快寄送乐器至维修点,我们会尽快完成保养维修\n\r" +
                         "联系人:" + repairInfo.getEmployeePhone() + "(" + repairInfo.getEmployeePhone() + ")\n\r" +
                         "地址:" + repairInfo.getEmployeeAddress() + "";
-
-                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_REPAIR_ONLINE_PAYMENT_SUCCESS, map, null, 0, "1", "STUDENT",
-                        sysUser.getUsername(), repairInfo.getEmployeeName(), repairInfo.getEmployeePhone(), repairInfo.getEmployeeAddress());
             }
             sysMessageService.sendPrivateMessage(sysUser.getId().toString(), imContent);
             return true;
@@ -434,7 +425,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
 
         if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
             repairInfo.setPayStatus(0);
-            repairInfo.setUpdateTime(noDate);
+            repairInfo.setUpdateTime(nowDate);
             if (this.update(repairInfo) <= 0) {
                 throw new BizException("维修单更新失败");
             }

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

@@ -240,10 +240,10 @@
     </select>
 
     <select id="getStudentMusicGroupRepairer" resultMap="com.ym.mec.biz.dal.dao.MusicGroupDao.BasicUserDto">
-        SELECT su.real_name_ username_, su.id_ user_id_, su.avatar_ head_url_
+        SELECT repairer.real_name_ username_, repairer.id_ user_id_, repairer.avatar_ head_url_
         FROM music_group mg
                  LEFT JOIN student_registration sr on sr.music_group_id_ = mg.id_
-                 LEFT JOIN sys_user su ON su.id_ = sr.user_id_
+                 LEFT JOIN sys_user repairer ON repairer.id_ = mg.repair_user_id_
         WHERE sr.user_id_ = #{studentId}
           AND mg.status_ = 'PROGRESS'
           AND mg.repair_user_id_ IS NOT NULL

+ 1 - 0
mec-web/src/main/java/com/ym/mec/web/controller/StudentRepairController.java

@@ -63,6 +63,7 @@ public class StudentRepairController extends BaseController {
         if(endTime != null){
             queryInfo.setEndTime(DateUtil.addDays(endTime, 1));
         }
+        queryInfo.setPayStatus(2);
         return succeed(studentRepairService.queryPage(queryInfo));
     }