Browse Source

Merge branch 'master' into yonge

yonge 5 years ago
parent
commit
c9d6b9dfd9

+ 4 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java

@@ -144,7 +144,10 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     TEACHER_SALARY_CONFIRM_PUSH("TEACHER_SALARY_CONFIRM_PUSH", "课酬确认"),
 
     SMS_REPAIR_ONLINE_PAYMENT_SUCCESS("SMS_REPAIR_ONLINE_PAYMENT_SUCCESS","乐器线上维修支付成功"),
-    SMS_REPAIR_OFFLINE_PAYMENT_SUCCESS("SMS_REPAIR_OFFLINE_PAYMENT_SUCCESS","乐器线下维修支付成功");
+    SMS_REPAIR_OFFLINE_PAYMENT_SUCCESS("SMS_REPAIR_OFFLINE_PAYMENT_SUCCESS","乐器线下维修支付成功"),
+    SMS_REPAIR_UNSEND_COMPLETED("SMS_REPAIR_UNSEND_COMPLETED","乐器维修完成自取"),
+    SMS_REPAIR_SEND_COMPLETED("SMS_REPAIR_SEND_COMPLETED","乐器维修完成邮寄");
+
 
 
     MessageTypeEnum(String code, String msg) {

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

@@ -3297,7 +3297,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         practiceBuyResult.setStatus(order.getStatus());
         practiceBuyResult.setCreateTime(order.getCreateTime());
         practiceBuyResult.setPrice(order.getExpectAmount());
-        if(order.getStatus().equals(DealStatusEnum.FAILED)){
+        if(order.getStatus().equals(DealStatusEnum.FAILED) || order.getGroupType().equals(GroupType.REPAIR)){
             return practiceBuyResult;
         }
         SysConfig practiceCourseMinutesConfig = sysConfigService.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);

+ 48 - 13
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRepairServiceImpl.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.biz.dal.dao.StudentDao;
 import com.ym.mec.biz.dal.dao.StudentRepairDao;
 import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dto.BasicUserDto;
@@ -49,6 +50,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     private SysUserCashAccountDetailService sysUserCashAccountDetailService;
     @Autowired
     private SysMessageService sysMessageService;
+    @Autowired
+    private StudentDao studentDao;
 
     @Override
     public BaseDAO<Integer, StudentRepair> getDAO() {
@@ -85,7 +88,14 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Map addRepair(StudentRepair repairInfo) throws Exception {
-
+        studentDao.lockUser(repairInfo.getEmployeeId());
+        if (repairInfo.getSendType() != null && repairInfo.getSendType().equals(1) &&
+                (repairInfo.getContactName() == null || repairInfo.getContactName().isEmpty()) &&
+                (repairInfo.getContactMobile() == null || repairInfo.getContactMobile().isEmpty()) &&
+                (repairInfo.getAddress() == null || repairInfo.getAddress().isEmpty())
+        ) {
+            throw new BizException("邮寄信息必填");
+        }
         Date date = new Date();
         BigDecimal amount = repairInfo.getAmount();
         String orderNo = idGeneratorService.generatorId("payment") + "";
@@ -146,7 +156,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             return notifyMap;
         }
 
-        String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.EDU_TEACHER_BASE_URL);
+        String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
 
         Map<String, BigDecimal> classFee = new HashMap<>();
         classFee.put("course", BigDecimal.ZERO);
@@ -157,8 +167,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         Map payMap = payService.getPayMap(
                 amount,
                 orderNo,
-                baseApiUrl + "/api-web/studentOrder/notify",
-                baseApiUrl + "/api-web/studentOrder/paymentResult?orderNo=" + orderNo,
+                baseApiUrl + "/api-student/studentOrder/notify",
+                baseApiUrl + "/api-student/studentOrder/paymentResult?type=edu&orderNo=" + orderNo,
                 "乐器维修",
                 "乐器维修",
                 repairInfo.getStudentId(),
@@ -184,7 +194,8 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         if (sysUser == null) {
             throw new BizException("用户信息获取失败");
         }
-        StudentRepair studentRepair = studentRepairDao.get(id);
+        studentDao.lockUser(sysUser.getId());
+        StudentRepair studentRepair = studentRepairDao.getRepairInfo(id);
         if (studentRepair == null) {
             throw new BizException("维修信息不存在");
         }
@@ -195,6 +206,25 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         studentRepair.setUpdateTime(new Date());
         studentRepair.setDescription(description);
         studentRepairDao.update(studentRepair);
+
+        SysUser student =  sysUserFeignService.queryUserById(studentRepair.getStudentId());
+        Map<Integer, String> map = new HashMap();
+        map.put(student.getId(), student.getId().toString());
+
+        String imContent = student.getUsername() + "您的乐器已保养维修完毕,请安排时间来维修点取回\n\r" +
+                "联系人:" + 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());
+            imContent = student.getUsername() + "学员您好,您的乐器已保养维修完毕,快递已寄出,请注意查收。";
+        }
+        sysMessageService.sendPrivateMessage(student.getId().toString(), imContent);
+
         log.info("操作人 :" + sysUser.getId());
     }
 
@@ -220,6 +250,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         }
         Date date = new Date();
         StudentRepair studentRepair = studentRepairDao.get(repairInfo.getId());
+        studentDao.lockUser(repairInfo.getStudentId());
         BigDecimal amount = studentRepair.getAmount();
         String orderNo = idGeneratorService.generatorId("payment") + "";
         studentRepair.setTransNo(orderNo);
@@ -333,16 +364,13 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
         Integer userId = studentPaymentOrder.getUserId();
         SysUser sysUser = sysUserFeignService.queryUserById(userId);
 
-
         Map<Integer, String> map = new HashMap();
-        map.put(userId, sysUser.getPhone());
-        Map<Integer, String> yimei = new HashMap();
         map.put(userId, userId.toString());
 
         if (studentPaymentOrder.getStatus() == DealStatusEnum.SUCCESS) {
             repairInfo.setPayStatus(2);
             repairInfo.setUpdateTime(noDate);
-            if(this.update(repairInfo) <= 0){
+            if (this.update(repairInfo) <= 0) {
                 throw new BizException("维修单更新失败");
             }
 
@@ -384,20 +412,27 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
             }
             sysUserCashAccountDetailService.insert(paymentDetail);
 
+            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 {
-                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.SMS_REPAIR_OFFLINE_PAYMENT_SUCCESS, map, null, 0, "1", "STUDENT",
-                        sysUser.getUsername(),repairInfo.getContactName(),repairInfo.getContactMobile(),repairInfo.getAddress());
+            } else {
+                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;
         }
 
         if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
             repairInfo.setPayStatus(0);
             repairInfo.setUpdateTime(noDate);
-            if(this.update(repairInfo) <= 0){
+            if (this.update(repairInfo) <= 0) {
                 throw new BizException("维修单更新失败");
             }
             if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {

+ 6 - 8
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -3,6 +3,7 @@ package com.ym.mec.student.controller;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.OrderTypeEnum;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.util.date.DateUtil;
 import freemarker.template.utility.StringUtil;
 import io.swagger.annotations.Api;
@@ -40,12 +41,6 @@ import com.ym.mec.biz.dal.dao.SysConfigDao;
 import com.ym.mec.biz.dal.dao.TeacherCourseStatisticsDao;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GroupType;
-import com.ym.mec.biz.service.MusicGroupService;
-import com.ym.mec.biz.service.SporadicChargeInfoService;
-import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.biz.service.StudentRegistrationService;
-import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.thirdparty.adapay.NotifyEvent;
@@ -295,9 +290,12 @@ public class StudentOrderController extends BaseController {
 
 
     @RequestMapping("paymentResult")
-    public void paymentResult(HttpServletResponse response, String orderNo) {
+    public void paymentResult(HttpServletResponse response, String orderNo,String type) {
         try {
-            String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
+            String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
+            if(type != null && type.equals("edu")){
+                baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.EDU_TEACHER_BASE_URL);
+            }
             response.sendRedirect(baseApiUrl + "/#/paymentresult?orderNo=" + orderNo);
         } catch (IOException e) {
             e.printStackTrace();