需求开发
This commit is contained in:
parent
76253664d0
commit
3f5be5d844
|
|
@ -83,6 +83,7 @@ public class TeamGroupController extends BaseController<TeamGroupBean> {
|
|||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
// 获取班组人员-综合查询
|
||||
@GetMapping("getTeamGroupPersons")
|
||||
public AjaxRes getTeamGroupPersons(TeamGroupBean teamGroupBean) {
|
||||
|
|
@ -190,8 +191,8 @@ public class TeamGroupController extends BaseController<TeamGroupBean> {
|
|||
|
||||
@RequestMapping(value = "importTeamPerson", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public AjaxRes importTeamPerson(@RequestParam("file") MultipartFile file) {
|
||||
return teamGroupService.importTeamPerson(file);
|
||||
public AjaxRes importTeamPerson(@RequestParam String id, @RequestParam("file") MultipartFile file) {
|
||||
return teamGroupService.importTeamPerson(id,file);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public interface TeamGroupService {
|
|||
|
||||
Integer delTeamPerson(TeamGroupBean teamGroupBean);
|
||||
|
||||
AjaxRes importTeamPerson(MultipartFile file);
|
||||
AjaxRes importTeamPerson(String id, MultipartFile file);
|
||||
|
||||
List<TeamGroupBean> getTeamGroupPersons(TeamGroupBean teamGroupBean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public class TeamGroupServiceImpl implements TeamGroupService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AjaxRes importTeamPerson(MultipartFile file) {
|
||||
public AjaxRes importTeamPerson(String teamId, MultipartFile file) {
|
||||
AjaxRes ar = new AjaxRes();
|
||||
List<Map<String, String>> successList = new ArrayList<>();
|
||||
|
||||
|
|
@ -133,8 +133,8 @@ public class TeamGroupServiceImpl implements TeamGroupService {
|
|||
Row row = sheet.getRow(i);
|
||||
if (row == null) continue;
|
||||
|
||||
String idCard = getCellValue(row.getCell(2));
|
||||
String phone = getCellValue(row.getCell(3));
|
||||
String idCard = getCellValue(row.getCell(1));
|
||||
String phone = getCellValue(row.getCell(2));
|
||||
if (StringUtils.isBlank(idCard)) {
|
||||
ar.setFailMsg("身份证号不能为空");
|
||||
return ar;
|
||||
|
|
@ -181,7 +181,7 @@ public class TeamGroupServiceImpl implements TeamGroupService {
|
|||
Row row = sheet.getRow(i);
|
||||
if (row == null) continue;
|
||||
|
||||
Map<String, String> rowData = processRow(row, existIdCards, existPhones);
|
||||
Map<String, String> rowData = processRow(teamId, row, existIdCards, existPhones);
|
||||
if (rowData.containsKey("error")) {
|
||||
ar.setFailMsg(rowData.get("error"));
|
||||
return ar;
|
||||
|
|
@ -213,23 +213,16 @@ public class TeamGroupServiceImpl implements TeamGroupService {
|
|||
}
|
||||
|
||||
// 处理单行数据
|
||||
private Map<String, String> processRow(Row row, Map<String, Boolean> existIdCards, Map<String, Boolean> existPhones) {
|
||||
private Map<String, String> processRow(String teamId, Row row, Map<String, Boolean> existIdCards, Map<String, Boolean> existPhones) {
|
||||
Map<String, String> rowData = new HashMap<>();
|
||||
StringBuilder errorMsg = new StringBuilder();
|
||||
|
||||
// 获取单元格值
|
||||
String teamName = getCellValue(row.getCell(0));
|
||||
String name = getCellValue(row.getCell(1));
|
||||
String idCard = getCellValue(row.getCell(2));
|
||||
String phone = getCellValue(row.getCell(3));
|
||||
String sex = getCellValue(row.getCell(4));
|
||||
String workType = getCellValue(row.getCell(5));
|
||||
|
||||
// 校验班组名称是否存在
|
||||
Integer teamId = teamGroupDao.getIdByName(teamName);
|
||||
if (teamId == null) {
|
||||
errorMsg.append(teamName + "名称不存在; ");
|
||||
}
|
||||
String name = getCellValue(row.getCell(0));
|
||||
String idCard = getCellValue(row.getCell(1));
|
||||
String phone = getCellValue(row.getCell(2));
|
||||
String sex = getCellValue(row.getCell(3));
|
||||
String workType = getCellValue(row.getCell(4));
|
||||
|
||||
// 校验身份证
|
||||
if (idCard == null || idCard.isEmpty()) {
|
||||
|
|
@ -268,7 +261,7 @@ public class TeamGroupServiceImpl implements TeamGroupService {
|
|||
}
|
||||
|
||||
// 如果没有错误,保存数据
|
||||
rowData.put("teamId", String.valueOf(teamId));
|
||||
rowData.put("teamId", teamId);
|
||||
rowData.put("name", name);
|
||||
rowData.put("idCard", idCard);
|
||||
rowData.put("phone", phone);
|
||||
|
|
@ -281,12 +274,11 @@ public class TeamGroupServiceImpl implements TeamGroupService {
|
|||
private boolean validateHeader(Row headerRow) {
|
||||
if (headerRow == null) return false;
|
||||
|
||||
return "班组名称".equals(getCellValue(headerRow.getCell(0))) &&
|
||||
"姓名".equals(getCellValue(headerRow.getCell(1))) &&
|
||||
"身份证".equals(getCellValue(headerRow.getCell(2))) &&
|
||||
"电话".equals(getCellValue(headerRow.getCell(3))) &&
|
||||
"性别".equals(getCellValue(headerRow.getCell(4))) &&
|
||||
"工种".equals(getCellValue(headerRow.getCell(5)));
|
||||
return "姓名".equals(getCellValue(headerRow.getCell(0))) &&
|
||||
"身份证".equals(getCellValue(headerRow.getCell(1))) &&
|
||||
"电话".equals(getCellValue(headerRow.getCell(2))) &&
|
||||
"性别".equals(getCellValue(headerRow.getCell(3))) &&
|
||||
"工种".equals(getCellValue(headerRow.getCell(4)));
|
||||
}
|
||||
|
||||
private TeamGroupBean convertToTeamPerson(Map<String, String> rowData) {
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -95,7 +95,11 @@ function initTable() {
|
|||
align: "center",
|
||||
title: "人脸",
|
||||
templet: function (d) {
|
||||
if (d.faceUrl) {
|
||||
return '<a onclick="openFaceUrlPage(' + d.id + ')" style="color: #1E9FFF; cursor: pointer;"> 查看 </a>';
|
||||
}else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
{field: "isTeamLeader", align: "center", title: "是否班组长"},
|
||||
|
|
@ -280,6 +284,7 @@ function importData() {
|
|||
$("#articleImageFile").val("");
|
||||
return;
|
||||
}
|
||||
formData.append("id", id);
|
||||
formData.append("file", $("#articleImageFile")[0].files[0]);
|
||||
var idx = layer.msg('正在提交数据,请稍等...', {
|
||||
icon: 16
|
||||
|
|
|
|||
|
|
@ -124,7 +124,11 @@ function initTable() {
|
|||
align: "center",
|
||||
title: "人脸",
|
||||
templet: function (d) {
|
||||
if (d.faceUrl) {
|
||||
return '<a onclick="openFaceUrlPage(' + d.id + ')" style="color: #1E9FFF; cursor: pointer;"> 查看 </a>';
|
||||
}else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
},
|
||||
{field: "isTeamLeader", align: "center", title: "是否班组长"},
|
||||
|
|
|
|||
|
|
@ -194,29 +194,63 @@
|
|||
var tableId = 'baseTable';
|
||||
var allData = table.cache[tableId];
|
||||
console.log("allData", allData);
|
||||
|
||||
// 如果是驳回操作(type === 2),先弹出输入框获取驳回原因
|
||||
if (type === 2) {
|
||||
let content = `
|
||||
<div style="padding: 20px 100px;">
|
||||
<span style="color: red">*</span>驳回原因:
|
||||
<div style="display: inline-block; margin-left: 10px;">
|
||||
<input type="text" id="rejectReason" autocomplete="off" class="layui-input" lay-verify="required" style="width: 300px;height: 100px">
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: title,
|
||||
content: content,
|
||||
btn: ['确定', '取消'],
|
||||
yes: function (index, layero) {
|
||||
let rejectReason = $('#rejectReason').val();
|
||||
if (!rejectReason) {
|
||||
layer.msg('请输入驳回原因');
|
||||
return;
|
||||
}
|
||||
// 关闭输入框后开始处理所有行
|
||||
layer.close(index);
|
||||
// 遍历所有行,调用 auditlc 并传入统一的驳回原因
|
||||
allData.forEach(function (rowData, index) {
|
||||
// 构造一个类似单行操作时的 obj 对象
|
||||
var fakeObj = {
|
||||
data: rowData, // 当前行数据
|
||||
index: index, // 行索引
|
||||
config: {id: tableId} // 表格ID(需和你的表格一致)
|
||||
data: rowData,
|
||||
index: index,
|
||||
config: {id: tableId}
|
||||
};
|
||||
// 调用 audit(),模拟单行操作
|
||||
if (type === 1) {
|
||||
rowData.isApprove = 2;
|
||||
auditlc(fakeObj, 2, rowData, rejectReason);
|
||||
if (alter == true) {
|
||||
parent.layer.closeAll();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
} else if (type === 1) {
|
||||
// 全部通过的情况,保持不变
|
||||
allData.forEach(function (rowData, index) {
|
||||
var fakeObj = {
|
||||
data: rowData,
|
||||
index: index,
|
||||
config: {id: tableId}
|
||||
};
|
||||
|
||||
rowData.isApprove = 1;
|
||||
auditlc(fakeObj, 1, rowData);
|
||||
if (alter == true){
|
||||
parent.layer.closeAll();
|
||||
}
|
||||
} else if (type === 2) {
|
||||
rowData.isApprove = 2;
|
||||
auditlc(fakeObj, 2, rowData);
|
||||
if (alter == true){
|
||||
parent.layer.closeAll();
|
||||
}
|
||||
}
|
||||
|
||||
if (alter == true) {
|
||||
parent.layer.closeAll();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -292,7 +326,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
function auditlc(obj, type, data) {
|
||||
function auditlc(obj, type, data, rejectReason) {
|
||||
if (type === 1) {
|
||||
$.ajax({
|
||||
url: ctxPath + '/outsourcer/audit',
|
||||
|
|
@ -318,20 +352,6 @@
|
|||
}
|
||||
});
|
||||
} else {
|
||||
let content = '<div style="padding: 20px 100px;"><span style="color: red">*</span>' + title +
|
||||
'原因:<input type="text" id="rejectReason" autocomplete="off" class="layui-input" lay-verify="required" style="width: 300px;height: 100px"></div>';
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: title,
|
||||
content: content,
|
||||
async: false,
|
||||
btn: ['确定', '取消'],
|
||||
yes: function (index, layero) {
|
||||
let rejectReason = $('#rejectReason').val();
|
||||
if (!rejectReason) {
|
||||
layer.msg('请输入驳回原因');
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: ctxPath + '/outsourcer/audit',
|
||||
type: 'post',
|
||||
|
|
@ -341,25 +361,21 @@
|
|||
templateId: data.templateId,
|
||||
detailsId: data.detailsId,
|
||||
type: type,
|
||||
rejectReason: rejectReason,
|
||||
rejectReason: rejectReason, // 使用统一的原因
|
||||
evaluateType: '1'
|
||||
},
|
||||
success: function (res) {
|
||||
layer.close(index);
|
||||
if (res.res == '1') {
|
||||
layer.msg(title + '成功');
|
||||
data.isApprove = 2;
|
||||
obj.update(data);
|
||||
} else {
|
||||
code = 0;
|
||||
data.isApprove = 0;
|
||||
layer.msg(res.resMsg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getTitle(deptId) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue