|
@@ -191,4 +191,83 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
return studentRepairDao.getRepairInfo(id);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Map updateRepair(StudentRepair repairInfo) throws Exception {
|
|
|
+ Date date = new Date();
|
|
|
+ StudentRepair studentRepair = studentRepairDao.get(repairInfo.getId());
|
|
|
+ BigDecimal amount = repairInfo.getAmount();
|
|
|
+ String orderNo = idGeneratorService.generatorId("payment") + "";
|
|
|
+ repairInfo.setTransNo(orderNo);
|
|
|
+ repairInfo.setRepairStatus(0);
|
|
|
+ repairInfo.setPayStatus(0);
|
|
|
+ repairInfo.setCreateTime(date);
|
|
|
+ repairInfo.setUpdateTime(date);
|
|
|
+ studentRepairDao.insert(repairInfo);
|
|
|
+ if (repairInfo.getType() == 1) {
|
|
|
+ Map<String, Object> repairInfoMap = new HashMap<>();
|
|
|
+ MapUtil.populateMap(repairInfoMap, repairInfo);
|
|
|
+ return repairInfoMap;
|
|
|
+ }
|
|
|
+ repairInfo.setPayStatus(1);
|
|
|
+ String channelType = "";
|
|
|
+
|
|
|
+ StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
|
|
|
+ studentPaymentOrder.setUserId(repairInfo.getStudentId());
|
|
|
+ studentPaymentOrder.setGroupType(GroupType.REPAIR);
|
|
|
+ studentPaymentOrder.setOrderNo(orderNo);
|
|
|
+ studentPaymentOrder.setType(OrderTypeEnum.REPAIR);
|
|
|
+ studentPaymentOrder.setExpectAmount(amount);
|
|
|
+ studentPaymentOrder.setActualAmount(amount);
|
|
|
+ studentPaymentOrder.setStatus(DealStatusEnum.ING);
|
|
|
+ studentPaymentOrder.setMusicGroupId(repairInfo.getId().toString());
|
|
|
+ studentPaymentOrder.setPaymentChannel("BALANCE");
|
|
|
+ studentPaymentOrder.setUpdateTime(date);
|
|
|
+ studentPaymentOrder.setOrganId(repairInfo.getOrganId());
|
|
|
+ studentPaymentOrder.setRoutingOrganId(repairInfo.getOrganId());
|
|
|
+
|
|
|
+ studentPaymentOrderService.insert(studentPaymentOrder);
|
|
|
+ studentPaymentOrder.setVersion(0);
|
|
|
+
|
|
|
+ if (amount.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ Map<String, String> notifyMap = new HashMap<>();
|
|
|
+ notifyMap.put("tradeState", "1");
|
|
|
+ notifyMap.put("merOrderNo", studentPaymentOrder.getOrderNo());
|
|
|
+ notifyMap.put("channelType", channelType);
|
|
|
+ notifyMap.put("orderNo", "");
|
|
|
+ studentPaymentOrderService.updateOrder(notifyMap);
|
|
|
+ return notifyMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ String baseApiUrl = sysConfigDao.findConfigValue(SysConfigService.EDU_TEACHER_BASE_URL);
|
|
|
+
|
|
|
+ Map<String, BigDecimal> classFee = new HashMap<>();
|
|
|
+ classFee.put("course", BigDecimal.ZERO);
|
|
|
+ classFee.put("instrument", BigDecimal.ZERO);
|
|
|
+ classFee.put("accessories", BigDecimal.ZERO);
|
|
|
+ classFee.put("other", amount);
|
|
|
+
|
|
|
+ Map payMap = payService.getPayMap(
|
|
|
+ amount,
|
|
|
+ orderNo,
|
|
|
+ baseApiUrl + "/api-web/studentOrder/notify",
|
|
|
+ baseApiUrl + "/api-web/studentOrder/paymentResult?orderNo=" + orderNo,
|
|
|
+ "乐器维修",
|
|
|
+ "乐器维修",
|
|
|
+ repairInfo.getStudentId(),
|
|
|
+ classFee,
|
|
|
+ repairInfo.getOrganId()
|
|
|
+ );
|
|
|
+
|
|
|
+ Map<String, BigDecimal> routingFee = (Map<String, BigDecimal>) payMap.get("routingFee");
|
|
|
+ studentPaymentOrder.setRoutingOrganId((Integer) payMap.get("routingOrganId"));
|
|
|
+ studentPaymentOrder.setComAmount(routingFee.get("COM"));
|
|
|
+ studentPaymentOrder.setPerAmount(routingFee.get("PER"));
|
|
|
+ studentPaymentOrder.setMerNos((String) payMap.get("routingMerNos"));
|
|
|
+ studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
|
|
|
+ studentPaymentOrder.setUpdateTime(date);
|
|
|
+ studentPaymentOrderService.update(studentPaymentOrder);
|
|
|
+ return payMap;
|
|
|
+ }
|
|
|
+
|
|
|
}
|