|
@@ -1,8 +1,11 @@
|
|
|
package cn.com.ty.lift.ud.payment.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
+import com.lowagie.text.pdf.AcroFields;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -66,17 +69,17 @@ public class ApplyInvoiceServiceImpl extends ServiceImpl<ApplyInvoiceMapper, App
|
|
|
applyInvoiceMapper.insert(applyInvoiceEntity);
|
|
|
OtherSettingEntity latestVersion = otherSettingMapper.getLatestVersion();
|
|
|
for (ApplyInvoiceItemEntity item : applyInvoiceEntity.getInvoiceItem()) {
|
|
|
- LiftCaseEntity selectById = caseMapper.selectById(item.getId());
|
|
|
- selectById.setIsInvoice(1);
|
|
|
- caseMapper.updateById(selectById);
|
|
|
- item.setDataId(selectById.getId());
|
|
|
+ LiftCaseEntity liftCase = caseMapper.selectById(item.getId());
|
|
|
+ liftCase.setIsInvoice(1);
|
|
|
+ caseMapper.updateById(liftCase);
|
|
|
+ item.setDataId(liftCase.getId());
|
|
|
item.setInvoiceId(applyInvoiceEntity.getId());
|
|
|
item.setDw("次");
|
|
|
item.setXmmc("咨询服务");
|
|
|
item.setGgxh("无");
|
|
|
item.setFphxz(1);
|
|
|
- item.setXmdj(selectById.getPayCost());
|
|
|
- item.setXmze(selectById.getPayCost());
|
|
|
+ item.setXmdj(liftCase.getPayCost());
|
|
|
+ item.setXmze(liftCase.getPayCost());
|
|
|
item.setXmsl(1);
|
|
|
item.setSl(latestVersion.getDefaultTax());
|
|
|
item.setSe((new BigDecimal(item.getSl())).multiply(item.getXmze()).divide(new BigDecimal("100")));
|
|
@@ -96,6 +99,19 @@ public class ApplyInvoiceServiceImpl extends ServiceImpl<ApplyInvoiceMapper, App
|
|
|
} else {
|
|
|
// 修改状态为 驳回,并加上驳回理由
|
|
|
applyInvoiceMapper.updateInfoById(neDto.getId(), neDto.getReason());
|
|
|
+
|
|
|
+ // 修改订单状态,让他可以重新提交申请
|
|
|
+ Optional<ApplyInvoiceEntity> invoiceOptional = Optional.ofNullable(super.getById(neDto.getId()));
|
|
|
+ invoiceOptional.ifPresent(applyInvoiceEntity -> {
|
|
|
+ ApplyInvoiceEntity invoiceEntity = super.getById(applyInvoiceEntity.getId());
|
|
|
+ Iterator<ApplyInvoiceItemEntity> iterator = invoiceEntity.getInvoiceItem().iterator();
|
|
|
+ while (iterator.hasNext()){
|
|
|
+ ApplyInvoiceItemEntity item = iterator.next();
|
|
|
+ LiftCaseEntity liftCase = caseMapper.selectById(item.getId());
|
|
|
+ liftCase.setIsInvoice(0);
|
|
|
+ caseMapper.updateById(liftCase);
|
|
|
+ }
|
|
|
+ });
|
|
|
// todo 发送消息给该用户
|
|
|
return RestResponse.fail(null, "审批驳回");
|
|
|
}
|