|
@@ -106,6 +106,20 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class,isolation = Isolation.SERIALIZABLE)
|
|
|
public Map addGoodsSellOrder(StudentGoodsSell studentGoodsSell) throws Exception {
|
|
|
+ //关闭老订单
|
|
|
+ if(StringUtils.isNotEmpty(studentGoodsSell.getOrderNo())){
|
|
|
+ StudentPaymentOrder orderByOrderNo = studentPaymentOrderService.findOrderByOrderNo(studentGoodsSell.getOrderNo());
|
|
|
+ if(orderByOrderNo.getBalancePaymentAmount() != null){
|
|
|
+ studentGoodsSell.setIsUseBalancePayment(true);
|
|
|
+ }else {
|
|
|
+ studentGoodsSell.setIsUseBalancePayment(false);
|
|
|
+ }
|
|
|
+ orderByOrderNo.setStatus(DealStatusEnum.CLOSE);
|
|
|
+ studentPaymentOrderService.update(orderByOrderNo);
|
|
|
+ if (orderByOrderNo.getBalancePaymentAmount() != null && orderByOrderNo.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ sysUserCashAccountService.updateBalance(orderByOrderNo.getUserId(), orderByOrderNo.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS, "关闭订单");
|
|
|
+ }
|
|
|
+ }
|
|
|
Integer studentId = studentGoodsSell.getUserId();
|
|
|
List<GoodsSellDto> goodsSellDtos = studentGoodsSell.getGoodsSellDtos();
|
|
|
if(goodsSellDtos == null || goodsSellDtos.size() == 0){
|
|
@@ -143,11 +157,7 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
studentGoodsSell.setOrganId(student.getOrganId());
|
|
|
studentGoodsSell.setTotalAmount(amount);
|
|
|
studentGoodsSell.setGoodsJson(JSONObject.toJSONString(goodsSellDtos));
|
|
|
- if(studentGoodsSell.getId() == null){
|
|
|
- studentGoodsSellDao.insert(studentGoodsSell);
|
|
|
- }else {
|
|
|
- studentGoodsSellDao.update(studentGoodsSell);
|
|
|
- }
|
|
|
+ studentGoodsSellDao.insert(studentGoodsSell);
|
|
|
|
|
|
if (studentGoodsSell.getType() == 1) {
|
|
|
Map<String, Object> repairInfoMap = new HashMap<>();
|