Commit 8da23d30 authored by wei's avatar wei 🎱

导出供应商列表数据

parent 13a66fe9
package com.yonde.dcs.plan.common.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author weihongda
* @Date 2024/10/10 21:44
* @Description: 供应商导出VO
*/
@Data
public class ExtSupplierVO implements Serializable {
/**
* 供方编号
*/
@ExcelProperty("供方编号")
private String supplierNumber;
/**
* 供方名称
*/
@ExcelProperty("供方名称")
private String name;
/**
* 统一社会信用引用代码
*/
@ExcelProperty("统一社会信用引用代码")
private String unifiedSocietyCode;
/**
* 供方类别
*/
@ExcelProperty("供方类别")
private String supplierType;
/**
* 供方地址
*/
@ExcelProperty("供方地址")
private String supplierAddress;
/**
* 注册时间
*/
@ExcelProperty("注册时间")
private LocalDateTime registrationTime;
/**
* 注册资金
*/
@ExcelProperty("注册资金")
private String registrationFund;
/**
* 名录有效期
*/
@ExcelProperty("名录有效期")
private LocalDateTime directoryValidity;
/**
* 资质内容
*/
@ExcelProperty("资质内容(承制资格证书)")
private String qscQualificationsContent;
/**
* 证书编号
*/
@ExcelProperty("证书编号")
private String qscCertificateNumber;
/**
* 证书有效期
*/
@ExcelProperty("证书有效期")
private LocalDateTime qscCertificateTime;
/**
* 资质内容
*/
@ExcelProperty("资质内容(质量体系证书)")
private String cqmQualificationsContent;
/**
* 证书编号
*/
@ExcelProperty("证书编号")
private String cqmCertificateNumber;
/**
* 证书有效期
*/
@ExcelProperty("证书有效期")
private LocalDateTime cqmCertificateTime;
/**
* 资质内容
*/
@ExcelProperty("资质内容(科研许可证)")
private String spQualificationsContent;
/**
* 证书编号
*/
@ExcelProperty("证书编号")
private String spCertificateNumber;
/**
* 证书有效期
*/
@ExcelProperty("证书有效期")
private LocalDateTime spCertificateTime;
/**
* 资质内容
*/
@ExcelProperty("资质内容(保密资质证书)")
private String cqcQualificationsContent;
/**
* 证书编号
*/
@ExcelProperty("证书编号")
private String cqcCertificateNumber;
/**
* 证书有效期
*/
@ExcelProperty("证书有效期")
private LocalDateTime cqcCertificateTime;
}
......@@ -2,6 +2,7 @@ package com.yonde.dcs.plan.core.controller;
import com.yonde.dcs.plan.common.utils.EasyExcelUtils;
import com.yonde.dcs.plan.common.vo.ExtSupplierManageVO;
import com.yonde.dcs.plan.common.vo.ExtSupplierVO;
import com.yonde.dcs.plan.common.vo.SupplierEarlyWarningVO;
import com.yonde.dcs.plan.core.controller.shadow.ExtSupplierManageControllerShadow;
import com.yonde.dcs.plan.core.service.ExtSupplierManageService;
......@@ -47,7 +48,7 @@ public class ExtSupplierManageController<V extends ExtSupplierManageVO, S extend
@ApiOperation("导出供方预警列表")
@PostMapping(value = "/exportEarlyWarningData")
public void exportEarlyWarningData(@RequestParam(value = "fileName", defaultValue = "预警信息列表") String fileName, HttpServletResponse response,
public void exportEarlyWarningData(@RequestParam(value = "fileName", defaultValue = "供应商预警信息列表") String fileName, HttpServletResponse response,
@RequestParam(value = "warningDay", defaultValue = "30") int warningDay,
@RequestBody SearchQueryCondition searchQueryCondition) {
try {
......@@ -70,6 +71,19 @@ public class ExtSupplierManageController<V extends ExtSupplierManageVO, S extend
public ApiResult contextDisable(@RequestParam("id") Long id) {
return ApiResult.ok(extSupplierManageService.contextDisable(id), "操作完成");
}
@ApiOperation("导出供应商列表")
@PostMapping(value = "/exportSupplierData")
public void exportSupplierData(HttpServletResponse response,
@RequestParam(value = "fileName", defaultValue = "供应商信息列表") String fileName,
@RequestBody SearchQueryCondition searchQueryCondition) {
try {
List<ExtSupplierVO> list = extSupplierManageService.exportSupplierData(searchQueryCondition);
EasyExcelUtils.exportData(fileName, response, list, ExtSupplierVO.class);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
package com.yonde.dcs.plan.core.service;
import com.yonde.dcs.plan.common.vo.ExtSupplierManageVO;
import com.yonde.dcs.plan.common.vo.ExtSupplierVO;
import com.yonde.dcs.plan.common.vo.SupplierEarlyWarningVO;
import com.yonde.dcs.plan.core.service.shadow.ExtSupplierManageServiceShadow;
import com.yonde.dex.basedata.data.search.SearchQueryCondition;
......@@ -53,4 +54,11 @@ public interface ExtSupplierManageService<V extends ExtSupplierManageVO> extends
* @return
*/
ExtSupplierManageVO contextDisable(Long id);
/**
* 导出供应商数据
* @param searchQueryCondition
* @return
*/
List<ExtSupplierVO> exportSupplierData(SearchQueryCondition searchQueryCondition);
}
......@@ -2,10 +2,7 @@ package com.yonde.dcs.plan.core.service.impl;
import com.google.common.collect.Lists;
import com.yonde.dcs.plan.common.constants.Constants;
import com.yonde.dcs.plan.common.vo.ExtQualificationsVO;
import com.yonde.dcs.plan.common.vo.ExtSupplierManageLinkVO;
import com.yonde.dcs.plan.common.vo.ExtSupplierManageVO;
import com.yonde.dcs.plan.common.vo.SupplierEarlyWarningVO;
import com.yonde.dcs.plan.common.vo.*;
import com.yonde.dcs.plan.core.repository.ExtSupplierManageRepository;
import com.yonde.dcs.plan.core.service.ExtSupplierManageLinkService;
import com.yonde.dcs.plan.core.service.ExtSupplierManageService;
......@@ -19,6 +16,7 @@ import com.yonde.dex.dict.feign.DictDataFeignService;
import com.yonde.dex.dict.service.vo.DictDataVO;
import com.yonde.dex.wfc.feign.api.WfcProcessFeign;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -165,6 +163,57 @@ public class ExtSupplierManageServiceImpl<V extends ExtSupplierManageVO> impleme
}
return this.changeStatus(extSupplierManageVO.getId(), Constants.CONTEXT_DISABLE, true);
}
@Override
public List<ExtSupplierVO> exportSupplierData(SearchQueryCondition searchQueryCondition) {
List<ExtSupplierVO> list = Lists.newArrayList();
Map<String, DictDataVO> supplierTypeMap = this.getDictDataVO(Constants.SUPPLIER_TYPE);
Map<String, DictDataVO> qualificationsContentMap = this.getDictDataVO(Constants.QUALIFICATIONS_CONTENT);
DxPageImpl<V> recursion = this.findRecursion(searchQueryCondition);
List<ExtSupplierManageVO> content = (List<ExtSupplierManageVO>) recursion.getContent();
if (CollectionUtils.isNotEmpty(content)) {
for (ExtSupplierManageVO extSupplierManageVO : content) {
ExtSupplierVO extSupplierVO = new ExtSupplierVO();
BeanUtils.copyProperties(extSupplierManageVO, extSupplierVO);
DictDataVO supplierType = supplierTypeMap.get(extSupplierManageVO.getSupplierType());
extSupplierVO.setSupplierType(supplierType.getDictValue());
for (ExtSupplierManageLinkVO extSupplierManageLink : extSupplierManageVO.getExtSupplierManageLinks()) {
ExtQualificationsVO target = extSupplierManageLink.getTarget();
String qualificationsContent = target.getQualificationsContent();
String certificateNumber = target.getCertificateNumber();
LocalDateTime certificateTime = target.getCertificateTime();
DictDataVO qualifications = qualificationsContentMap.get(qualificationsContent);
String dictValue = qualifications.getDictValue();
switch (qualificationsContent) {
case "qsc":
extSupplierVO.setQscQualificationsContent(dictValue);
extSupplierVO.setQscCertificateNumber(certificateNumber);
extSupplierVO.setQscCertificateTime(certificateTime);
break;
case "sp":
extSupplierVO.setSpQualificationsContent(dictValue);
extSupplierVO.setSpCertificateNumber(certificateNumber);
extSupplierVO.setSpCertificateTime(certificateTime);
break;
case "cqc":
extSupplierVO.setCqcQualificationsContent(dictValue);
extSupplierVO.setCqcCertificateNumber(certificateNumber);
extSupplierVO.setCqcCertificateTime(certificateTime);
break;
case "cqm":
extSupplierVO.setCqmQualificationsContent(dictValue);
extSupplierVO.setCqmCertificateNumber(certificateNumber);
extSupplierVO.setCqmCertificateTime(certificateTime);
break;
default:
break;
}
}
list.add(extSupplierVO);
}
}
return list;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment