浏览代码

2023年10月27日17:36:16

纪新园 2 年之前
父节点
当前提交
1c81e4684c

+ 8 - 1
blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/fees/entity/LosBFeesTemplate.java

@@ -142,7 +142,7 @@ public class LosBFeesTemplate implements Serializable {
 	 * 是否已删除(0 否 1是)
 	 */
 	@ApiModelProperty(value = "是否已删除(0 否 1是)")
-	@TableLogic(value = "0",delval = "1")
+	@TableLogic(value = "0", delval = "1")
 	private Integer isDeleted;
 	/**
 	 * 备注
@@ -163,4 +163,11 @@ public class LosBFeesTemplate implements Serializable {
 	private List<FeesTemplateItems> feesTemplateItemsList;
 
 
+	/**
+	 * 主表id
+	 */
+	@TableField(exist = false)
+	private Long billNoId;
+
+
 }

+ 22 - 0
blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Dept.java

@@ -117,5 +117,27 @@ public class Dept implements Serializable {
 	@ApiModelProperty(value = "小程序id")
 	private String appletsId;
 
+	/**
+	 * 装货港 id
+	 */
+	@ApiModelProperty(value = "装货港 id")
+	private Long polId;
+	/**
+	 * 装货港中文名称
+	 */
+	@ApiModelProperty(value = "装货港中文名称")
+	private String polCnName;
+
+	/**
+	 * 装货港英文名称
+	 */
+	@ApiModelProperty(value = "装货港英文名称")
+	private String polEnName;
+	/**
+	 * 装货港英文名称打印 默认等于pol_en_name 可以编辑
+	 */
+	@ApiModelProperty(value = "装货港英文名称打印 默认等于pol_en_name 可以编辑")
+	private String polNamePrint;
+
 
 }

+ 1 - 1
blade-service/blade-client/src/main/java/org/springblade/client/corps/controller/CorpsDescController.java

@@ -691,7 +691,7 @@ public class CorpsDescController extends BladeController {
 		String role = AuthUtil.getUserRole();
 		if (!role.contains("admin")) {//admin能看全部,不是admin根据分管员查询
 			if (Func.isNotEmpty(corpsDesc.getAdminProfiles())) {
-				lambdaQueryWrapper.and(i -> i.like(CorpsDesc::getAdminProfiles, corpsDesc.getAdminProfiles()).or().eq(CorpsDesc::getAdminProfiles, ' ')
+				lambdaQueryWrapper.and(i -> i.like(CorpsDesc::getAdminProfiles, corpsDesc.getAdminProfiles()).or().eq(CorpsDesc::getAdminProfiles, "")
 					.or().isNull(CorpsDesc::getAdminProfiles));
 			}
 		}

+ 1 - 1
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java

@@ -1095,7 +1095,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 
 			});
 			//更新库存内容
-			iDeliveryItemsService.updateBatchById(deliveryItemsList);
+			iDeliveryItemsService.updateBatchById(reducelList);
 			if ("681169".equals(AuthUtil.getTenantId())) {
 				// ===================增加益付款逻辑=========================
 				if (CollectionUtils.isNotEmpty(list)) {

+ 29 - 10
blade-service/blade-los/src/main/java/org/springblade/los/basic/fees/controller/LosBFeesTemplateController.java

@@ -17,17 +17,15 @@
 package org.springblade.los.basic.fees.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.validation.Valid;
-
+import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.excel.util.ExcelUtil;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
@@ -35,15 +33,15 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
-import org.springblade.los.excel.LosBFeesTemplateExcel;
-import org.springframework.web.bind.annotation.*;
-import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
-import org.springblade.los.basic.fees.vo.LosBFeesTemplateVO;
 import org.springblade.los.basic.fees.service.ILosBFeesTemplateService;
-import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.los.basic.fees.vo.LosBFeesTemplateVO;
+import org.springblade.los.excel.LosBFeesTemplateExcel;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -189,5 +187,26 @@ public class LosBFeesTemplateController extends BladeController {
 		return losBFeesTemplateService.importLosBFeesTemplate(excelList);
 	}
 
+	/**
+	 * 获取模板列表
+	 */
+	@GetMapping("/getListTemplate")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入losBFeesTemplate")
+	public R<IPage<LosBFeesTemplate>> getListTemplate(LosBFeesTemplate losBFeesTemplate, Query query) {
+		LambdaQueryWrapper<LosBFeesTemplate> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(LosBFeesTemplate::getTenantId, AuthUtil.getTenantId())
+			.eq(LosBFeesTemplate::getIsDeleted, 0)
+			.eq(LosBFeesTemplate::getDc, losBFeesTemplate.getDc())
+			.like(ObjectUtils.isNotNull(losBFeesTemplate.getCode()), LosBFeesTemplate::getCode, losBFeesTemplate.getCode())
+			.like(ObjectUtils.isNotNull(losBFeesTemplate.getCnName()), LosBFeesTemplate::getCnName, losBFeesTemplate.getCnName())
+			.like(ObjectUtils.isNotNull(losBFeesTemplate.getEnName()), LosBFeesTemplate::getEnName, losBFeesTemplate.getEnName())
+			.eq(ObjectUtils.isNotNull(losBFeesTemplate.getStatus()), LosBFeesTemplate::getStatus, losBFeesTemplate.getStatus())
+			.and(i -> i.eq(LosBFeesTemplate::getCreateUser, AuthUtil.getUserId()).or().eq(LosBFeesTemplate::getIsShared, 1))
+			.orderByDesc(LosBFeesTemplate::getCreateTime);
+		IPage<LosBFeesTemplate> pages = losBFeesTemplateService.page(Condition.getPage(query), lambdaQueryWrapper);
+		return R.data(pages);
+	}
+
 
 }

+ 12 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/controller/FeeCenterController.java

@@ -29,6 +29,7 @@ import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
 import org.springblade.los.business.sea.entity.Bills;
 import org.springblade.los.finance.fee.entity.FeeCenter;
 import org.springblade.los.finance.fee.service.IFeeCenterService;
@@ -158,4 +159,15 @@ public class FeeCenterController extends BladeController {
 	}
 
 
+	/**
+	 * 模板导入
+	 */
+	@PostMapping("/templateImport")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入feeCenter")
+	public R<List<FeeCenter>> templateImport(@Valid @RequestBody LosBFeesTemplate losBFeesTemplate) {
+		return feeCenterService.templateImport(losBFeesTemplate);
+	}
+
+
 }

+ 6 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/IFeeCenterService.java

@@ -19,6 +19,7 @@ package org.springblade.los.finance.fee.service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springblade.core.tool.api.R;
+import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
 import org.springblade.los.finance.fee.entity.FeeCenter;
 import org.springblade.los.finance.fee.vo.FeeCenterVO;
 
@@ -57,4 +58,9 @@ public interface IFeeCenterService extends IService<FeeCenter> {
 	 * @return
 	 */
 	List<FeeCenter> getFeeCenterList(String dc, List<Long> ids);
+
+	/**
+	 * 模板导入
+	 */
+    R<List<FeeCenter>> templateImport(LosBFeesTemplate losBFeesTemplate);
 }

+ 120 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FeeCenterServiceImpl.java

@@ -20,18 +20,30 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.los.basic.cur.entity.BCurrency;
+import org.springblade.los.basic.cur.mapper.CurrencyMapper;
+import org.springblade.los.basic.fees.entity.FeesTemplateItems;
+import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
+import org.springblade.los.basic.fees.mapper.FeesTemplateItemsMapper;
+import org.springblade.los.business.sea.entity.Bills;
+import org.springblade.los.business.sea.mapper.BillsMapper;
 import org.springblade.los.finance.fee.entity.FeeCenter;
 import org.springblade.los.finance.fee.mapper.FeeCenterMapper;
 import org.springblade.los.finance.fee.service.IFeeCenterService;
 import org.springblade.los.finance.fee.vo.FeeCenterVO;
 import org.springblade.system.feign.ISysClient;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 物流-费用中心-所有业务费用集中在该表中 服务实现类
@@ -44,6 +56,12 @@ import java.util.List;
 public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter> implements IFeeCenterService {
 	private final ISysClient sysClient;
 
+	private final BillsMapper billsMapper;
+
+	private final FeesTemplateItemsMapper feesTemplateItemsMapper;
+
+	private final CurrencyMapper currencyMapper;
+
 	@Override
 	public IPage<FeeCenterVO> selectFeeCenterPage(IPage<FeeCenterVO> page, FeeCenterVO feeCenter) {
 		return page.setRecords(baseMapper.selectFeeCenterPage(page, feeCenter));
@@ -88,4 +106,106 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 			.in(FeeCenter::getPid, ids));
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
+	public R<List<FeeCenter>> templateImport(LosBFeesTemplate losBFeesTemplate) {
+		List<FeeCenter> list = new ArrayList<>();
+		Bills bills = billsMapper.selectById(losBFeesTemplate.getBillNoId());
+		if (bills == null) {
+			throw new RuntimeException("未找到主表信息");
+		}
+		List<FeesTemplateItems> feesTemplateItemsList = feesTemplateItemsMapper.selectList(new LambdaQueryWrapper<FeesTemplateItems>()
+			.eq(FeesTemplateItems::getTenantId, AuthUtil.getTenantId())
+			.eq(FeesTemplateItems::getIsDeleted, 0)
+			.eq(FeesTemplateItems::getPid, losBFeesTemplate.getId()));
+		if (feesTemplateItemsList.size() > 0) {
+			String code = feesTemplateItemsList.stream().map(FeesTemplateItems::getCurCode).distinct().collect(Collectors.joining());
+			List<BCurrency> bCurrency = currencyMapper.selectList(new LambdaQueryWrapper<BCurrency>()
+				.eq(BCurrency::getTenantId, AuthUtil.getTenantId())
+				.eq(BCurrency::getIsDeleted, 0)
+				.apply("find_in_set(code,'" + code + "')")
+				.eq(BCurrency::getStatus, 0));
+			int count = 1;
+			for (FeesTemplateItems items : feesTemplateItemsList) {
+				FeeCenter feeCenter = new FeeCenter();
+				feeCenter.setPid(bills.getId());
+				feeCenter.setBillNo(bills.getBillNo());
+				feeCenter.setBusinessType(bills.getBusinessType());
+				feeCenter.setBillType(bills.getBillType());
+				feeCenter.setBillDate(bills.getBillDate());
+				feeCenter.setBillCorpId(bills.getCorpId());
+				feeCenter.setBillCorpCnName(bills.getCorpCnName());
+				feeCenter.setBillCorpEnName(bills.getCorpEnName());
+				feeCenter.setLineId(bills.getLineId());
+				feeCenter.setLineCnName(bills.getLineCnName());
+				feeCenter.setLineEnName(bills.getLineEnName());
+				feeCenter.setVesselId(bills.getVesselId());
+				feeCenter.setVesselCnName(bills.getVesselCnName());
+				feeCenter.setVesselEnName(bills.getVesselEnName());
+				feeCenter.setVoyageNo(bills.getVoyageNo());
+				feeCenter.setMblno(bills.getMblno());
+				feeCenter.setHblno(bills.getHblno());
+				feeCenter.setEtd(bills.getEtd());
+				feeCenter.setEta(bills.getEta());
+				feeCenter.setPolId(bills.getPolId());
+				feeCenter.setPolCode(bills.getPolCode());
+				feeCenter.setPolCnName(bills.getPolCnName());
+				feeCenter.setPolEnName(bills.getPolEnName());
+				feeCenter.setPodId(bills.getPodId());
+				feeCenter.setPodCode(bills.getPodCode());
+				feeCenter.setPodCnName(bills.getPodCnName());
+				feeCenter.setPodEnName(bills.getPodEnName());
+				feeCenter.setDc(losBFeesTemplate.getDc());
+				feeCenter.setPaymode(bills.getMPaymode());
+				feeCenter.setSort(count);
+				count++;
+				feeCenter.setCorpId(items.getCorpId());
+				feeCenter.setCorpCnName(items.getCorpCnName());
+				feeCenter.setCorpEnName(items.getCorpEnName());
+				feeCenter.setFeeId(items.getFeeId());
+				feeCenter.setFeeCode(items.getFeeCode());
+				feeCenter.setFeeCnName(items.getFeeCnName());
+				feeCenter.setFeeEnName(items.getFeeEnName());
+				feeCenter.setUnitNo(items.getUnitNo());
+				feeCenter.setPrice(items.getPrice());
+				feeCenter.setCurCode(items.getCurCode());
+				if (ObjectUtils.isNotNull(feeCenter.getCurCode())) {
+					BCurrency currency = bCurrency.stream().filter(e -> e.getCode().equals(feeCenter.getCurCode())).findFirst().orElse(null);
+					if (currency != null) {
+						feeCenter.setExrate(currency.getExrate());
+					}
+				}
+				if ("20GP".equals(items.getUnitNo())) {
+					feeCenter.setQuantity(new BigDecimal((ObjectUtils.isNotNull(bills.getQuantityV20()) ? bills.getQuantityV20() : 0) + ""));
+					feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
+				} else if ("40GP".equals(items.getUnitNo())) {
+					feeCenter.setQuantity(new BigDecimal((ObjectUtils.isNotNull(bills.getQuantityV40()) ? bills.getQuantityV40() : 0) + ""));
+					feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
+				} else if ("40HC".equals(items.getUnitNo())) {
+					feeCenter.setQuantity(new BigDecimal((ObjectUtils.isNotNull(bills.getQuantityV40hc()) ? bills.getQuantityV40hc() : 0) + ""));
+					feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
+				} else if ("45GP".equals(items.getUnitNo())) {
+					feeCenter.setQuantity(new BigDecimal((ObjectUtils.isNotNull(bills.getQuantityV45()) ? bills.getQuantityV45() : 0) + ""));
+					feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
+				} else if ("48GP".equals(items.getUnitNo())) {
+					feeCenter.setQuantity(new BigDecimal((ObjectUtils.isNotNull(bills.getQuantityV48()) ? bills.getQuantityV48() : 0) + ""));
+					feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
+				} else if ("TON".equals(items.getUnitNo())) {
+					feeCenter.setQuantity(bills.getGrossWeight());
+					feeCenter.setAmount(items.getPrice().multiply(bills.getGrossWeight()));
+				} else if ("PKGS".equals(items.getUnitNo())) {
+					feeCenter.setQuantity(bills.getQuantity());
+					feeCenter.setAmount(items.getPrice().multiply(bills.getQuantity()));
+				} else {
+					feeCenter.setQuantity(bills.getMeasurement());
+					feeCenter.setAmount(items.getPrice().multiply(bills.getMeasurement()));
+				}
+				list.add(feeCenter);
+			}
+		}
+		this.saveOrUpdateBatch(list);
+		return R.data(list);
+	}
+
 }

+ 10 - 0
blade-service/blade-system/src/main/java/org/springblade/system/controller/DeptController.java

@@ -233,4 +233,14 @@ public class DeptController extends BladeController {
 		return R.data(DeptWrapper.build().listNodeVO(list));
 	}
 
+	/**
+	 * 获取装货港
+	 */
+	@GetMapping("/getDetailPol")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入dept")
+	public R<Dept> getDetailPol(Dept dept) {
+		return R.data(deptService.getDetailPol(dept));
+	}
+
 }

+ 5 - 0
blade-service/blade-system/src/main/java/org/springblade/system/service/IDeptService.java

@@ -145,4 +145,9 @@ public interface IDeptService extends IService<Dept> {
 	R<Dept> getDeptIByName(String tenantId, String deptName);
 
 	R<List<Dept>> getDeptListIByName(String tenantId, String deptName);
+
+	/**
+	 * 获取装货港
+	 */
+    Dept getDetailPol(Dept dept);
 }

+ 23 - 0
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DeptServiceImpl.java

@@ -237,4 +237,27 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
 		return R.data(dept);
 	}
 
+	@Override
+	public Dept getDetailPol(Dept dept) {
+		Dept deptPol = new Dept();
+		Dept detail = baseMapper.selectById(dept.getId());
+		if (ObjectUtils.isNotNull(detail) && ObjectUtils.isNotNull(detail.getParentId())) {
+			if (0 == detail.getParentId()) {
+				deptPol = detail;
+			} else {
+				deptPol = getParentId(detail.getParentId());
+			}
+		}
+		return deptPol;
+	}
+
+	private Dept getParentId(Long parentId) {
+		Dept detail = baseMapper.selectById(parentId);
+		if (0 == detail.getParentId()) {
+			return detail;
+		} else {
+			return getParentId(detail.getParentId());
+		}
+	}
+
 }