|
@@ -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) {
|