|
@@ -11,10 +11,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.fjhx.area.utils.CustomizeAreaUtil;
|
|
import com.fjhx.area.utils.CustomizeAreaUtil;
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
import com.fjhx.common.utils.Assert;
|
|
import com.fjhx.common.utils.Assert;
|
|
|
|
+import com.fjhx.common.utils.excel.util.ExcelUtil;
|
|
import com.fjhx.file.utils.ObsFileUtil;
|
|
import com.fjhx.file.utils.ObsFileUtil;
|
|
import com.fjhx.supply.entity.supplier.dto.SupplierInfoDto;
|
|
import com.fjhx.supply.entity.supplier.dto.SupplierInfoDto;
|
|
import com.fjhx.supply.entity.supplier.dto.SupplierInfoSelectDto;
|
|
import com.fjhx.supply.entity.supplier.dto.SupplierInfoSelectDto;
|
|
import com.fjhx.supply.entity.supplier.po.SupplierContact;
|
|
import com.fjhx.supply.entity.supplier.po.SupplierContact;
|
|
|
|
+import com.fjhx.supply.entity.supplier.po.SupplierExcelBo;
|
|
import com.fjhx.supply.entity.supplier.po.SupplierInfo;
|
|
import com.fjhx.supply.entity.supplier.po.SupplierInfo;
|
|
import com.fjhx.supply.entity.supplier.vo.SupplierInfoVo;
|
|
import com.fjhx.supply.entity.supplier.vo.SupplierInfoVo;
|
|
import com.fjhx.supply.mapper.supplier.SupplierInfoMapper;
|
|
import com.fjhx.supply.mapper.supplier.SupplierInfoMapper;
|
|
@@ -25,14 +27,17 @@ import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
|
|
import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
|
|
import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
|
|
import com.fjhx.tenant.service.dict.DictTenantDataService;
|
|
import com.fjhx.tenant.service.dict.DictTenantDataService;
|
|
import com.fjhx.tenant.utils.DeptUstil;
|
|
import com.fjhx.tenant.utils.DeptUstil;
|
|
|
|
+import com.fjhx.tenant.utils.DictUtils;
|
|
import com.ruoyi.common.core.domain.BaseSelectDto;
|
|
import com.ruoyi.common.core.domain.BaseSelectDto;
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
import com.ruoyi.common.utils.wrapper.SqlField;
|
|
import com.ruoyi.common.utils.wrapper.SqlField;
|
|
|
|
+import com.ruoyi.system.utils.UserUtil;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -58,9 +63,7 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
|
|
this.supplierContactService = supplierContactService;
|
|
this.supplierContactService = supplierContactService;
|
|
}
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
|
- public Page<SupplierInfoVo> getPage(SupplierInfoSelectDto dto) {
|
|
|
|
- IWrapper<SupplierInfo> wrapper = getWrapper();
|
|
|
|
|
|
+ private void setPageWapper(SupplierInfoSelectDto dto, IWrapper<SupplierInfo> wrapper) {
|
|
wrapper.eq("si", SupplierInfo::getType, dto.getType());
|
|
wrapper.eq("si", SupplierInfo::getType, dto.getType());
|
|
wrapper.like("si", SupplierInfo::getCode, dto.getCode());
|
|
wrapper.like("si", SupplierInfo::getCode, dto.getCode());
|
|
wrapper.like("si", SupplierInfo::getName, dto.getName());
|
|
wrapper.like("si", SupplierInfo::getName, dto.getName());
|
|
@@ -78,12 +81,24 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
|
|
|
|
|
|
|
|
|
|
wrapper.orderByDesc("si", SupplierInfo::getId);
|
|
wrapper.orderByDesc("si", SupplierInfo::getId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Page<SupplierInfoVo> getPage(SupplierInfoSelectDto dto) {
|
|
|
|
+ IWrapper<SupplierInfo> wrapper = getWrapper();
|
|
|
|
+
|
|
|
|
+ setPageWapper(dto, wrapper);
|
|
|
|
|
|
Page<SupplierInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
Page<SupplierInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
|
|
|
- List<SupplierInfoVo> records = page.getRecords();
|
|
|
|
|
|
+ setPageInfo(page.getRecords());
|
|
|
|
+
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setPageInfo(List<SupplierInfoVo> records) {
|
|
if (records.size() == 0) {
|
|
if (records.size() == 0) {
|
|
- return page;
|
|
|
|
|
|
+ return;
|
|
}
|
|
}
|
|
CustomizeAreaUtil.setAreaName(records);
|
|
CustomizeAreaUtil.setAreaName(records);
|
|
|
|
|
|
@@ -96,8 +111,8 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
|
|
//赋值生产公司名称
|
|
//赋值生产公司名称
|
|
record.setCompanyName(companyNameMap.get(record.getCompanyId()));
|
|
record.setCompanyName(companyNameMap.get(record.getCompanyId()));
|
|
}
|
|
}
|
|
-
|
|
|
|
- return page;
|
|
|
|
|
|
+ UserUtil.assignmentNickName(records, SupplierInfoVo::getDevUserId, SupplierInfoVo::setDevUserName);
|
|
|
|
+ DeptUstil.assignmentNickName(records, SupplierInfo::getDeptId, SupplierInfoVo::setDeptName);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -235,4 +250,29 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
|
|
dto.setDictCode(code);
|
|
dto.setDictCode(code);
|
|
return dictTenantDataService.getList(dto);
|
|
return dictTenantDataService.getList(dto);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void excelExport(HttpServletResponse httpServletResponse, SupplierInfoSelectDto dto) {
|
|
|
|
+ IWrapper<SupplierInfo> wrapper = getWrapper();
|
|
|
|
+ setPageWapper(dto, wrapper);
|
|
|
|
+ List<SupplierInfoVo> list = baseMapper.getList(wrapper);
|
|
|
|
+ setPageInfo(list);
|
|
|
|
+
|
|
|
|
+ Map<String, Map<String, String>> allDictKVMap = DictUtils.getAllDictKVMap();
|
|
|
|
+
|
|
|
|
+ List<SupplierExcelBo> contractExcelBos = new ArrayList<>();
|
|
|
|
+ for (SupplierInfoVo contractVo : list) {
|
|
|
|
+ SupplierExcelBo bo = BeanUtil.copyProperties(contractVo, SupplierExcelBo.class);
|
|
|
|
+
|
|
|
|
+ bo.setType(allDictKVMap.get("supplier_type").get(bo.getType()));
|
|
|
|
+ bo.setGrade(allDictKVMap.get("supplier_grade").get(bo.getGrade()));
|
|
|
|
+ bo.setStatus(allDictKVMap.get("supplier_status").get(bo.getStatus()));
|
|
|
|
+ bo.setInvoiceType(allDictKVMap.get("invoice_type").get(bo.getInvoiceType()));
|
|
|
|
+ bo.setPrivIncludingTax("1".equals(bo.getPrivIncludingTax()) ? "是" : "否");
|
|
|
|
+
|
|
|
|
+ contractExcelBos.add(bo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ExcelUtil.export(httpServletResponse, contractExcelBos, SupplierExcelBo.class);
|
|
|
|
+ }
|
|
}
|
|
}
|