|
|
|
@ -2,16 +2,23 @@ package jnpf.contractfile.service.impl;
|
|
|
|
|
|
|
|
|
|
import jnpf.contractfile.entity.*;
|
|
|
|
|
import jnpf.contractfile.mapper.ContractFileMapper;
|
|
|
|
|
import jnpf.contractfile.model.contractfile.ContractFileModel;
|
|
|
|
|
import jnpf.contractfile.model.contractfile.ContractfileImportVO;
|
|
|
|
|
import jnpf.contractfile.service.*;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import jnpf.entity.EmployeeEntity;
|
|
|
|
|
import jnpf.model.EmployeeModel;
|
|
|
|
|
import jnpf.model.employee.EmployeeImportVO;
|
|
|
|
|
import jnpf.permission.model.authorize.AuthorizeConditionModel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import jnpf.contractfile.model.contractfile.ContractFilePagination;
|
|
|
|
|
|
|
|
|
|
import jnpf.permission.service.AuthorizeService;
|
|
|
|
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.annotation.TableField;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -21,10 +28,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import jnpf.util.*;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* contractFile
|
|
|
|
|
* 版本: V3.2.0
|
|
|
|
|
* 版权: LINKAGE-BOOT
|
|
|
|
@ -49,8 +56,6 @@ public class ContractFileServiceImpl extends ServiceImpl<ContractFileMapper, Con
|
|
|
|
|
private Contract_item1Service contract_item1Service;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ContractFileEntity> getList(ContractFilePagination contractFilePagination) {
|
|
|
|
|
String userId = userProvider.get().getUserId();
|
|
|
|
@ -148,6 +153,7 @@ public class ContractFileServiceImpl extends ServiceImpl<ContractFileMapper, Con
|
|
|
|
|
return contractFilePagination.setData(list, list.size());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<ContractFileEntity> getTypeList(ContractFilePagination contractFilePagination, String dataType) {
|
|
|
|
|
String userId = userProvider.get().getUserId();
|
|
|
|
@ -267,12 +273,135 @@ public class ContractFileServiceImpl extends ServiceImpl<ContractFileMapper, Con
|
|
|
|
|
entity.setId(id);
|
|
|
|
|
return this.updateById(entity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override //预览
|
|
|
|
|
public Map<String, Object> importPreview(List<ContractFileModel> 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<>();
|
|
|
|
|
ContractFileModel model = personList.get(i);
|
|
|
|
|
dataRowMap.put("contractCode", model.getContractCode());
|
|
|
|
|
dataRowMap.put("contractName", model.getContractName());
|
|
|
|
|
dataRowMap.put("contractNo", model.getContractNo());
|
|
|
|
|
dataRowMap.put("contractType", model.getContractType());
|
|
|
|
|
dataRowMap.put("classification", model.getClassification());
|
|
|
|
|
dataRowMap.put("declarationDate", model.getDeclarationDate());
|
|
|
|
|
dataRowMap.put("name", model.getName());
|
|
|
|
|
dataRowMap.put("num", model.getNum());
|
|
|
|
|
dataRowMap.put("amount", model.getAmount());
|
|
|
|
|
dataRowMap.put("deptName", model.getDeptName());
|
|
|
|
|
dataRowMap.put("remark", model.getRemark());
|
|
|
|
|
dataRowMap.put("creatorusername", model.getCreatorusername());
|
|
|
|
|
dataRowMap.put("status", model.getStatus());
|
|
|
|
|
dataRowMap.put("approval", model.getApproval());
|
|
|
|
|
dataRow.add(dataRowMap);
|
|
|
|
|
}
|
|
|
|
|
for (int i = 1; i < 15; 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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//导入
|
|
|
|
|
@Override
|
|
|
|
|
public ContractfileImportVO importData(List<ContractFileModel> dt) {
|
|
|
|
|
for (ContractFileModel model : dt) {
|
|
|
|
|
model.setCreatorTime(DateUtil.cstFormat(model.getCreatorTime()));
|
|
|
|
|
model.setNum(DateUtil.cstFormat(model.getNum()));
|
|
|
|
|
if (model.getContractType() != null) {
|
|
|
|
|
if (model.getContractType().equals("采购合同")) {
|
|
|
|
|
model.setContractType("0");
|
|
|
|
|
} else if (model.getContractType().equals("销售合同")) {
|
|
|
|
|
model.setContractType("1");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (model.getClassification() != null) {
|
|
|
|
|
if (model.getClassification().equals("采购类")) {
|
|
|
|
|
model.setClassification("0");
|
|
|
|
|
} else if (model.getClassification().equals("销售类")) {
|
|
|
|
|
model.setClassification("1");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (model.getStatus() != null) {
|
|
|
|
|
if (model.getStatus().equals("合同进行中")) {
|
|
|
|
|
model.setStatus("0");
|
|
|
|
|
} else if (model.getStatus().equals("合同审批中")) {
|
|
|
|
|
model.setStatus("1");
|
|
|
|
|
} else if (model.getStatus().equals("合同审批结束")) {
|
|
|
|
|
model.setStatus("2");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
List<ContractFileEntity> entitys = JsonUtil.getJsonToList(dt, ContractFileEntity.class);
|
|
|
|
|
//记录成功了几条
|
|
|
|
|
int sum = 0;
|
|
|
|
|
//记录第几条失败
|
|
|
|
|
int num = 0;
|
|
|
|
|
List<ContractFileEntity> errList = new ArrayList<>();
|
|
|
|
|
for (ContractFileEntity entity : entitys) {
|
|
|
|
|
entity.setId(RandomUtil.uuId());
|
|
|
|
|
entity.setCreatoruserid(userProvider.get().getUserId());
|
|
|
|
|
entity.setCreatortime(new Date());
|
|
|
|
|
try {
|
|
|
|
|
this.baseMapper.insert(entity);
|
|
|
|
|
sum++;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
errList.add(entity);
|
|
|
|
|
num++;
|
|
|
|
|
log.error("导入第" + (num + 1) + "条数据失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
ContractfileImportVO vo = new ContractfileImportVO();
|
|
|
|
|
vo.setSnum(sum);
|
|
|
|
|
vo.setFnum(num);
|
|
|
|
|
if (vo.getFnum() > 0) {
|
|
|
|
|
vo.setResultType(1);
|
|
|
|
|
vo.setFailResult(JsonUtil.getJsonToList(errList, ContractFileModel.class));
|
|
|
|
|
return vo;
|
|
|
|
|
} else {
|
|
|
|
|
vo.setResultType(0);
|
|
|
|
|
return vo;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void delete(ContractFileEntity entity) {
|
|
|
|
|
if (entity != null) {
|
|
|
|
|
this.removeById(entity.getId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//子表方法
|
|
|
|
|
@Override
|
|
|
|
|
public List<Contract_item0Entity> GetContract_item0List(String id) {
|
|
|
|
@ -280,6 +409,7 @@ public class ContractFileServiceImpl extends ServiceImpl<ContractFileMapper, Con
|
|
|
|
|
queryWrapper.lambda().eq(Contract_item0Entity::getContractId, id);
|
|
|
|
|
return contract_item0Service.list(queryWrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Contract_item1Entity> GetContract_item1List(String id) {
|
|
|
|
|
QueryWrapper<Contract_item1Entity> queryWrapper = new QueryWrapper<>();
|
|
|
|
@ -290,4 +420,42 @@ public class ContractFileServiceImpl extends ServiceImpl<ContractFileMapper, Con
|
|
|
|
|
//列表子表数据方法
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getKey(String key) {
|
|
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
|
|
map.put("工号", "F_EnCode");
|
|
|
|
|
map.put("姓名", "F_FullName");
|
|
|
|
|
map.put("性别", "F_Gender");
|
|
|
|
|
map.put("部门", "F_DepartmentName");
|
|
|
|
|
map.put("岗位", "F_PositionName");
|
|
|
|
|
map.put("用工性质", "F_WorkingNature");
|
|
|
|
|
map.put("身份证号", "F_IDNumber");
|
|
|
|
|
map.put("联系电话", "F_Telephone");
|
|
|
|
|
map.put("出生年月", "F_Birthday");
|
|
|
|
|
map.put("参加工作", "F_AttendWorkTime");
|
|
|
|
|
map.put("最高学历", "F_Education");
|
|
|
|
|
map.put("所学专业", "F_Major");
|
|
|
|
|
map.put("毕业院校", "F_GraduationAcademy");
|
|
|
|
|
map.put("毕业时间", "F_GraduationTime");
|
|
|
|
|
return map.get(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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, "备注");
|
|
|
|
|
map.put(12, "录入人");
|
|
|
|
|
map.put(13, "单据状态");
|
|
|
|
|
map.put(14, "集团审批");
|
|
|
|
|
return map.get(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|