|
@@ -1,5 +1,7 @@
|
|
|
package com.fjhx.purchase.service.purchase.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -18,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -42,7 +45,7 @@ public class PurchasePayRecordDetailServiceImpl extends ServiceImpl<PurchasePayR
|
|
|
public Page<PurchasePayRecordDetailVo> getPage(PurchasePayRecordDetailSelectDto dto) {
|
|
|
IWrapper<PurchasePayRecordDetail> wrapper = getWrapper();
|
|
|
wrapper.eq(PurchasePayRecordDetail::getPurchaseId, dto.getPurchaseId());
|
|
|
- wrapper.orderByDesc("ppr", PurchasePayRecordDetail::getId);
|
|
|
+ wrapper.orderByDesc("pprd", PurchasePayRecordDetail::getId);
|
|
|
Page<PurchasePayRecordDetailVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
UserUtil.assignmentNickName(page.getRecords(), PurchasePayRecordDetailVo::getCreateUser, PurchasePayRecordDetailVo::setPayUserName);
|
|
|
return page;
|
|
@@ -55,16 +58,20 @@ public class PurchasePayRecordDetailServiceImpl extends ServiceImpl<PurchasePayR
|
|
|
//修改付款状态未未付款
|
|
|
Purchase purchase = purchaseService.getById(dto.getPurchaseId());
|
|
|
purchase.setPayStatus(0);
|
|
|
+ String victoriatouristJson = purchase.getVictoriatouristJson();
|
|
|
+ JSONObject json = ObjectUtil.isEmpty(victoriatouristJson) ? new JSONObject() : JSONObject.parseObject(victoriatouristJson);
|
|
|
+ json.put("paidAmount", BigDecimal.ZERO);
|
|
|
+ purchase.setVictoriatouristJson(json.toJSONString());
|
|
|
purchaseService.updateById(purchase);
|
|
|
- //清空付款记录
|
|
|
- this.remove(q -> q.eq(PurchasePayRecordDetail::getPurchaseId, dto.getPurchaseId()));
|
|
|
|
|
|
- //清空记录信息
|
|
|
+ //清空付款记录记录信息
|
|
|
List<PurchasePayRecordDetail> list = this.list(q -> q.eq(PurchasePayRecordDetail::getPurchaseId, dto.getPurchaseId()));
|
|
|
if (ObjectUtils.isNotEmpty(list)) {
|
|
|
List<Long> purchasePayRecordIds = list.stream().map(PurchasePayRecordDetail::getPurchasePayRecordId).collect(Collectors.toList());
|
|
|
purchasePayRecordService.removeBatchByIds(purchasePayRecordIds);
|
|
|
}
|
|
|
+ //清空付款明细信息
|
|
|
+ this.remove(q -> q.eq(PurchasePayRecordDetail::getPurchaseId, dto.getPurchaseId()));
|
|
|
}
|
|
|
|
|
|
}
|