|
@@ -1,21 +1,30 @@
|
|
|
package com.fjhx.sale.service.documents.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fjhx.sale.entity.documents.dto.DocumentsPdfDto;
|
|
|
+import com.fjhx.sale.entity.documents.dto.DocumentsPdfSelectDto;
|
|
|
import com.fjhx.sale.entity.documents.po.Documents;
|
|
|
import com.fjhx.sale.entity.documents.po.DocumentsPdf;
|
|
|
+import com.fjhx.sale.entity.documents.po.DocumentsProduct;
|
|
|
+import com.fjhx.sale.entity.documents.vo.DocumentsPdfVo;
|
|
|
import com.fjhx.sale.mapper.documents.DocumentsPdfMapper;
|
|
|
import com.fjhx.sale.service.documents.DocumentsPdfService;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fjhx.sale.service.documents.DocumentsProductService;
|
|
|
import com.fjhx.sale.service.documents.DocumentsService;
|
|
|
+import com.ruoyi.common.exception.ServiceException;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
+import org.apache.commons.collections4.MapUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.fjhx.sale.entity.documents.vo.DocumentsPdfVo;
|
|
|
-import com.fjhx.sale.entity.documents.dto.DocumentsPdfSelectDto;
|
|
|
-import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
-import com.fjhx.sale.entity.documents.dto.DocumentsPdfDto;
|
|
|
-import cn.hutool.core.bean.BeanUtil;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -23,13 +32,19 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
* 单证PDF数据存放表 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
- * @author
|
|
|
+ * @author
|
|
|
* @since 2023-04-26
|
|
|
*/
|
|
|
@Service
|
|
|
public class DocumentsPdfServiceImpl extends ServiceImpl<DocumentsPdfMapper, DocumentsPdf> implements DocumentsPdfService {
|
|
|
|
|
|
@Autowired
|
|
|
+ private DocumentsProductService documentsProductService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DocumentsService documentsService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private DocumentsService documentsService;
|
|
|
|
|
|
@Override
|
|
@@ -42,22 +57,51 @@ public class DocumentsPdfServiceImpl extends ServiceImpl<DocumentsPdfMapper, Doc
|
|
|
|
|
|
/**
|
|
|
* 查询详情
|
|
|
+ *
|
|
|
* @param id 单证ID
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public DocumentsPdfVo detail(Long id) {
|
|
|
- DocumentsPdf documentsPdf = this.getOne(Wrappers.<DocumentsPdf>query().lambda().eq(DocumentsPdf::getDocumentId,id).eq(DocumentsPdf::getDataType,1));
|
|
|
+ DocumentsPdf documentsPdf = this.getOne(Wrappers.<DocumentsPdf>query().lambda().eq(DocumentsPdf::getDocumentId, id).eq(DocumentsPdf::getDataType, 1));
|
|
|
DocumentsPdfVo result = BeanUtil.toBean(documentsPdf, DocumentsPdfVo.class);
|
|
|
- if(ObjectUtils.isEmpty(result)){
|
|
|
+ if (ObjectUtils.isEmpty(result)) {
|
|
|
Documents documents = documentsService.detail(id);
|
|
|
return null;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 报关委托书详情
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> powerDetail(Long id) {
|
|
|
+ DocumentsPdf documentsPdf = this.getOne(Wrappers.<DocumentsPdf>query().lambda().eq(DocumentsPdf::getDocumentId, id).eq(DocumentsPdf::getDataType, 1));
|
|
|
+ DocumentsPdfVo result = BeanUtil.toBean(documentsPdf, DocumentsPdfVo.class);
|
|
|
+ if (ObjectUtil.isEmpty(result)) {
|
|
|
+ Map<String, Object> map = documentsService.getContractDataById(id);
|
|
|
+ //查询单证数据
|
|
|
+ DocumentsProduct documentsProduct = documentsProductService.getMaxMoneyData(id);
|
|
|
+ if (MapUtils.isEmpty(map) || ObjectUtil.isEmpty(documentsProduct)) {
|
|
|
+ throw new ServiceException("数据异常,请联系管理员");
|
|
|
+ }
|
|
|
+ map.put("customerCode", documentsProduct.getCustomsCode());
|
|
|
+ map.put("productName", StringUtils.equals(documentsProduct.getDescribes(), "无") ? documentsProduct.getSubDescribe() : documentsProduct.getDescribes());
|
|
|
+ map.put("productQuantity", documentsProduct.getQuantity());
|
|
|
+ return map;
|
|
|
+ } else {
|
|
|
+ Map<String, Object> map = JSON.parseObject(result.getContent());
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public void add(DocumentsPdfDto documentsPdfDto) {
|
|
|
this.saveOrUpdate(documentsPdfDto);
|