|
|
@ -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 { |
|
|
|