|
|
|
@ -4,6 +4,7 @@ import jnpf.arinvoices.entity.*;
|
|
|
|
|
import jnpf.arinvoices.mapper.Arinvoices_item0Mapper;
|
|
|
|
|
import jnpf.arinvoices.service.*;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import jnpf.invoices.entity.InvoicesItem0Entity;
|
|
|
|
|
import jnpf.util.RandomUtil;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
@ -38,4 +39,72 @@ import java.util.*;
|
|
|
|
|
public class Arinvoices_item0ServiceImpl extends ServiceImpl<Arinvoices_item0Mapper, Arinvoices_item0Entity> implements Arinvoices_item0Service{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Map<String, Object> importPreview(List<Arinvoices_item0Entity> personList) {
|
|
|
|
|
List<Map<String, Object>> dataRow = new ArrayList<>();
|
|
|
|
|
List<Map<String, Object>> columns = new ArrayList<>();
|
|
|
|
|
if(personList != null) {
|
|
|
|
|
for (int i = 0; i < personList.size(); i++) {
|
|
|
|
|
Map<String, Object> dataRowMap = new HashMap<>();
|
|
|
|
|
Arinvoices_item0Entity model = personList.get(i);
|
|
|
|
|
dataRowMap.put("materialName", model.getMaterialName());
|
|
|
|
|
dataRowMap.put("invoiceCode", model.getInvoiceCode());
|
|
|
|
|
dataRowMap.put("invoiceNo", model.getInvoiceNo());
|
|
|
|
|
dataRowMap.put("invoiceQuantity", model.getInvoiceQuantity());
|
|
|
|
|
dataRowMap.put("involceAmount", model.getInvolceAmount().add(model.getTaxAmount()));
|
|
|
|
|
dataRowMap.put("taxRate", model.getTaxRate());
|
|
|
|
|
dataRowMap.put("taxAmount", model.getTaxAmount());
|
|
|
|
|
dataRowMap.put("amountNotTax", model.getInvolceAmount().subtract(model.getTaxAmount()));
|
|
|
|
|
dataRowMap.put("invoiceStatus", "0");
|
|
|
|
|
dataRowMap.put("creatorUserName", model.getCreatorUserName());
|
|
|
|
|
dataRowMap.put("invoiceDate", model.getInvoiceDate());
|
|
|
|
|
dataRow.add(dataRowMap);
|
|
|
|
|
}
|
|
|
|
|
for (int i = 1; i < 12; i++) {
|
|
|
|
|
Map<String, Object> columnsMap = new HashMap<>();
|
|
|
|
|
columnsMap.put("AllowDBNull", true);
|
|
|
|
|
columnsMap.put("AutoIncrement", false);
|
|
|
|
|
columnsMap.put("AutoIncrementSeed", 0);
|
|
|
|
|
columnsMap.put("AutoIncrementStep", 1);
|
|
|
|
|
columnsMap.put("Caption", this.getColumns(i));
|
|
|
|
|
columnsMap.put("ColumnMapping", 1);
|
|
|
|
|
columnsMap.put("ColumnName", this.getColumns(i));
|
|
|
|
|
columnsMap.put("Container", null);
|
|
|
|
|
columnsMap.put("DataType", "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
|
|
|
|
|
columnsMap.put("DateTimeMode", 3);
|
|
|
|
|
columnsMap.put("DefaultValue", null);
|
|
|
|
|
columnsMap.put("DesignMode", false);
|
|
|
|
|
columnsMap.put("Expression", "");
|
|
|
|
|
columnsMap.put("ExtendedProperties", "");
|
|
|
|
|
columnsMap.put("MaxLength", -1);
|
|
|
|
|
columnsMap.put("Namespace", "");
|
|
|
|
|
columnsMap.put("Ordinal", 0);
|
|
|
|
|
columnsMap.put("Prefix", "");
|
|
|
|
|
columnsMap.put("ReadOnly", false);
|
|
|
|
|
columnsMap.put("Site", null);
|
|
|
|
|
columnsMap.put("Table", personList);
|
|
|
|
|
columnsMap.put("Unique", false);
|
|
|
|
|
columns.add(columnsMap);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("dataRow", dataRow);
|
|
|
|
|
map.put("columns", columns);
|
|
|
|
|
return map;
|
|
|
|
|
}
|
|
|
|
|
private String getColumns(Integer key) {
|
|
|
|
|
Map<Integer, String> map = new HashMap<>();
|
|
|
|
|
map.put(1, "物料名称");
|
|
|
|
|
map.put(2, "发票代码");
|
|
|
|
|
map.put(3, "发票号码");
|
|
|
|
|
map.put(4, "发票数量");
|
|
|
|
|
map.put(5, "发票金额");
|
|
|
|
|
map.put(6, "税率");
|
|
|
|
|
map.put(7, "税额");
|
|
|
|
|
map.put(8, "不含税金额");
|
|
|
|
|
map.put(9, "发票状态");
|
|
|
|
|
map.put(10, "开票人");
|
|
|
|
|
map.put(11, "开票日期");
|
|
|
|
|
return map.get(key);
|
|
|
|
|
}
|
|
|
|
|
}
|