|
|
@@ -25,6 +25,14 @@ import lombok.AllArgsConstructor;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.los.Util.IDeptUtils;
|
|
|
+import org.springblade.los.business.aea.entity.AeaBills;
|
|
|
+import org.springblade.los.business.aea.service.IAeaBillsService;
|
|
|
+import org.springblade.los.business.amends.entity.Amends;
|
|
|
+import org.springblade.los.business.amends.service.IAmendsService;
|
|
|
+import org.springblade.los.business.customsDeclaration.entity.CustomsDeclaration;
|
|
|
+import org.springblade.los.business.customsDeclaration.service.ICustomsDeclarationService;
|
|
|
+import org.springblade.los.business.sea.entity.Bills;
|
|
|
+import org.springblade.los.business.sea.service.IBillsService;
|
|
|
import org.springblade.los.business.update.entity.Update;
|
|
|
import org.springblade.los.business.update.entity.UpdateItem;
|
|
|
import org.springblade.los.business.update.mapper.UpdateMapper;
|
|
|
@@ -37,12 +45,18 @@ import org.springblade.los.check.entity.LosAuditPathsLevels;
|
|
|
import org.springblade.los.check.service.IAuditPathsActsService;
|
|
|
import org.springblade.los.check.service.IAuditPathsLevelsService;
|
|
|
import org.springblade.los.check.service.IAuditProecessService;
|
|
|
+import org.springblade.los.finance.fee.entity.FeeCenter;
|
|
|
+import org.springblade.los.finance.fee.entity.FinAccBills;
|
|
|
+import org.springblade.los.finance.fee.service.IFeeCenterService;
|
|
|
+import org.springblade.los.finance.fee.service.IFinAccBillsService;
|
|
|
import org.springblade.system.entity.Dept;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 业务修改表 服务实现类
|
|
|
@@ -65,6 +79,18 @@ public class UpdateServiceImpl extends ServiceImpl<UpdateMapper, Update> impleme
|
|
|
|
|
|
private final IDeptUtils deptUtils;
|
|
|
|
|
|
+ private final IFeeCenterService feeCenterService;
|
|
|
+
|
|
|
+ private final IFinAccBillsService finAccBillsService;
|
|
|
+
|
|
|
+ private final IBillsService billsService;
|
|
|
+
|
|
|
+ private final IAeaBillsService aeaBillsService;
|
|
|
+
|
|
|
+ private final ICustomsDeclarationService customsDeclarationService;
|
|
|
+
|
|
|
+ private final IAmendsService amendsService;
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<UpdateVO> selectUpdatePage(IPage<UpdateVO> page, UpdateVO update) {
|
|
|
return page.setRecords(baseMapper.selectUpdatePage(page, update));
|
|
|
@@ -127,6 +153,7 @@ public class UpdateServiceImpl extends ServiceImpl<UpdateMapper, Update> impleme
|
|
|
List<UpdateItem> updateItemList = updateItemService.list(new LambdaQueryWrapper<UpdateItem>()
|
|
|
.eq(UpdateItem::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(UpdateItem::getIsDeleted, 0)
|
|
|
+ .eq(UpdateItem::getStatus, 1)
|
|
|
.eq(UpdateItem::getPid, update1.getId())
|
|
|
);
|
|
|
for (UpdateItem item : updateItemList) {
|
|
|
@@ -230,12 +257,150 @@ public class UpdateServiceImpl extends ServiceImpl<UpdateMapper, Update> impleme
|
|
|
.eq(UpdateItem::getIsDeleted, 0)
|
|
|
.eq(UpdateItem::getPid, update.getId())
|
|
|
);
|
|
|
+ Bills bills = null;
|
|
|
+ AeaBills aeaBills = null;
|
|
|
+ CustomsDeclaration customsDeclaration = null;
|
|
|
+ List<Amends> amendsList;
|
|
|
+ List<FeeCenter> feeCenterList;
|
|
|
+ List<FinAccBills> finAccBillsList;
|
|
|
+ List<Long> ids = new ArrayList<>();
|
|
|
+ if ("SE".equals(update.getBusinessType()) || "SI".equals(update.getBusinessType())) {
|
|
|
+ LambdaQueryWrapper<Bills> lambdaQueryWrapper = new LambdaQueryWrapper<Bills>()
|
|
|
+ .eq(Bills::getBusinessType, update.getBusinessType())
|
|
|
+ .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Bills::getIsDeleted, 0);
|
|
|
+ if (ObjectUtils.isNull(update.getRetrievalType())) {
|
|
|
+ throw new RuntimeException("检索类型必填");
|
|
|
+ }
|
|
|
+ if ("1".equals(update.getRetrievalType())) {
|
|
|
+ lambdaQueryWrapper.eq(Bills::getBillNo, update.getRetrievalValue());
|
|
|
+ } else if ("2".equals(update.getRetrievalType())) {
|
|
|
+ lambdaQueryWrapper.eq(Bills::getMblno, update.getRetrievalValue());
|
|
|
+ }
|
|
|
+ lambdaQueryWrapper.last("limit 1");
|
|
|
+ bills = billsService.getOne(lambdaQueryWrapper);
|
|
|
+ if (bills == null) {
|
|
|
+ throw new RuntimeException("未查到原单据信息");
|
|
|
+ }
|
|
|
+ ids.add(bills.getId());
|
|
|
+ } else if ("AI".equals(update.getBusinessType()) || "AE".equals(update.getBusinessType())) {
|
|
|
+ LambdaQueryWrapper<AeaBills> lambdaQueryWrapper = new LambdaQueryWrapper<AeaBills>()
|
|
|
+ .eq(AeaBills::getBusinessType, update.getBusinessType())
|
|
|
+ .eq(AeaBills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(AeaBills::getIsDeleted, 0);
|
|
|
+ if (ObjectUtils.isNull(update.getRetrievalType())) {
|
|
|
+ throw new RuntimeException("检索类型必填");
|
|
|
+ }
|
|
|
+ if ("1".equals(update.getRetrievalType())) {
|
|
|
+ lambdaQueryWrapper.eq(AeaBills::getBillNo, update.getRetrievalValue());
|
|
|
+ } else if ("2".equals(update.getRetrievalType())) {
|
|
|
+ lambdaQueryWrapper.eq(AeaBills::getMblno, update.getRetrievalValue());
|
|
|
+ }
|
|
|
+ lambdaQueryWrapper.last("limit 1");
|
|
|
+ aeaBills = aeaBillsService.getOne(lambdaQueryWrapper);
|
|
|
+ if (aeaBills == null) {
|
|
|
+ throw new RuntimeException("未查到原单据信息");
|
|
|
+ }
|
|
|
+ ids.add(aeaBills.getId());
|
|
|
+ } else if ("BGSE".equals(update.getBusinessType()) || "BGSI".equals(update.getBusinessType()) ||
|
|
|
+ "BGAI".equals(update.getBusinessType()) || "BGAE".equals(update.getBusinessType())) {
|
|
|
+ LambdaQueryWrapper<CustomsDeclaration> lambdaQueryWrapper = new LambdaQueryWrapper<CustomsDeclaration>()
|
|
|
+ .eq(CustomsDeclaration::getBusinessType, update.getBusinessType())
|
|
|
+ .eq(CustomsDeclaration::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(CustomsDeclaration::getIsDeleted, 0);
|
|
|
+ if (ObjectUtils.isNull(update.getRetrievalType())) {
|
|
|
+ throw new RuntimeException("检索类型必填");
|
|
|
+ }
|
|
|
+ if ("1".equals(update.getRetrievalType())) {
|
|
|
+ lambdaQueryWrapper.eq(CustomsDeclaration::getBillNo, update.getRetrievalValue());
|
|
|
+ } else if ("2".equals(update.getRetrievalType())) {
|
|
|
+ lambdaQueryWrapper.eq(CustomsDeclaration::getMblno, update.getRetrievalValue());
|
|
|
+ }
|
|
|
+ lambdaQueryWrapper.last("limit 1");
|
|
|
+ customsDeclaration = customsDeclarationService.getOne(lambdaQueryWrapper);
|
|
|
+ if (customsDeclaration == null) {
|
|
|
+ throw new RuntimeException("未查到原单据信息");
|
|
|
+ }
|
|
|
+ ids.add(customsDeclaration.getId());
|
|
|
+ }
|
|
|
+ if (ids.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到原单据信息");
|
|
|
+ }
|
|
|
+ amendsList = amendsService.list(new LambdaQueryWrapper<Amends>()
|
|
|
+ .in(Amends::getOrigId, ids)
|
|
|
+ .eq(Amends::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Amends::getIsDeleted, 0));
|
|
|
+ if (!amendsList.isEmpty()) {
|
|
|
+ ids.addAll(amendsList.stream().map(Amends::getId).collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .in(FeeCenter::getPid, ids)
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0));
|
|
|
+ finAccBillsList = finAccBillsService.list(new LambdaQueryWrapper<FinAccBills>()
|
|
|
+ .in(FinAccBills::getBusinessBillId, ids)
|
|
|
+ .eq(FinAccBills::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FinAccBills::getIsDeleted, 0));
|
|
|
for (UpdateItem item : updateItemList) {
|
|
|
-
|
|
|
+ if ("SE".equals(update.getBusinessType()) || "SI".equals(update.getBusinessType())) {
|
|
|
+ bills = updateBills(bills, amendsList, feeCenterList, finAccBillsList, item);
|
|
|
+ } else if ("AI".equals(update.getBusinessType()) || "AE".equals(update.getBusinessType())) {
|
|
|
+ aeaBills = updateAeaBills(aeaBills, amendsList, feeCenterList, finAccBillsList, item);
|
|
|
+ } else if ("BGSE".equals(update.getBusinessType()) || "BGSI".equals(update.getBusinessType()) ||
|
|
|
+ "BGAI".equals(update.getBusinessType()) || "BGAE".equals(update.getBusinessType())) {
|
|
|
+ customsDeclaration = updateCustomsDeclaration(customsDeclaration, amendsList, feeCenterList, finAccBillsList, item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("SE".equals(update.getBusinessType()) || "SI".equals(update.getBusinessType())) {
|
|
|
+ if (bills == null) {
|
|
|
+ throw new RuntimeException("操作失败,请联系管理员");
|
|
|
+ }
|
|
|
+ bills.setUpdateTime(new Date());
|
|
|
+ bills.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ bills.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ billsService.updateById(bills);
|
|
|
+ } else if ("AI".equals(update.getBusinessType()) || "AE".equals(update.getBusinessType())) {
|
|
|
+ if (aeaBills == null) {
|
|
|
+ throw new RuntimeException("操作失败,请联系管理员");
|
|
|
+ }
|
|
|
+ aeaBills.setUpdateTime(new Date());
|
|
|
+ aeaBills.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ aeaBills.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ aeaBillsService.updateById(aeaBills);
|
|
|
+ } else if ("BGSE".equals(update.getBusinessType()) || "BGSI".equals(update.getBusinessType()) ||
|
|
|
+ "BGAI".equals(update.getBusinessType()) || "BGAE".equals(update.getBusinessType())) {
|
|
|
+ if (customsDeclaration == null) {
|
|
|
+ throw new RuntimeException("操作失败,请联系管理员");
|
|
|
+ }
|
|
|
+ customsDeclaration.setUpdateTime(new Date());
|
|
|
+ customsDeclaration.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ customsDeclaration.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ customsDeclarationService.updateById(customsDeclaration);
|
|
|
+ }
|
|
|
+ if (!amendsList.isEmpty()) {
|
|
|
+ amendsService.updateBatchById(amendsList);
|
|
|
+ }
|
|
|
+ if (!feeCenterList.isEmpty()) {
|
|
|
+ feeCenterService.updateBatchById(feeCenterList);
|
|
|
+ }
|
|
|
+ if (!finAccBillsList.isEmpty()) {
|
|
|
+ finAccBillsService.updateBatchById(finAccBillsList);
|
|
|
}
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
|
|
|
+ private Bills updateBills(Bills bills, List<Amends> amendsList, List<FeeCenter> feeCenterList, List<FinAccBills> finAccBillsList, UpdateItem item) {
|
|
|
+ return bills;
|
|
|
+ }
|
|
|
+
|
|
|
+ private AeaBills updateAeaBills(AeaBills aeaBills, List<Amends> amendsList, List<FeeCenter> feeCenterList, List<FinAccBills> finAccBillsList, UpdateItem item) {
|
|
|
+ return aeaBills;
|
|
|
+ }
|
|
|
+
|
|
|
+ private CustomsDeclaration updateCustomsDeclaration(CustomsDeclaration customsDeclaration, List<Amends> amendsList, List<FeeCenter> feeCenterList, List<FinAccBills> finAccBillsList, UpdateItem item) {
|
|
|
+ return customsDeclaration;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public R underReview(Long id) {
|
|
|
Update update = baseMapper.selectById(id);
|