|
@@ -24,6 +24,7 @@ import com.alibaba.nacos.common.utils.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
@@ -132,6 +133,7 @@ public class BizInvoiceController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('business:invoice:add')")
|
|
|
@Log(title = "开票管理", businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public AjaxResult add(@RequestBody BizInvoice bizInvoice) throws NoSuchFieldException, IllegalAccessException {
|
|
|
BizCopyInfo info1 = new BizCopyInfo();
|
|
|
BizCopyInfo info2 = new BizCopyInfo();
|
|
@@ -169,7 +171,32 @@ public class BizInvoiceController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('business:invoice:edit')")
|
|
|
@Log(title = "开票管理", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public AjaxResult edit(@RequestBody BizInvoice bizInvoice) throws NoSuchFieldException, IllegalAccessException {
|
|
|
+ Long tenantId = getTenantId();
|
|
|
+ BizCopyInfo info1 = new BizCopyInfo();
|
|
|
+ BizCopyInfo info2 = new BizCopyInfo();
|
|
|
+ BizCopyInfo one = bizCopyInfoService.getOne(new LambdaQueryWrapper<BizCopyInfo>().eq(BizCopyInfo::getTenantId, tenantId));
|
|
|
+ if (one != null) {
|
|
|
+ info1.setId(one.getId());
|
|
|
+ }
|
|
|
+ info1.setName(one.getName());
|
|
|
+ info1.setAddress(one.getAddress());
|
|
|
+ info1.setAccount(one.getAccount());
|
|
|
+ info1.setCode(one.getCode());
|
|
|
+ info1.setTenantId(tenantId);
|
|
|
+ bizCopyInfoService.saveOrUpdate(info1);
|
|
|
+ //收票户
|
|
|
+ String invoiceOther = bizInvoice.getInvoiceOther();
|
|
|
+ BizCopyInfo one1 = bizCopyInfoService.getOne(new LambdaQueryWrapper<BizCopyInfo>().eq(BizCopyInfo::getName, invoiceOther));
|
|
|
+ if (one1 != null) {
|
|
|
+ info2.setId(one1.getId());
|
|
|
+ }
|
|
|
+ info2.setName(invoiceOther);
|
|
|
+ info2.setAddress(bizInvoice.getOtherAddress());
|
|
|
+ info2.setAccount(bizInvoice.getOtherAccount());
|
|
|
+ info2.setCode(bizInvoice.getOtherCreditSocietyCode());
|
|
|
+ bizCopyInfoService.saveOrUpdate(info2);
|
|
|
if (bizInvoice.getStatus().equals(3)) {
|
|
|
Long userId = getUserId();
|
|
|
bizInvoice.setInvoiceId(userId);
|
|
@@ -179,8 +206,8 @@ public class BizInvoiceController extends BaseController {
|
|
|
sysFileStorage.setFileUrl(bizInvoice.getEvidenceFile());
|
|
|
sysFileStorage.setFileName(bizInvoice.getFileName());
|
|
|
sysFileStorage.setOriginalFileName(bizInvoice.getOriginalFileName());
|
|
|
- SysFileStorage one = fileStorageService.getOne(new LambdaQueryWrapper<SysFileStorage>().eq(SysFileStorage::getMasterId, bizInvoice.getId()));
|
|
|
- fileStorageService.physicalDelete(one);
|
|
|
+ SysFileStorage fileStorage = fileStorageService.getOne(new LambdaQueryWrapper<SysFileStorage>().eq(SysFileStorage::getMasterId, bizInvoice.getId()));
|
|
|
+ fileStorageService.physicalDelete(fileStorage);
|
|
|
fileStorageService.save(sysFileStorage);
|
|
|
}
|
|
|
|