Compare commits
3 Commits
78bdc7a20d
...
3c2d7115cd
| Author | SHA1 | Date |
|---|---|---|
|
|
3c2d7115cd | |
|
|
60d3a19984 | |
|
|
4db714fa4c |
|
|
@ -35,6 +35,8 @@ import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static cn.hutool.poi.excel.cell.CellUtil.getCellValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Excel相关处理
|
* Excel相关处理
|
||||||
*
|
*
|
||||||
|
|
@ -178,6 +180,11 @@ public class ExcelUtil<T>
|
||||||
return importExcel(StringUtils.EMPTY, is, titleNum);
|
return importExcel(StringUtils.EMPTY, is, titleNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<T> importExcelDoubleTitle(InputStream is, int titleNum) throws Exception
|
||||||
|
{
|
||||||
|
return importExcelDoubleTitle(StringUtils.EMPTY, is, titleNum);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对excel表单默认第一个索引名转换成list
|
* 对excel表单默认第一个索引名转换成list
|
||||||
*
|
*
|
||||||
|
|
@ -364,6 +371,187 @@ public class ExcelUtil<T>
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<T> importExcelDoubleTitle(String sheetName, InputStream is, int titleNum) throws Exception
|
||||||
|
{
|
||||||
|
this.type = Type.IMPORT;
|
||||||
|
this.wb = WorkbookFactory.create(is);
|
||||||
|
List<T> list = new ArrayList<T>();
|
||||||
|
// 如果指定sheet名,则取指定sheet中的内容 否则默认指向第1个sheet
|
||||||
|
Sheet sheet = StringUtils.isNotEmpty(sheetName) ? wb.getSheet(sheetName) : wb.getSheetAt(0);
|
||||||
|
if (sheet == null)
|
||||||
|
{
|
||||||
|
throw new IOException("文件sheet不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取最后一个非空行的行下标,比如总行数为n,则返回的为n-1
|
||||||
|
int rows = sheet.getLastRowNum();
|
||||||
|
while (rows > 0) {
|
||||||
|
Row currentRow = sheet.getRow(rows);
|
||||||
|
if (isRowEmpty(currentRow)) {
|
||||||
|
rows--; // 如果是空行则回退到上一行
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rows++;
|
||||||
|
|
||||||
|
if (rows > 0)
|
||||||
|
{
|
||||||
|
int headerRows = 2;
|
||||||
|
Map<String, Integer> cellMap = new LinkedHashMap<>();
|
||||||
|
for (int col = 0; col < sheet.getRow(titleNum).getLastCellNum(); col++) {
|
||||||
|
StringBuilder headerBuilder = new StringBuilder();
|
||||||
|
for (int row = 0; row < headerRows; row++) {
|
||||||
|
Row currentRow = sheet.getRow(titleNum + row);
|
||||||
|
if (currentRow != null) {
|
||||||
|
String cellValue = getCellValue(currentRow, col).toString().trim();
|
||||||
|
if (!cellValue.isEmpty()) {
|
||||||
|
if (headerBuilder.length() > 0) {
|
||||||
|
headerBuilder.append(".");
|
||||||
|
}
|
||||||
|
headerBuilder.append(cellValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cellMap.put(headerBuilder.toString(), col);
|
||||||
|
}
|
||||||
|
// 有数据时才处理 得到类的所有field.
|
||||||
|
List<Object[]> fields = this.getFields();
|
||||||
|
Map<Integer, Object[]> fieldsMap = new HashMap<Integer, Object[]>();
|
||||||
|
for (Object[] objects : fields)
|
||||||
|
{
|
||||||
|
Excel attr = (Excel) objects[1];
|
||||||
|
Integer column = cellMap.get(attr.name());
|
||||||
|
if (column != null)
|
||||||
|
{
|
||||||
|
fieldsMap.put(column, objects);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = titleNum + headerRows; i <= rows; i++)
|
||||||
|
{
|
||||||
|
// 从第2行开始取数据,默认第一行是表头.
|
||||||
|
Row row = sheet.getRow(i);
|
||||||
|
// 判断当前行是否是空行
|
||||||
|
if (isRowEmpty(row))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
T entity = null;
|
||||||
|
for (Map.Entry<Integer, Object[]> entry : fieldsMap.entrySet())
|
||||||
|
{
|
||||||
|
Object val = this.getCellValue(row, entry.getKey());
|
||||||
|
|
||||||
|
// 如果不存在实例则新建.
|
||||||
|
entity = (entity == null ? clazz.newInstance() : entity);
|
||||||
|
// 从map中得到对应列的field.
|
||||||
|
Field field = (Field) entry.getValue()[0];
|
||||||
|
Excel attr = (Excel) entry.getValue()[1];
|
||||||
|
// 取得类型,并根据对象类型设置值.
|
||||||
|
Class<?> fieldType = field.getType();
|
||||||
|
if (String.class == fieldType)
|
||||||
|
{
|
||||||
|
String s = Convert.toStr(val);
|
||||||
|
if (StringUtils.endsWith(s, ".0"))
|
||||||
|
{
|
||||||
|
val = StringUtils.substringBefore(s, ".0");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String dateFormat = field.getAnnotation(Excel.class).dateFormat();
|
||||||
|
if (StringUtils.isNotEmpty(dateFormat))
|
||||||
|
{
|
||||||
|
val = parseDateToStr(dateFormat, val);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
val = Convert.toStr(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val)))
|
||||||
|
{
|
||||||
|
val = Convert.toInt(val);
|
||||||
|
}
|
||||||
|
else if ((Long.TYPE == fieldType || Long.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val)))
|
||||||
|
{
|
||||||
|
val = Convert.toLong(val);
|
||||||
|
}
|
||||||
|
else if (Double.TYPE == fieldType || Double.class == fieldType)
|
||||||
|
{
|
||||||
|
val = Convert.toDouble(val);
|
||||||
|
}
|
||||||
|
else if (Float.TYPE == fieldType || Float.class == fieldType)
|
||||||
|
{
|
||||||
|
val = Convert.toFloat(val);
|
||||||
|
}
|
||||||
|
else if (BigDecimal.class == fieldType)
|
||||||
|
{
|
||||||
|
val = Convert.toBigDecimal(val);
|
||||||
|
}
|
||||||
|
else if (Date.class == fieldType)
|
||||||
|
{
|
||||||
|
if (val instanceof String)
|
||||||
|
{
|
||||||
|
val = DateUtils.parseDate(val);
|
||||||
|
}
|
||||||
|
else if (val instanceof Double)
|
||||||
|
{
|
||||||
|
val = DateUtil.getJavaDate((Double) val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (Boolean.TYPE == fieldType || Boolean.class == fieldType)
|
||||||
|
{
|
||||||
|
val = Convert.toBool(val, false);
|
||||||
|
}
|
||||||
|
//是否必填
|
||||||
|
boolean required = attr.required();
|
||||||
|
//是否必须符合电话号码的规则
|
||||||
|
String isRegex = attr.isRegex();
|
||||||
|
if (StringUtils.isNotNull(fieldType))
|
||||||
|
{
|
||||||
|
String propertyName = field.getName();
|
||||||
|
if (StringUtils.isNotEmpty(attr.targetAttr()))
|
||||||
|
{
|
||||||
|
propertyName = field.getName() + "." + attr.targetAttr();
|
||||||
|
}
|
||||||
|
else if(required) {
|
||||||
|
if(StringUtils.isNull(val) || StringUtils.isEmpty(val.toString().trim())) {
|
||||||
|
throw new IllegalArgumentException(attr.name()+" 单元格必填项未填写,请正确填写!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(StringUtils.isNotEmpty(isRegex)) {
|
||||||
|
if(StringUtils.isNull(val) || StringUtils.isEmpty(val.toString().trim())) {
|
||||||
|
throw new IllegalArgumentException(attr.name()+" 单元格必填项未填写,请正确填写!");
|
||||||
|
}else{
|
||||||
|
boolean b = changeDataType(isRegex, val.toString().trim());
|
||||||
|
if(!b) {
|
||||||
|
throw new IllegalArgumentException(attr.name()+" 单元格必需填写正确的格式!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (StringUtils.isNotEmpty(attr.readConverterExp()))
|
||||||
|
{
|
||||||
|
val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator());
|
||||||
|
}
|
||||||
|
else if (!attr.handler().equals(ExcelHandlerAdapter.class))
|
||||||
|
{
|
||||||
|
val = dataFormatHandlerAdapter(val, attr);
|
||||||
|
}
|
||||||
|
ReflectUtils.invokeSetter(entity, propertyName, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.add(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对excel表单指定表格索引名转换成list---
|
* 对excel表单指定表格索引名转换成list---
|
||||||
|
|
@ -689,8 +877,7 @@ public class ExcelUtil<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据Excel注解创建表格头样式
|
* 根据Excel注解创建表格头样式*
|
||||||
*
|
|
||||||
* @param wb 工作薄对象
|
* @param wb 工作薄对象
|
||||||
* @return 自定义样式列表
|
* @return 自定义样式列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -724,7 +911,6 @@ public class ExcelUtil<T>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据Excel注解创建表格列样式
|
* 根据Excel注解创建表格列样式
|
||||||
*
|
|
||||||
* @param wb 工作薄对象
|
* @param wb 工作薄对象
|
||||||
* @return 自定义样式列表
|
* @return 自定义样式列表
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.bmw.person.controller;
|
package com.bonus.bmw.person.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.bonus.bmw.person.entity.BasePersonBean;
|
import com.bonus.bmw.person.entity.BasePersonBean;
|
||||||
import com.bonus.bmw.person.service.BasePersonService;
|
import com.bonus.bmw.person.service.BasePersonService;
|
||||||
|
|
@ -9,11 +10,19 @@ import com.bonus.common.core.table.PageTableResponse;
|
||||||
import com.bonus.common.log.annotation.Log;
|
import com.bonus.common.log.annotation.Log;
|
||||||
import com.bonus.common.log.enums.BusinessType;
|
import com.bonus.common.log.enums.BusinessType;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人员库
|
* 人员库
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import com.bonus.bmw.basic.entity.ProjectBean;
|
import com.bonus.bmw.basic.entity.ProjectBean;
|
||||||
|
import com.bonus.bmw.basic.entity.ProjectFileBean;
|
||||||
import com.bonus.bmw.basic.service.UserService;
|
import com.bonus.bmw.basic.service.UserService;
|
||||||
import com.bonus.bmw.config.IpAndPathConfig;
|
import com.bonus.bmw.config.IpAndPathConfig;
|
||||||
import com.bonus.bmw.person.entity.PersonComprehensiveBean;
|
import com.bonus.bmw.person.entity.PersonComprehensiveBean;
|
||||||
|
|
@ -13,6 +14,7 @@ import com.bonus.bmw.person.utils.FaceResult;
|
||||||
import com.bonus.common.core.domain.R;
|
import com.bonus.common.core.domain.R;
|
||||||
import com.bonus.common.core.table.PageTableRequest;
|
import com.bonus.common.core.table.PageTableRequest;
|
||||||
import com.bonus.common.core.table.PageTableResponse;
|
import com.bonus.common.core.table.PageTableResponse;
|
||||||
|
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||||
import com.bonus.common.log.annotation.Log;
|
import com.bonus.common.log.annotation.Log;
|
||||||
import com.bonus.common.log.enums.BusinessType;
|
import com.bonus.common.log.enums.BusinessType;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
|
|
@ -342,6 +344,11 @@ public class PersonComprehensiveController {
|
||||||
return service.getWorkerRosterProList(request);
|
return service.getWorkerRosterProList(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/exportBtnOut")
|
||||||
|
public void exportBtnOut(HttpServletResponse response, PageTableRequest request) {
|
||||||
|
service.exportBtnOut(response,request.getParams());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// @Log(title = "农民工花名册-根据工程id获取", businessType = BusinessType.SELECT)
|
// @Log(title = "农民工花名册-根据工程id获取", businessType = BusinessType.SELECT)
|
||||||
// @GetMapping("/getWorkerRosterProList")
|
// @GetMapping("/getWorkerRosterProList")
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,8 @@ public interface PersonComprehensiveDao {
|
||||||
|
|
||||||
PersonComprehensiveBean selectTeamHistoryData(PersonComprehensiveBean o);
|
PersonComprehensiveBean selectTeamHistoryData(PersonComprehensiveBean o);
|
||||||
|
|
||||||
|
List<PersonComprehensiveBean> getBasePersonLists(@Param("params")Map<String, Object> params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据工程查组织
|
* 根据工程查组织
|
||||||
* @param proId
|
* @param proId
|
||||||
|
|
|
||||||
|
|
@ -21,13 +21,13 @@ public class BasePersonBean {
|
||||||
/**
|
/**
|
||||||
* 姓名
|
* 姓名
|
||||||
*/
|
*/
|
||||||
@Excel(name = "姓名 * ",required = true)
|
@Excel(name = "身份证信息.*姓 名",required = true)
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 身份证
|
* 身份证
|
||||||
*/
|
*/
|
||||||
@Excel(name = "身份证号 * ", isRegex = RegexConstants.IDCARD)
|
@Excel(name = "*身份证号", isRegex = RegexConstants.IDCARD)
|
||||||
private String idNumber;
|
private String idNumber;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -38,66 +38,67 @@ public class BasePersonBean {
|
||||||
/**
|
/**
|
||||||
* 性别
|
* 性别
|
||||||
*/
|
*/
|
||||||
@Excel(name = "性别 * ",required = true)
|
// @Excel(name = "性别 * ",required = true)
|
||||||
private String sex;
|
private String sex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 民族
|
* 民族
|
||||||
*/
|
*/
|
||||||
@Excel(name = "民族 * ",required = true)
|
@Excel(name = "*民族",required = true)
|
||||||
private String ethnic;
|
private String ethnic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 出生日期
|
* 出生日期
|
||||||
*/
|
*/
|
||||||
@Excel(name = "出生日期 * ",required = true)
|
// @Excel(name = "出生日期 * ",required = true)
|
||||||
private String birthday;
|
private String birthday;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 家庭地址
|
* 家庭地址
|
||||||
*/
|
*/
|
||||||
@Excel(name = "身份证住址 * ",required = true)
|
@Excel(name = "*身份证住址",required = true)
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 办证机关
|
* 办证机关
|
||||||
*/
|
*/
|
||||||
@Excel(name = "签发机关 * ",required = true)
|
@Excel(name = "*签发机关",required = true)
|
||||||
private String issueauthority;
|
private String issueauthority;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 有效开始日期
|
* 有效开始日期
|
||||||
*/
|
*/
|
||||||
@Excel(name = "有效期限 * ",required = true)
|
@Excel(name = "*身份证生效日期",required = true)
|
||||||
private String signDate;
|
private String signDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 有效结束日期
|
* 有效结束日期
|
||||||
*/
|
*/
|
||||||
|
@Excel(name = "*身份证失效日期",required = true)
|
||||||
private String expiryDate;
|
private String expiryDate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 联系方式
|
* 联系方式
|
||||||
*/
|
*/
|
||||||
@Excel(name = "手机号码 * ", isRegex = RegexConstants.PHONE )
|
@Excel(name = "*手机号码", isRegex = RegexConstants.PHONE )
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文化程度
|
* 文化程度
|
||||||
*/
|
*/
|
||||||
@Excel(name = "文化程度")
|
// @Excel(name = "文化程度")
|
||||||
private String cultrue;
|
private String cultrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 政治面貌
|
* 政治面貌
|
||||||
*/
|
*/
|
||||||
@Excel(name = "政治面貌")
|
// @Excel(name = "政治面貌")
|
||||||
private String politicalOutlook;
|
private String politicalOutlook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 家庭电话
|
* 家庭电话
|
||||||
*/
|
*/
|
||||||
@Excel(name = "家庭电话")
|
// @Excel(name = "家庭电话")
|
||||||
private String addressPhone;
|
private String addressPhone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -108,43 +109,43 @@ public class BasePersonBean {
|
||||||
/**
|
/**
|
||||||
* 工种名称
|
* 工种名称
|
||||||
*/
|
*/
|
||||||
@Excel(name = "工人工种 * ",required = true)
|
// @Excel(name = "工人工种 * ",required = true)
|
||||||
private String postName;
|
private String postName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人员类型
|
* 人员类型
|
||||||
*/
|
*/
|
||||||
@Excel(name = "人员类型")
|
// @Excel(name = "人员类型")
|
||||||
private String personType;
|
private String personType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 工人技能
|
* 工人技能
|
||||||
*/
|
*/
|
||||||
@Excel(name = "工人技能")
|
// @Excel(name = "工人技能")
|
||||||
private String workerSkill;
|
private String workerSkill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重要人员
|
* 重要人员
|
||||||
*/
|
*/
|
||||||
@Excel(name = "重要人员")
|
// @Excel(name = "重要人员")
|
||||||
private String importantPerson;
|
private String importantPerson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 紧急联系人
|
* 紧急联系人
|
||||||
*/
|
*/
|
||||||
@Excel(name = "紧急联系人")
|
@Excel(name = "亲属.*紧急联系人")
|
||||||
private String urgentPerson;
|
private String urgentPerson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 紧急联系人电话
|
* 紧急联系人电话
|
||||||
*/
|
*/
|
||||||
@Excel(name = "紧急联系人电话")
|
@Excel(name = "*紧急联系人电话")
|
||||||
private String urgentPersonPhone;
|
private String urgentPersonPhone;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 银行名称
|
* 银行名称
|
||||||
*/
|
*/
|
||||||
@Excel(name = "银行名称")
|
@Excel(name = "银行卡.银行名称")
|
||||||
private String bankName;
|
private String bankName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -153,6 +154,9 @@ public class BasePersonBean {
|
||||||
@Excel(name = "银行卡号")
|
@Excel(name = "银行卡号")
|
||||||
private String bankCard;
|
private String bankCard;
|
||||||
|
|
||||||
|
@Excel(name = "银行卡号(选填)")
|
||||||
|
private String bankInter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 年龄
|
* 年龄
|
||||||
*/
|
*/
|
||||||
|
|
@ -250,7 +254,7 @@ public class BasePersonBean {
|
||||||
|
|
||||||
private List<BasePersonBean> idNumberList;
|
private List<BasePersonBean> idNumberList;
|
||||||
|
|
||||||
@Excel(name = "务工类型 * ",required = true)
|
// @Excel(name = "务工类型 * ",required = true)
|
||||||
private String employmentTypes;//关键信息 务工类型
|
private String employmentTypes;//关键信息 务工类型
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import com.bonus.common.core.table.PageTableResponse;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人员库-业务层
|
* 人员库-业务层
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package com.bonus.bmw.person.service;
|
package com.bonus.bmw.person.service;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelWriter;
|
||||||
import com.bonus.bmw.person.dao.BasePersonDao;
|
import com.bonus.bmw.person.dao.BasePersonDao;
|
||||||
import com.bonus.bmw.person.dao.TDictDao;
|
import com.bonus.bmw.person.dao.TDictDao;
|
||||||
import com.bonus.bmw.person.entity.BasePersonBean;
|
import com.bonus.bmw.person.entity.BasePersonBean;
|
||||||
|
|
@ -18,7 +20,11 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
@ -91,10 +97,15 @@ public class BasePersonServiceImp implements BasePersonService{
|
||||||
public R insertBasePersonData(MultipartFile file) throws Exception{
|
public R insertBasePersonData(MultipartFile file) throws Exception{
|
||||||
int insertBasicCount = 0;
|
int insertBasicCount = 0;
|
||||||
ExcelUtil<BasePersonBean> util = new ExcelUtil<BasePersonBean>(BasePersonBean.class);
|
ExcelUtil<BasePersonBean> util = new ExcelUtil<BasePersonBean>(BasePersonBean.class);
|
||||||
List<BasePersonBean> list = util.importExcel(file.getInputStream(),2);
|
List<BasePersonBean> list = util.importExcelDoubleTitle(file.getInputStream(),2);
|
||||||
if(list.size() != 0){
|
if(list.size() != 0){
|
||||||
list = listThread(list);
|
list = listThread(list);
|
||||||
insertBasicCount = dao.insertBasePersonBasicData(list);
|
insertBasicCount = dao.insertBasePersonBasicData(list);
|
||||||
|
boolean hasBankData = list.stream()
|
||||||
|
.anyMatch(p -> !StringUtils.isEmpty(p.getBankCard()));
|
||||||
|
if(insertBasicCount>0 && hasBankData){
|
||||||
|
dao.insertBasePersonBankData(list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return insertBasicCount > 0 ?
|
return insertBasicCount > 0 ?
|
||||||
R.ok(Constants.INSERT_SUCCESS)
|
R.ok(Constants.INSERT_SUCCESS)
|
||||||
|
|
@ -203,46 +214,58 @@ public class BasePersonServiceImp implements BasePersonService{
|
||||||
SimpleDateFormat originalFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", java.util.Locale.US);
|
SimpleDateFormat originalFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", java.util.Locale.US);
|
||||||
list.forEach(c->{
|
list.forEach(c->{
|
||||||
TrimUtil.trimBean(c);
|
TrimUtil.trimBean(c);
|
||||||
if(StringUtils.isNotEmpty(c.getSignDate()) && c.getSignDate().contains("-")){
|
// if(StringUtils.isNotEmpty(c.getSignDate()) && c.getSignDate().contains("/")){
|
||||||
String signDate = StringUtils.getThreeBarVal(c.getSignDate(),1);
|
// String signDate = StringUtils.getThreeBarVal(c.getSignDate(),1);
|
||||||
String expiryDate = StringUtils.getThreeBarVal(c.getSignDate(),2);
|
// String expiryDate = StringUtils.getThreeBarVal(c.getSignDate(),2);
|
||||||
c.setSignDate(signDate);
|
// c.setSignDate(signDate);
|
||||||
c.setExpiryDate(expiryDate);
|
// c.setExpiryDate(expiryDate);
|
||||||
}
|
// }
|
||||||
try {
|
try {
|
||||||
Date date = originalFormat.parse(c.getBirthday());
|
Map<String, String> resultMap = StringUtils.getBirthdayAgeSex(c.getIdNumber());
|
||||||
|
Date sDate = originalFormat.parse(c.getSignDate());
|
||||||
|
Date eDate = originalFormat.parse(c.getExpiryDate());
|
||||||
// 转换为LocalDate
|
// 转换为LocalDate
|
||||||
LocalDate localDate = date.toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDate();
|
LocalDate sLocalDate = sDate.toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDate();
|
||||||
|
LocalDate eLocalDate = eDate.toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDate();
|
||||||
// 格式化输出为"yyyy-MM-dd"
|
// 格式化输出为"yyyy-MM-dd"
|
||||||
String formattedDate = localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
String sFormattedDate = sLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
c.setBirthday(formattedDate);
|
String eFormattedDate = eLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
|
c.setSignDate(sFormattedDate);
|
||||||
|
c.setExpiryDate(eFormattedDate);
|
||||||
|
c.setBirthday(resultMap.get("birthday"));
|
||||||
|
if(Objects.equals(resultMap.get("sex"), "1")){
|
||||||
|
c.setSex("男");
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
c.setSex("女");
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
//岗位
|
// //岗位
|
||||||
AtomicInteger x = new AtomicInteger();
|
// AtomicInteger x = new AtomicInteger();
|
||||||
dictBeanList.forEach(i -> {
|
// dictBeanList.forEach(i -> {
|
||||||
if(c.getPostName().equals(i.getValue())){
|
// if(c.getPostName().equals(i.getValue())){
|
||||||
c.setPostId(i.getId());
|
// c.setPostId(i.getId());
|
||||||
x.getAndIncrement();
|
// x.getAndIncrement();
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
if(x.intValue()==0){
|
// if(x.intValue()==0){
|
||||||
throw new IllegalArgumentException(c.getPostName()+" 工种无法正确匹配,请正确填写!");
|
// throw new IllegalArgumentException(c.getPostName()+" 工种无法正确匹配,请正确填写!");
|
||||||
}
|
// }
|
||||||
String u = dao.getExistPerson(c.getIdNumber());
|
// String u = dao.getExistPerson(c.getIdNumber());
|
||||||
String b = dao.getBlackPerson(c.getIdNumber());
|
// String b = dao.getBlackPerson(c.getIdNumber());
|
||||||
if (u != null || b != null) {
|
// if (u != null || b != null) {
|
||||||
throw new IllegalArgumentException(c.getIdNumber() + "已存在或为黑名单");
|
// throw new IllegalArgumentException(c.getIdNumber() + "已存在或为黑名单");
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if(c.getEmploymentTypes().equals("本地务工(兰坪)")){
|
// if(c.getEmploymentTypes().equals("本地务工(兰坪)")){
|
||||||
c.setEmploymentTypes("0");
|
// c.setEmploymentTypes("0");
|
||||||
}else if(c.getEmploymentTypes().equals("外地务工")){
|
// }else if(c.getEmploymentTypes().equals("外地务工")){
|
||||||
c.setEmploymentTypes("1");
|
// c.setEmploymentTypes("1");
|
||||||
}else{
|
// }else{
|
||||||
throw new IllegalArgumentException(c.getEmploymentTypes()+"务工类型无法正确匹配,请正确填写!");
|
// throw new IllegalArgumentException(c.getEmploymentTypes()+"务工类型无法正确匹配,请正确填写!");
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,14 @@
|
||||||
package com.bonus.bmw.person.service;
|
package com.bonus.bmw.person.service;
|
||||||
|
|
||||||
|
import com.bonus.bmw.basic.entity.ProjectFileBean;
|
||||||
import com.bonus.bmw.person.entity.PersonComprehensiveBean;
|
import com.bonus.bmw.person.entity.PersonComprehensiveBean;
|
||||||
import com.bonus.common.core.domain.R;
|
import com.bonus.common.core.domain.R;
|
||||||
import com.bonus.common.core.table.PageTableRequest;
|
import com.bonus.common.core.table.PageTableRequest;
|
||||||
import com.bonus.common.core.table.PageTableResponse;
|
import com.bonus.common.core.table.PageTableResponse;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人员库-业务层
|
* 人员库-业务层
|
||||||
|
|
@ -54,4 +57,8 @@ public interface PersonComprehensiveService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
PageTableResponse getWorkerRosterProList(PageTableRequest request);
|
PageTableResponse getWorkerRosterProList(PageTableRequest request);
|
||||||
|
|
||||||
|
// List<PersonComprehensiveBean> exportBtnOut(PersonComprehensiveBean bean);
|
||||||
|
|
||||||
|
void exportBtnOut(HttpServletResponse response, Map<String, Object> params);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
package com.bonus.bmw.person.service;
|
package com.bonus.bmw.person.service;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelWriter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import com.bonus.bmw.attendanceMachine.dao.AttendanceMachineDao;
|
import com.bonus.bmw.attendanceMachine.dao.AttendanceMachineDao;
|
||||||
import com.bonus.bmw.basic.dao.UserDao;
|
import com.bonus.bmw.basic.dao.UserDao;
|
||||||
|
import com.bonus.bmw.basic.entity.ProjectFileBean;
|
||||||
import com.bonus.bmw.person.dao.BasePersonDao;
|
import com.bonus.bmw.person.dao.BasePersonDao;
|
||||||
import com.bonus.bmw.person.dao.PersonComprehensiveDao;
|
import com.bonus.bmw.person.dao.PersonComprehensiveDao;
|
||||||
import com.bonus.bmw.person.dao.TDictDao;
|
import com.bonus.bmw.person.dao.TDictDao;
|
||||||
|
|
@ -25,8 +29,14 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人员库-业务层
|
* 人员库-业务层
|
||||||
|
|
@ -660,4 +670,146 @@ public class PersonComprehensiveServiceImp implements PersonComprehensiveService
|
||||||
});
|
});
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
@Override
|
||||||
|
public void exportBtnOut(HttpServletResponse response, Map<String, Object> params) {
|
||||||
|
|
||||||
|
List<PersonComprehensiveBean> list = getBasePersonLists(params);
|
||||||
|
//根据工程计算出合并单元格的数量
|
||||||
|
Map<String, Long> collect = list.stream().collect(Collectors.groupingBy(PersonComprehensiveBean::getName, Collectors.counting()));
|
||||||
|
List<Long> integerList = new ArrayList<>();
|
||||||
|
collect.forEach((k, v) -> integerList.add(v));
|
||||||
|
|
||||||
|
int rowNum = list.size();
|
||||||
|
String fileName = "人员入场信息";
|
||||||
|
//记录用于合并的rowIndex
|
||||||
|
ArrayList<HashMap<String, Integer>> mergeRows = new ArrayList<>();
|
||||||
|
int startRowIndex = 3, start = 0;
|
||||||
|
start = startRowIndex;
|
||||||
|
int end = 0;
|
||||||
|
for (int i = 0; i < integerList.size(); i++) {
|
||||||
|
end = (int) (start + integerList.get(i)) - 1;
|
||||||
|
if (end != start) {
|
||||||
|
HashMap<String, Integer> map = new HashMap<>();
|
||||||
|
map.put("start", start);
|
||||||
|
map.put("end", end);
|
||||||
|
mergeRows.add(map);
|
||||||
|
}
|
||||||
|
start = end + 1;
|
||||||
|
}
|
||||||
|
// 导出标题
|
||||||
|
ExcelWriter writer = cn.hutool.poi.excel.ExcelUtil.getWriter(true);
|
||||||
|
if (list.size() > 0) {
|
||||||
|
writer.merge(9, fileName, false);
|
||||||
|
writer.writeCellValue(0, 1, "序号");
|
||||||
|
writer.setColumnWidth(0, 6);
|
||||||
|
|
||||||
|
writer.writeCellValue(1, 1, "姓名");
|
||||||
|
writer.setColumnWidth(1, 20);
|
||||||
|
|
||||||
|
writer.writeCellValue(2, 1, "身份证");
|
||||||
|
writer.setColumnWidth(2, 20);
|
||||||
|
|
||||||
|
writer.writeCellValue(3, 1, "联系方式");
|
||||||
|
writer.setColumnWidth(3, 15);
|
||||||
|
|
||||||
|
|
||||||
|
writer.writeCellValue(4, 1, "工种");
|
||||||
|
writer.setColumnWidth(4, 10);
|
||||||
|
|
||||||
|
writer.writeCellValue(5, 1, "所属工程");
|
||||||
|
writer.setColumnWidth(5, 15);
|
||||||
|
|
||||||
|
writer.writeCellValue(6, 1, "人员类型");
|
||||||
|
writer.setColumnWidth(6, 15);
|
||||||
|
|
||||||
|
writer.writeCellValue(7, 1, "红绿灯状态");
|
||||||
|
writer.setColumnWidth(7, 20);
|
||||||
|
|
||||||
|
writer.writeCellValue(8, 1, "出入场状态");
|
||||||
|
writer.setColumnWidth(8, 20);
|
||||||
|
|
||||||
|
writer.writeCellValue(9, 1, "体检状态");
|
||||||
|
writer.setColumnWidth(9, 20);
|
||||||
|
|
||||||
|
// 设置表头高度、单元格宽度
|
||||||
|
writer.setRowHeight(0, 25);
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
writer.writeCellValue(0, 2 + i, i + 1);
|
||||||
|
writer.writeCellValue(1, 2 + i, list.get(i).getName() == null ? "" : list.get(i).getName());
|
||||||
|
writer.writeCellValue(2, 2 + i, list.get(i).getIdNumber() == null ? "" : list.get(i).getIdNumber());
|
||||||
|
writer.writeCellValue(3, 2 + i, list.get(i).getPhone() == null ? "" : list.get(i).getPhone());
|
||||||
|
writer.writeCellValue(4, 2 + i, list.get(i).getPostName() == null ? "" : list.get(i).getPostName());
|
||||||
|
writer.writeCellValue(5, 2 + i, list.get(i).getProName() == null ? "" : list.get(i).getProName());
|
||||||
|
writer.writeCellValue(6, 2 + i, list.get(i).getEmploymentType() == null ? "" : list.get(i).getEmploymentType());
|
||||||
|
writer.writeCellValue(7, 2 + i, list.get(i).getLightStatus() == null ? "" : list.get(i).getLightStatus());
|
||||||
|
writer.writeCellValue(8, 2 + i, list.get(i).getExitStatus() == null ? "" : list.get(i).getExitStatus());
|
||||||
|
writer.writeCellValue(9, 2 + i, list.get(i).getCheckupState() == null ? "" : list.get(i).getCheckupState());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
writer.merge(9, fileName, false);
|
||||||
|
writer.writeCellValue(0, 1, "序号");
|
||||||
|
writer.setColumnWidth(0, 6);
|
||||||
|
|
||||||
|
writer.writeCellValue(1, 1, "姓名");
|
||||||
|
writer.setColumnWidth(1, 20);
|
||||||
|
|
||||||
|
writer.writeCellValue(2, 1, "身份证");
|
||||||
|
writer.setColumnWidth(2, 20);
|
||||||
|
|
||||||
|
writer.writeCellValue(3, 1, "联系方式");
|
||||||
|
writer.setColumnWidth(3, 15);
|
||||||
|
|
||||||
|
|
||||||
|
writer.writeCellValue(4, 1, "工种");
|
||||||
|
writer.setColumnWidth(4, 10);
|
||||||
|
|
||||||
|
writer.writeCellValue(5, 1, "所属工程");
|
||||||
|
writer.setColumnWidth(5, 15);
|
||||||
|
|
||||||
|
writer.writeCellValue(6, 1, "人员类型");
|
||||||
|
writer.setColumnWidth(6, 15);
|
||||||
|
|
||||||
|
writer.writeCellValue(7, 1, "红绿灯状态");
|
||||||
|
writer.setColumnWidth(7, 20);
|
||||||
|
|
||||||
|
writer.writeCellValue(8, 1, "出入场状态");
|
||||||
|
writer.setColumnWidth(8, 20);
|
||||||
|
|
||||||
|
writer.writeCellValue(9, 1, "体检状态");
|
||||||
|
writer.setColumnWidth(9, 20);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
writer.merge(2, 2, 0, 9, "无数据", false);
|
||||||
|
}
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||||
|
try {
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".xlsx");
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
ServletOutputStream out = null;
|
||||||
|
try {
|
||||||
|
out = response.getOutputStream();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
writer.flush(out, true);
|
||||||
|
writer.close();
|
||||||
|
IoUtil.close(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<PersonComprehensiveBean> getBasePersonLists (Map < String, Object > params){
|
||||||
|
List<PersonComprehensiveBean> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
list = dao.getBasePersonLists(params);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ public class PersonSettingServiceImpl implements PersonSettingService {
|
||||||
public R importData(MultipartFile file, String teamId, String subId) throws Exception {
|
public R importData(MultipartFile file, String teamId, String subId) throws Exception {
|
||||||
ExcelUtil<TeamPersonBean> util = new ExcelUtil<>(TeamPersonBean.class);
|
ExcelUtil<TeamPersonBean> util = new ExcelUtil<>(TeamPersonBean.class);
|
||||||
//读取文件到list
|
//读取文件到list
|
||||||
List<TeamPersonBean> list = util.importExcel(file.getInputStream(),0);
|
List<TeamPersonBean> list = util.importExcelDoubleTitle(file.getInputStream(),0);
|
||||||
//
|
//
|
||||||
StringBuffer stringBuffer = new StringBuffer();
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
list.forEach(i -> {
|
list.forEach(i -> {
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,10 @@
|
||||||
|
|
||||||
<insert id="insertBasePersonBankData">
|
<insert id="insertBasePersonBankData">
|
||||||
replace into bm_worker_bank
|
replace into bm_worker_bank
|
||||||
(`id_number`, `bank_card`, `bank_name`)
|
(`id_number`, `bank_card`, `bank_name`,`bank_inter`)
|
||||||
values
|
values
|
||||||
<foreach item="params" collection="list" separator=",">
|
<foreach item="params" collection="list" separator=",">
|
||||||
(#{params.idNumber},#{params.bankCard},#{params.bankName})
|
(#{params.idNumber},#{params.bankCard},#{params.bankName},#{params.bankInter})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -902,5 +902,60 @@
|
||||||
GROUP BY t.id_number
|
GROUP BY t.id_number
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getBasePersonLists" resultType="com.bonus.bmw.person.entity.PersonComprehensiveBean">
|
||||||
|
select
|
||||||
|
bw.name as name,bw.id_number as idNumber,bw.phone as phone,
|
||||||
|
td.value as postName,bp.name as proName,bw.is_furlough_person as isFurloughPerson,
|
||||||
|
CASE
|
||||||
|
bw.employment_type
|
||||||
|
WHEN '0' THEN
|
||||||
|
'固定用工'
|
||||||
|
WHEN '1' THEN
|
||||||
|
'临时用工'
|
||||||
|
WHEN '2' THEN
|
||||||
|
'分包管理人员'
|
||||||
|
END employmentType,
|
||||||
|
CASE
|
||||||
|
bw.light_status
|
||||||
|
WHEN '0' THEN
|
||||||
|
'红灯'
|
||||||
|
WHEN '1' THEN
|
||||||
|
'黄灯'
|
||||||
|
WHEN '2' THEN
|
||||||
|
'绿灯'
|
||||||
|
END lightStatus,
|
||||||
|
CASE
|
||||||
|
WHEN bw.ein_status = '-1' AND bw.is_furlough_person = '0' THEN
|
||||||
|
'未出场'
|
||||||
|
WHEN bw.ein_status = '-1' AND bw.is_furlough_person = '1' THEN
|
||||||
|
'临时离场'
|
||||||
|
WHEN bw.ein_status = '1' THEN
|
||||||
|
'出场审核通过'
|
||||||
|
WHEN bw.ein_status = '0' THEN
|
||||||
|
'出场未审核'
|
||||||
|
WHEN bw.ein_status = '2' THEN
|
||||||
|
'出场审核不通过'
|
||||||
|
ELSE
|
||||||
|
'未入场'
|
||||||
|
END AS exitStatus,
|
||||||
|
bw.checkup_date as checkupDate,
|
||||||
|
checkup.PHOTO_PATH as checkupFilePath,
|
||||||
|
CASE
|
||||||
|
WHEN STR_TO_DATE(bw.checkup_date, '%Y-%m-%d') < DATE_SUB(CURDATE(), INTERVAL 1 YEAR) THEN '过期'
|
||||||
|
ELSE '有效'
|
||||||
|
END AS checkupState
|
||||||
|
from bm_worker bw
|
||||||
|
LEFT JOIN t_dict td ON td.id = bw.post_id
|
||||||
|
AND td.is_active = '1'
|
||||||
|
LEFT JOIN bm_worker_ein_history bweh ON bweh.id_number = bw.id_number
|
||||||
|
and bweh.is_active = '1'
|
||||||
|
LEFT JOIN bm_project bp ON bp.id = bweh.project_id
|
||||||
|
AND bp.is_active = '1'
|
||||||
|
LEFT JOIN bm_worker_checkup checkup ON checkup.ID_NUMBER = bw.id_number
|
||||||
|
AND checkup.IS_ACTIVE = '1'
|
||||||
|
where bw.is_active='1'
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -68,18 +68,19 @@
|
||||||
<button id="importBt" class="layui-btn layui-btn-sm"
|
<button id="importBt" class="layui-btn layui-btn-sm"
|
||||||
onclick="importData()">导入</button>
|
onclick="importData()">导入</button>
|
||||||
</div>
|
</div>
|
||||||
<a class="layui-btn layui-btn-sm"
|
<!-- <a class="layui-btn layui-btn-sm"-->
|
||||||
href="../../../../downloads/人员库_导入模板.xlsx" download="人员库_导入模板.xlsx" style="margin-top:0.5%">
|
<!-- href="../../../../downloads/人员库_导入模板.xlsx" download="人员库_导入模板.xlsx" style="margin-top:0.5%">-->
|
||||||
<i class="layui-icon"></i> 模板下载
|
<!-- <i class="layui-icon"></i> 模板下载-->
|
||||||
</a>
|
<!-- </a>-->
|
||||||
|
|
||||||
<button class="layui-btn layui-btn-sm"
|
<!-- <button class="layui-btn layui-btn-sm"-->
|
||||||
onclick="checkup()" style="margin-top:0.5%">批量导出体检报告
|
<!-- onclick="checkup()" style="margin-top:0.5%">批量导出体检报告-->
|
||||||
</button>
|
<!-- </button>-->
|
||||||
<a class="layui-btn layui-btn-sm"
|
<a class="layui-btn layui-btn-sm"
|
||||||
href="../../../../downloads/农民工实名制导入模版.xlsx" download="农民工实名制导入模板.xlsx" style="margin-top:0.5%">
|
href="../../../../downloads/农民工实名制导入模版.xlsx" download="农民工实名制导入模板.xlsx" style="margin-top:0.5%">
|
||||||
<i class="layui-icon"></i> 农民工实名制模板下载
|
<i class="layui-icon"></i> 模板下载
|
||||||
</a>
|
</a>
|
||||||
|
<button id="exportBt" onclick="exportPersonnelOnSite()" class="layui-btn layui-btn-sm" style="margin-top:0.5%"><i class="layui-icon"></i>导出</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
||||||
|
|
@ -486,3 +486,45 @@ function checkViewEn(idNumber) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//导出excel表格
|
||||||
|
function exportPersonnelOnSite() {
|
||||||
|
var name = $("#mame").val();
|
||||||
|
var idNumber = $("#idNumber").val();
|
||||||
|
var phone = $("#phone").val();
|
||||||
|
var postName = $("#postName").val();
|
||||||
|
var proName = $("#proName").val();
|
||||||
|
var employmentType = $("#employmentType").val();
|
||||||
|
var lightStatus = $("#lightStatus").val();
|
||||||
|
var exitStatus = $("#exitStatus").val();
|
||||||
|
var checkupState = $("#checkupState").val();
|
||||||
|
|
||||||
|
window.location.href = ctxPath + "/personComprehensive/exportBtnOut?token=" + token
|
||||||
|
+ "&name=" + name
|
||||||
|
+ "&idNumber=" + idNumber
|
||||||
|
+ "&phone=" + phone
|
||||||
|
+ "&postName=" + postName
|
||||||
|
+ "&proName=" + proName
|
||||||
|
+ "&employmentType=" + employmentType
|
||||||
|
+ "&lightStatus=" + lightStatus
|
||||||
|
+ "&exitStatus=" + exitStatus
|
||||||
|
+ "&checkupState=" + checkupState;
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("get", url, true);
|
||||||
|
xhr.responseType = "blob"; // 转换流
|
||||||
|
xhr.onload = function () {
|
||||||
|
layer.close(loadingMsg);
|
||||||
|
if (this.status === 200) {
|
||||||
|
var blob = this.response;
|
||||||
|
var a = document.createElement("a");
|
||||||
|
var url = window.URL.createObjectURL(blob);
|
||||||
|
a.href = url;
|
||||||
|
a.download = "入场人员信息.xlsx"; // 文件名
|
||||||
|
}else {
|
||||||
|
layer.msg('发生异常,请稍后重试', {icon: 16, scrollbar: false, time: 2000});
|
||||||
|
}
|
||||||
|
a.click()
|
||||||
|
window.URL.revokeObjectURL(url)
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue