|
|
@@ -17,6 +17,7 @@
|
|
|
package org.springblade.los.box.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -44,6 +45,12 @@ import org.springblade.los.business.sea.entity.Containers;
|
|
|
import org.springblade.los.business.sea.service.IBillsService;
|
|
|
import org.springblade.los.business.sea.service.IContainersService;
|
|
|
import org.springblade.los.business.sea.service.ISeaContainerNumberItemService;
|
|
|
+import org.springblade.los.check.dto.LosAuditProecessDTO;
|
|
|
+import org.springblade.los.check.entity.LosAuditPathsActs;
|
|
|
+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.FeeCenterItems;
|
|
|
import org.springblade.los.finance.fee.service.IFeeCenterItemsService;
|
|
|
@@ -109,6 +116,12 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
|
|
|
private final IFeeCenterItemsService feeCenterItemsService;
|
|
|
|
|
|
+ private final IAuditPathsActsService auditPathsActsService;
|
|
|
+
|
|
|
+ private final IAuditPathsLevelsService auditPathsLevelsService;
|
|
|
+
|
|
|
+ private final IAuditProecessService auditProecessService;
|
|
|
+
|
|
|
@Override
|
|
|
public TradingBox getDetail(TradingBox tradingBox) {
|
|
|
if (tradingBox.getId() == null) {
|
|
|
@@ -3375,4 +3388,134 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
|
|
|
return R.data(detail);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R approval(TradingBox tradingBox) {
|
|
|
+ TradingBox detail = baseMapper.selectById(tradingBox.getId());
|
|
|
+ detail.setApprovalStatus("1");
|
|
|
+ detail.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ detail.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ detail.setUpdateTime(new Date());
|
|
|
+ baseMapper.updateById(detail);
|
|
|
+ List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .eq(FeeCenter::getPid, detail.getId()));
|
|
|
+ if (!feeCenterList.isEmpty()) {
|
|
|
+ for (FeeCenter item : feeCenterList) {
|
|
|
+ item.setUpdateTime(new Date());
|
|
|
+ item.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ item.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ item.setAuditStatus("1");
|
|
|
+ item.setApplyId(AuthUtil.getUserId());
|
|
|
+ item.setApplyName(AuthUtil.getUserName());
|
|
|
+ item.setApplyTime(new Date());
|
|
|
+ }
|
|
|
+ feeCenterService.updateBatchById(feeCenterList);
|
|
|
+ }
|
|
|
+ int actId = 1132;
|
|
|
+ String processType = "箱管调箱审核";
|
|
|
+ String checkType = "CGDX";
|
|
|
+ //审批数据
|
|
|
+ LosAuditProecessDTO auditProecessDTO = new LosAuditProecessDTO();
|
|
|
+ //获取审批级次
|
|
|
+ List<LosAuditPathsLevels> auditPathsLevels;
|
|
|
+ // 判断是否有审批流,如果审批流已开启就进入审批流,否则直接走申请通过
|
|
|
+ LosAuditPathsActs pathsActs;
|
|
|
+ //是否开启流程
|
|
|
+ LambdaQueryWrapper<LosAuditPathsActs> auditPathsActsLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ auditPathsActsLambdaQueryWrapper
|
|
|
+ .eq(LosAuditPathsActs::getIsEnable, 1)
|
|
|
+ .eq(LosAuditPathsActs::getFidStatus, "status")
|
|
|
+ .eq(LosAuditPathsActs::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(LosAuditPathsActs::getSalesCompanyId, AuthUtil.getDeptId())
|
|
|
+ .eq(LosAuditPathsActs::getActId, actId);
|
|
|
+ pathsActs = auditPathsActsService.getOne(auditPathsActsLambdaQueryWrapper);
|
|
|
+ //获取审批信息
|
|
|
+ LosAuditPathsActs losAuditPathsActs = auditPathsActsService.getOne(new LambdaQueryWrapper<LosAuditPathsActs>()
|
|
|
+ .eq(LosAuditPathsActs::getActId, actId)
|
|
|
+ .eq(LosAuditPathsActs::getFidStatus, "status")
|
|
|
+ .eq(LosAuditPathsActs::getSalesCompanyId, AuthUtil.getDeptId())
|
|
|
+ .eq(LosAuditPathsActs::getTenantId, AuthUtil.getTenantId()));
|
|
|
+ Long pathId = losAuditPathsActs.getPathId();
|
|
|
+ auditPathsLevels = auditPathsLevelsService.list(new LambdaQueryWrapper<LosAuditPathsLevels>()
|
|
|
+ .eq(LosAuditPathsLevels::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(LosAuditPathsLevels::getPathId, pathId)
|
|
|
+ .eq(LosAuditPathsLevels::getSalesCompanyId, AuthUtil.getDeptId())
|
|
|
+ );
|
|
|
+ auditProecessDTO.setTimes(1);
|
|
|
+ auditProecessDTO.setProcessType(processType);
|
|
|
+ // 没开启审批流直接走 通过流程
|
|
|
+ if (pathsActs == null || pathsActs.getIsEnable() == 2) {
|
|
|
+ throw new SecurityException("当前租户未查询到审批流配置");
|
|
|
+ } else {
|
|
|
+ if (CollectionUtils.isEmpty(auditPathsLevels)) {
|
|
|
+ throw new SecurityException("开启审批失败:未查询到审批信息");
|
|
|
+ }
|
|
|
+ // 绑定审核类型
|
|
|
+ auditProecessDTO.setCheckType(checkType);
|
|
|
+ // 追加跳转路由url
|
|
|
+ auditProecessDTO.setUrl("/boxManagement/boxAdjustment/index");
|
|
|
+ auditProecessDTO.setPageStatus("this.$store.getters.feeApproval");
|
|
|
+ auditProecessDTO.setPageLabel("箱管调箱");
|
|
|
+ auditProecessDTO.setOrderRemark(detail.getRemarks());
|
|
|
+ auditProecessDTO.setPathsLevelsList(auditPathsLevels);
|
|
|
+ auditProecessDTO.setActId(1);
|
|
|
+ auditProecessDTO.setSrcBillId(detail.getId());
|
|
|
+ auditProecessDTO.setBillId(detail.getId());
|
|
|
+ auditProecessDTO.setBillNo(detail.getSysNo());
|
|
|
+ auditProecessDTO.setSendUserId(AuthUtil.getUserId());
|
|
|
+ auditProecessDTO.setSendName(AuthUtil.getUserName());
|
|
|
+ auditProecessDTO.setSendTime(new Date());
|
|
|
+ auditProecessDTO.setBillTime(detail.getPurchaseDate());
|
|
|
+ auditProecessDTO.setTenantId(AuthUtil.getTenantId());
|
|
|
+ auditProecessDTO.setCorpId(detail.getPurchaseCompanyId());
|
|
|
+ auditProecessDTO.setCorpsName(detail.getPurchaseCompanyName());
|
|
|
+ auditProecessDTO.setSalesCompanyId(Long.parseLong(AuthUtil.getDeptId()));
|
|
|
+ auditProecessDTO.setMblno(detail.getContractNo());
|
|
|
+ auditProecessDTO.setHblno(detail.getContractNo());
|
|
|
+ R financeProcess = auditProecessService.createFinanceProcess(auditProecessDTO);
|
|
|
+ if (!financeProcess.isSuccess()) {
|
|
|
+ throw new SecurityException("操作失败,请联系管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.data(detail);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public R revokeApproval(TradingBox tradingBox) {
|
|
|
+ TradingBox detail = baseMapper.selectById(tradingBox.getId());
|
|
|
+ detail.setApprovalStatus("0");
|
|
|
+ detail.setUpdateUserName(AuthUtil.getUserName());
|
|
|
+ detail.setUpdateUser(AuthUtil.getUserId());
|
|
|
+ detail.setUpdateTime(new Date());
|
|
|
+ baseMapper.updateById(detail);
|
|
|
+ List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getPid, detail.getId()));
|
|
|
+ StringBuilder text = new StringBuilder();
|
|
|
+ for (FeeCenter item : feeCenterList) {
|
|
|
+ if (item.getStlTtlAmount().compareTo(BigDecimal.ZERO) != 0) {
|
|
|
+ text.append("费用:").append(item.getFeeCnName()).append("已结算");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(text.toString())) {
|
|
|
+ throw new RuntimeException(text.toString());
|
|
|
+ }
|
|
|
+ for (FeeCenter item : feeCenterList) {
|
|
|
+ item.setAuditStatus("0");
|
|
|
+ item.setAccStatus(0);
|
|
|
+ item.setApplyId(0L);
|
|
|
+ item.setApplyName("");
|
|
|
+ item.setApplyTime(null);
|
|
|
+ }
|
|
|
+ feeCenterService.updateBatchById(feeCenterList);
|
|
|
+ R financeProcess = auditProecessService.deteleBySrcBillId(detail.getId());
|
|
|
+ if (!financeProcess.isSuccess()) {
|
|
|
+ throw new SecurityException("操作失败,请联系管理员");
|
|
|
+ }
|
|
|
+ return R.data(detail);
|
|
|
+ }
|
|
|
+
|
|
|
}
|