Browse Source

[feat]采购管理

按照外材要求供应商前端页面新增导出功能
供应商实体类:内外销和企业性质加上字典属性
供应商新增 导出供应商资料列表后端接口
供应商新增 以筛选资质和类型导出全部后端方法
dev
liuxiaoxu 4 days ago
parent
commit
16a05e2436
  1. 57
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSupplierController.java
  2. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java
  3. 7
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSupplierMapper.java
  4. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSupplierService.java
  5. 10
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java
  6. 12
      ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml
  7. 3
      ruoyi-admin/src/main/resources/templates/system/supplier/supplier.html

57
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSupplierController.java

@ -16,6 +16,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.process.general.service.IProcessService;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.Vo.SysSupplierVo;
@ -195,53 +196,25 @@ public class SysSupplierController extends BaseController
}
//导出
/**
* 导出供应商资料列表
*/
@RequiresPermissions("system:supplier:export")
@Log(title = "供应商资料", businessType = BusinessType.EXPORT)
@RequestMapping("/exportSupplierInfo")
@PostMapping("/export")
@ResponseBody
public void exportSupplierInfo(@RequestBody String selectData, HttpServletResponse response) throws IOException {
//数据处理
JSONObject jsonObject = (JSONObject) JSONObject.parse(selectData);
JSONArray jsonArray = jsonObject.getJSONArray("selectData");
List<SysSupplierDto> selectDataList = JSONObject.parseArray(String.valueOf(jsonArray), SysSupplierDto.class);
//获取发票基础信息
SysSupplier sysSupplier = sysSupplierService.selectSysSupplierById(selectDataList.get(0).getSupplierId());
SysSupplierDto sysSupplierDto = new SysSupplierDto();
BeanUtils.copyProperties(sysSupplier,sysSupplierDto);
//填充表格
response.setCharacterEncoding("utf-8");
String fileName = URLEncoder.encode("国税发票", "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
String templateFileName = "C:\\exportTemplates\\exportSupplierInfo.xlsx";
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(templateFileName).build()) {
WriteSheet writeSheet = EasyExcel.writerSheet().build();
Map<String, Object> map = MapUtils.newHashMap();
// map.put("date", DateTimeFormatter.ofPattern("yyyy/MM/dd").format(LocalDateTime.now()));
map.put("enterpriseName", sysSupplierDto.getEnterpriseName());
map.put("customerAddress", sysSupplierDto.getCustomerAddress());
map.put("postalCode", sysSupplierDto.getPostalCode());
map.put("contactNumber", sysSupplierDto.getContactNumber());
map.put("customerFax", sysSupplierDto.getCustomerFax());
map.put("customerContact", sysSupplierDto.getCustomerContact());
map.put("paymentTerms", sysSupplierDto.getPaymentTerms());
map.put("taxRate", sysSupplierDto.getTaxRate());
List<SysDictData> exportSalesData = sysDictTypeService.selectDictDataByType("sys_export_sales");
for (int i = 0;i<exportSalesData.size();i++) {
if (sysSupplierDto.getExportSales().equals(exportSalesData.get(i).getDictValue())) {
map.put("exportSales", exportSalesData.get(i).getDictLabel());
}
}
public AjaxResult export(SysSupplier sysSupplier)
{
List<SysSupplier> list = sysSupplierService.exportSelectSupplierList(sysSupplier);
ExcelUtil<SysSupplier> util = new ExcelUtil<SysSupplier>(SysSupplier.class);
// System.out.println(exportSalesData);
excelWriter.fill(map, writeSheet);
}
return util.exportExcel(list, "供应商资料");
}
@PostMapping("/getId")
@ResponseBody
public Result getId() throws Exception {

4
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java

@ -45,7 +45,7 @@ public class SysSupplier extends BaseEntity
/** 内外销 */
@Excel(name = "内外销")
@Excel(name = "内外销",dictType = "sys_export_sales")
private String exportSales;
/** 企业名称 */
@ -53,7 +53,7 @@ public class SysSupplier extends BaseEntity
private String enterpriseName;
/** 企业性质 */
@Excel(name = "企业性质")
@Excel(name = "企业性质",dictType = "sys_enterprise_nature")
private String enterpriseNature;
/** 企业地址 */

7
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSupplierMapper.java

@ -61,6 +61,13 @@ public interface SysSupplierMapper
*/
public int deleteSysSupplierByIds(String[] supplierIds);
/**
* 可以筛选资质和类型导出全部
*/
public List<SysSupplier> exportSelectSupplierList(SysSupplier sysSupplier);
public List<SysSupplier> selectSysSupplierBycode();
/**

5
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSupplierService.java

@ -67,6 +67,11 @@ public interface ISysSupplierService
public List selectSysSupplierBycode();
/**
* 可以筛选资质和类型导出全部
*/
public List<SysSupplier> exportSelectSupplierList(SysSupplier sysSupplier);
/**
* 新增物料信息的时候查关联应商信息
*/

10
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java

@ -267,6 +267,16 @@ public class SysSupplierServiceImpl implements ISysSupplierService{
return sysSupplierMapper.selectSysSupplierBycode();
}
/**
* 可以筛选资质和类型导出全部
*/
@Override
public List<SysSupplier> exportSelectSupplierList(SysSupplier sysSupplier) {
return sysSupplierMapper.exportSelectSupplierList(sysSupplier);
}
/**
* 新增物料信息的时候查关联应商信息
*/

12
ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml

@ -165,6 +165,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
on sup.supplier_id = file.rel_id
where sup.supplier_id = #{supplierId}
</select>
<select id="exportSelectSupplierList" parameterType="SysSupplier" resultMap="SysSupplierResult">
<include refid="selectSysSupplierVo"/>
<where>
<if test="supplierType != null and supplierType != ''"> and supplier_type = #{supplierType}</if>
<if test="supplierQualification != null and supplierQualification != ''"> and supplier_qualification = #{supplierQualification}</if>
</where>
</select>
<select id="selectSysSupplierBycode" resultMap="SysSupplierResult">
<include refid="selectSysSupplierVo"/>
where audit_status = 1 and use_status = 1

3
ruoyi-admin/src/main/resources/templates/system/supplier/supplier.html

@ -60,6 +60,9 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:supplier:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-success" onclick="$.table.exportExcel()" shiro:hasPermission="system:supplier:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" style="white-space:nowrap"></table>

Loading…
Cancel
Save