|
@@ -107,22 +107,25 @@ public class RMScontroller extends BaseRESTfulController {
|
|
|
//获取Excel中包含的对象数组
|
|
//获取Excel中包含的对象数组
|
|
|
List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
|
|
List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
|
|
|
map.put("list", list);
|
|
map.put("list", list);
|
|
|
- Set<String> materialTypeSet = new HashSet<>();
|
|
|
|
|
|
|
+ Set<String> set = new HashSet<>();
|
|
|
for (Map<String, Object> item : list) {
|
|
for (Map<String, Object> item : list) {
|
|
|
//校验行
|
|
//校验行
|
|
|
if(
|
|
if(
|
|
|
item.get("名称")==null || item.get("名称").equals("")
|
|
item.get("名称")==null || item.get("名称").equals("")
|
|
|
|
|
+ || item.get("编码")==null || item.get("编码").equals("")
|
|
|
|
|
+ || item.get("NC主键")==null || item.get("NC主键").equals("")
|
|
|
){
|
|
){
|
|
|
- throw new Exception("单元格数据异常(名称),请检查模板或数据是否正确!");
|
|
|
|
|
|
|
+ throw new Exception("单元格数据异常,请检查模板或数据是否正确!");
|
|
|
}
|
|
}
|
|
|
- materialTypeSet.add(item.get("名称").toString());
|
|
|
|
|
|
|
+ set.add(item.get("NC主键").toString());
|
|
|
|
|
+ map.put(item.get("NC主键").toString(),item);
|
|
|
}
|
|
}
|
|
|
//去重
|
|
//去重
|
|
|
- String[] materialTypes = materialTypeSet.toArray(new String[0]);
|
|
|
|
|
- if (materialTypes.length != list.size()) {
|
|
|
|
|
- throw new Exception("名称不允许重复!");
|
|
|
|
|
|
|
+ String[] setList = set.toArray(new String[0]);
|
|
|
|
|
+ if (setList.length != list.size()) {
|
|
|
|
|
+ throw new Exception("NC主键不允许重复!");
|
|
|
}
|
|
}
|
|
|
- map.put("materialTypes",materialTypes);
|
|
|
|
|
|
|
+ map.put("setList",setList);
|
|
|
map.put("userId",userId);
|
|
map.put("userId",userId);
|
|
|
map.put("userName",userName);
|
|
map.put("userName",userName);
|
|
|
map.put("remark",remark);
|
|
map.put("remark",remark);
|
|
@@ -267,31 +270,31 @@ public class RMScontroller extends BaseRESTfulController {
|
|
|
String userName) throws Exception {
|
|
String userName) throws Exception {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
//获取Excel中包含的对象数组
|
|
//获取Excel中包含的对象数组
|
|
|
- List<Map<String, Object>> excelList = ExcelToolUtils.getExcelList(file, 0);
|
|
|
|
|
- map.put("list", excelList);
|
|
|
|
|
|
|
+ List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
|
|
|
|
|
+ map.put("list", list);
|
|
|
Set<String> set = new HashSet<>();
|
|
Set<String> set = new HashSet<>();
|
|
|
- for (Map<String, Object> item : excelList) {
|
|
|
|
|
|
|
+ for (Map<String, Object> item : list) {
|
|
|
//校验行
|
|
//校验行
|
|
|
if(
|
|
if(
|
|
|
- item.get("作业点名称")==null || item.get("作业点名称").equals("")
|
|
|
|
|
- || item.get("作业点类型")==null || item.get("作业点类型").equals("")
|
|
|
|
|
- || item.get("作业点状态")==null || item.get("作业点状态").equals("")
|
|
|
|
|
- || item.get("环保标准")==null || item.get("环保标准").equals("")
|
|
|
|
|
|
|
+ item.get("名称")==null || item.get("名称").equals("")
|
|
|
|
|
+ || item.get("编码")==null || item.get("编码").equals("")
|
|
|
|
|
+ || item.get("类型")==null || item.get("类型").equals("")
|
|
|
|
|
+ || item.get("NC主键")==null || item.get("NC主键").equals("")
|
|
|
|| item.get("所属单位")==null || item.get("所属单位").equals("")
|
|
|| item.get("所属单位")==null || item.get("所属单位").equals("")
|
|
|
){
|
|
){
|
|
|
- throw new Exception("单元格数据异常(作业点名称/作业点类型/作业点状态/环保标准/所属单位),请检查模板或数据是否正确!");
|
|
|
|
|
|
|
+ throw new Exception("单元格数据异常,请检查模板或数据是否正确!");
|
|
|
}
|
|
}
|
|
|
//隔开用于查询是否数据库存在
|
|
//隔开用于查询是否数据库存在
|
|
|
- set.add(item.get("作业点名称").toString());
|
|
|
|
|
|
|
+ set.add(item.get("NC主键").toString());
|
|
|
//key-value结构方便数据库去重后获取值
|
|
//key-value结构方便数据库去重后获取值
|
|
|
- map.put(item.get("作业点名称").toString(),item);
|
|
|
|
|
|
|
+ map.put(item.get("NC主键").toString(),item);
|
|
|
}
|
|
}
|
|
|
//去重
|
|
//去重
|
|
|
- String[] list = set.toArray(new String[0]);
|
|
|
|
|
- if (list.length != excelList.size()) {
|
|
|
|
|
- throw new Exception("手机号不允许重复!");
|
|
|
|
|
|
|
+ String[] setList = set.toArray(new String[0]);
|
|
|
|
|
+ if (setList.length != list.size()) {
|
|
|
|
|
+ throw new Exception("NC主键不允许重复!");
|
|
|
}
|
|
}
|
|
|
- map.put("list",list);
|
|
|
|
|
|
|
+ map.put("setList",setList);
|
|
|
map.put("userId",userId);
|
|
map.put("userId",userId);
|
|
|
map.put("userName",userName);
|
|
map.put("userName",userName);
|
|
|
return rmsFeign.importOperationPoint(map);
|
|
return rmsFeign.importOperationPoint(map);
|
|
@@ -383,23 +386,22 @@ public class RMScontroller extends BaseRESTfulController {
|
|
|
//校验行
|
|
//校验行
|
|
|
if(
|
|
if(
|
|
|
item.get("姓名")==null || item.get("姓名").equals("")
|
|
item.get("姓名")==null || item.get("姓名").equals("")
|
|
|
- || item.get("岗位")==null || item.get("岗位").equals("")
|
|
|
|
|
- || item.get("联系电话")==null || item.get("联系电话").equals("")
|
|
|
|
|
- || item.get("身份证号码")==null || item.get("身份证号码").equals("")
|
|
|
|
|
|
|
+ || item.get("身份证号")==null || item.get("身份证号").equals("")
|
|
|
|| item.get("所属单位")==null || item.get("所属单位").equals("")
|
|
|| item.get("所属单位")==null || item.get("所属单位").equals("")
|
|
|
- || item.get("授权角色")==null || item.get("授权角色").equals("")
|
|
|
|
|
|
|
+ || item.get("NC主键")==null || item.get("NC主键").equals("")
|
|
|
){
|
|
){
|
|
|
- throw new Exception("单元格数据异常(姓名/岗位/联系电话/身份证号码/所属单位/授权角色),请检查模板或数据是否正确!");
|
|
|
|
|
|
|
+ throw new Exception("单元格数据异常,请检查模板或数据是否正确!");
|
|
|
}
|
|
}
|
|
|
//隔开用于查询是否数据库存在
|
|
//隔开用于查询是否数据库存在
|
|
|
- set.add(item.get("联系电话").toString() +"-"+item.get("所属单位").toString());
|
|
|
|
|
|
|
+ set.add(item.get("NC主键").toString() + item.get("所属单位").toString());
|
|
|
|
|
+ map.put(item.get("NC主键").toString() + item.get("所属单位").toString(),item);
|
|
|
}
|
|
}
|
|
|
//去重
|
|
//去重
|
|
|
- String[] array = set.toArray(new String[0]);
|
|
|
|
|
- if (array.length != list.size()) {
|
|
|
|
|
- throw new Exception("手机号-所属单位不允许重复!");
|
|
|
|
|
|
|
+ String[] setList = set.toArray(new String[0]);
|
|
|
|
|
+ if (setList.length != list.size()) {
|
|
|
|
|
+ throw new Exception("NC主键-所属单位不允许重复!");
|
|
|
}
|
|
}
|
|
|
- map.put("list", list);
|
|
|
|
|
|
|
+ map.put("setList", setList);
|
|
|
map.put("userId",userId);
|
|
map.put("userId",userId);
|
|
|
map.put("userName",userName);
|
|
map.put("userName",userName);
|
|
|
return rmsFeign.importPersonnel(map);
|
|
return rmsFeign.importPersonnel(map);
|
|
@@ -463,6 +465,42 @@ public class RMScontroller extends BaseRESTfulController {
|
|
|
return rmsFeign.syncCompany(map);
|
|
return rmsFeign.syncCompany(map);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @ApiOperation("导入公司")
|
|
|
|
|
+ @PostMapping("/importCompany")
|
|
|
|
|
+ public RESTfulResult importCompany(@RequestBody MultipartFile file,
|
|
|
|
|
+ String remark,
|
|
|
|
|
+ String userId,
|
|
|
|
|
+ String userName) throws Exception {
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+ //获取Excel中包含的对象数组
|
|
|
|
|
+ List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
|
|
|
|
|
+ map.put("list", list);
|
|
|
|
|
+ Set<String> set = new HashSet<>();
|
|
|
|
|
+ for (Map<String, Object> item : list) {
|
|
|
|
|
+ //校验行
|
|
|
|
|
+ if(
|
|
|
|
|
+ item.get("名称")==null || item.get("名称").equals("")
|
|
|
|
|
+ || item.get("编码")==null || item.get("编码").equals("")
|
|
|
|
|
+ || item.get("类型")==null || item.get("类型").equals("")
|
|
|
|
|
+ || item.get("NC主键")==null || item.get("NC主键").equals("")
|
|
|
|
|
+ ){
|
|
|
|
|
+ throw new Exception("单元格数据异常,请检查模板或数据是否正确!");
|
|
|
|
|
+ }
|
|
|
|
|
+ set.add(item.get("NC主键").toString()+item.get("类型").toString());
|
|
|
|
|
+ map.put(item.get("NC主键").toString()+item.get("类型").toString(),item);
|
|
|
|
|
+ }
|
|
|
|
|
+ //去重
|
|
|
|
|
+ String[] setList = set.toArray(new String[0]);
|
|
|
|
|
+ if (setList.length != list.size()) {
|
|
|
|
|
+ throw new Exception("NC主键-类型不允许重复!");
|
|
|
|
|
+ }
|
|
|
|
|
+ map.put("setList",setList);
|
|
|
|
|
+ map.put("userId",userId);
|
|
|
|
|
+ map.put("userName",userName);
|
|
|
|
|
+ map.put("remark",remark);
|
|
|
|
|
+ return rmsFeign.importCompany(map);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//运力
|
|
//运力
|
|
|
@ApiOperation(value = "新增运力信息", notes = "根据rmsCapacity对象创建")
|
|
@ApiOperation(value = "新增运力信息", notes = "根据rmsCapacity对象创建")
|
|
|
@ApiImplicitParam(name = "rmsCapacity", value = "详细实体rmsCapacity", required = true, dataType = "rmsCapacity")
|
|
@ApiImplicitParam(name = "rmsCapacity", value = "详细实体rmsCapacity", required = true, dataType = "rmsCapacity")
|