Commit 2d7a254b authored by 王琮's avatar 王琮

修改员工新模板

parent 270f7ef8
......@@ -4,6 +4,14 @@ import lombok.Data;
@Data
public class ExcelDTO {
// 职位
// 性别
private String[] sex;
// 班次
private String[] shift;
// 部门
private String[] deptName;
// 园区
private String[] yq;
// 职位
private String[] zw;
}
......@@ -12,8 +12,6 @@ import org.rcisoft.sys.sysuser.entity.SysUser;
public class ExportUserDTO extends CyIdIncreEntity<SysUser> {
@JSONField(serialize = false)
// @ApiModelProperty(name = "username", value = "登录名", required = true, dataType = "varchar")
// @Excel(name = "登录名", orderNum = "1", width = 15.0)
private String username;
@JSONField(serialize = false)
......@@ -33,7 +31,6 @@ public class ExportUserDTO extends CyIdIncreEntity<SysUser> {
@JSONField(serialize = false)
@ApiModelProperty(name = "faceAddress", value = "人脸信息(可能第三方图片数据)", required = true, dataType = "varchar")
@Excel(name = "人脸信息", orderNum = "1", width = 15.0)
private String faceAddress;
@JSONField(serialize = false)
......@@ -58,12 +55,8 @@ public class ExportUserDTO extends CyIdIncreEntity<SysUser> {
@JSONField(serialize = false)
@ApiModelProperty(name = "flag", value = "工作状态", required = true, dataType = "varchar")
@Excel(name = "工作状态", orderNum = "1", width = 15.0)
private String flag;
// // 用户类型(0内部员工 1外部访客)
// @Excel(name = "用户类型(0内部员工 1外部访客)", orderNum = "2", width = 20)
private String userType;
private String identity;
......
......@@ -5,17 +5,9 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import org.rcisoft.core.entity.CyIdIncreEntity;
import org.springframework.data.annotation.Transient;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
......@@ -109,12 +101,6 @@ public class SysUser extends CyIdIncreEntity<SysUser> {
// @Excel(name = "登录名", orderNum = "0", width = 20)
private String username;
// /**
// * 捷顺用户ID
// */
// private String personId;
/**
* @desc 用户昵称
* @column nick_name
......@@ -319,7 +305,6 @@ public class SysUser extends CyIdIncreEntity<SysUser> {
* @default
* @default
*/
// @Excel(name = "人脸信息", orderNum = "23", width = 20)
private String faceAddress;
// 管理员状态(0停,1起)
......@@ -343,6 +328,7 @@ public class SysUser extends CyIdIncreEntity<SysUser> {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(exist = false)
private Date firstDateQueryStart;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(exist = false)
......@@ -359,6 +345,7 @@ public class SysUser extends CyIdIncreEntity<SysUser> {
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(exist = false)
private Date lastDateQueryStart;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableField(exist = false)
......
......@@ -10,8 +10,12 @@ import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.integration.jieLink.service.impl.JieLinkServiceImpl;
import org.rcisoft.sys.constant.CyDictCons;
import org.rcisoft.sys.dictionary.dao.DictDataRepository;
import org.rcisoft.sys.dictionary.entity.DictData;
import org.rcisoft.sys.dictionary.service.DictionaryService;
import org.rcisoft.sys.rbac.dept.dao.SysDeptRbacRepository;
import org.rcisoft.sys.rbac.dept.dto.SysDeptRbacDTO;
import org.rcisoft.sys.rbac.dept.entity.SysDeptRbac;
import org.rcisoft.sys.rbac.user.dto.ImportUserDTO;
import org.rcisoft.sys.sysuser.dao.SysDeptRepositorys;
import org.rcisoft.sys.sysuser.dao.SysDictDataRepositorys;
......@@ -62,6 +66,10 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
@Autowired
private DictionaryService dictionaryService;
@Autowired
private DictDataRepository dictDataRepository;
@Autowired
private SysDeptRbacRepository sysDeptRbacRepository;
@Autowired
private JieLinkServiceImpl jieLinkService;
@Autowired
private CyDownErrorTxtComp errorTxt;
......@@ -423,13 +431,33 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
}
// 导出模板需要的下拉列的值
ExcelDTO excelDto = new ExcelDTO();
SysDictData sysDictData = new SysDictData();
sysDictData.setDictType("shift");
sysDictData.setNormal();
List<SysDictData> shiftList = sysDictDataRepositorys.querySysDictDatas(sysDictData);
String[] shift = shiftList.stream().map(SysDictData::getDictLabel).collect(Collectors.toList())
String dictTypes = "shift,HomePark,position";
List<DictData> dictDataList = dictDataRepository.selectDictDatasByTypeAll(dictTypes);
List<DictData> shiftList = dictDataList.stream().filter(d -> d.getDictType().equals("shift") && d.getFlag().equals("1"))
.collect(Collectors.toList());
String[] shift = shiftList.stream().map(DictData::getDictLabel).collect(Collectors.toList())
.toArray(new String[shiftList.size()]);
excelDto.setShift(shift);
List<DictData> homeParkList = dictDataList.stream().filter(d -> d.getDictType().equals("HomePark") && d.getFlag().equals("1"))
.collect(Collectors.toList());
String[] homePark = homeParkList.stream().map(DictData::getDictLabel).collect(Collectors.toList())
.toArray(new String[homeParkList.size()]);
excelDto.setYq(homePark);
List<DictData> positionList = dictDataList.stream().filter(d -> d.getDictType().equals("position") && d.getFlag().equals("1"))
.collect(Collectors.toList());
String[] position = positionList.stream().map(DictData::getDictLabel).collect(Collectors.toList())
.toArray(new String[positionList.size()]);
excelDto.setZw(position);
String[] sex = {"男", "女"};
excelDto.setSex(sex);
// 获取所有启用未删除部门
SysDeptRbacDTO sysDeptDTO = new SysDeptRbacDTO();
sysDeptDTO.setDelFlag("0");
sysDeptDTO.setFlag("1");
List<SysDeptRbac> deptRbacList = sysDeptRbacRepository.querySysDepts(sysDeptDTO);
String[] deptName = deptRbacList.stream().map(SysDeptRbac::getDeptName).collect(Collectors.toList())
.toArray(new String[deptRbacList.size()]);
excelDto.setDeptName(deptName);
CyEpExcelUtil.exportExcelSelect(imOutSysUsers, "用户信息", "用户",
ExportUserDTO.class, "模板.xls", response, excelDto);
return 1;
......@@ -458,7 +486,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
try {
flag = CyEpExcelUtil.isFileInUser(file, exportUserDTO, 2);
} catch (Exception e) {
// throw new CyServiceException(CyResSvcExcEnum.ERROR_NETWORK);
throw new CyServiceException(1111, "非模板文件");
}
if (!flag) {
......@@ -538,10 +565,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserRepositorys, SysUser>
if (sysUser.getPhone() == null) {
throw new CyServiceException(500, "用户手机号码不能为空");
}
//人脸信息
// if (sysUser.getFaceAddress() == null) {
// throw new CyServiceException(500, "数据错误");
// }
//所属园区
if (sysUser.getAddress() == null) {
throw new CyServiceException(500, "所属园区不能为空");
......
......@@ -180,12 +180,21 @@ public class CyEpExcelUtil {
private static void defaultExportSelect(List<?> list, Class<?> pojoClass, String fileName, HttpServletResponse response, ExportParams exportParams, ExcelDTO excelDto) {
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, list);
/* CellRangeAddress c = CellRangeAddress.valueOf("H3:H3");
workbook.getSheetAt(0).setAutoFilter(c);*/
//岗位
if (excelDto != null && null != excelDto.getSex() && excelDto.getSex().length > 0) {
CyEpExcelUtil.selectList(workbook, 3, 510, 1, 1, excelDto.getSex());
}
if (excelDto != null && null != excelDto.getDeptName() && excelDto.getDeptName().length > 0) {
CyEpExcelUtil.selectList(workbook, 3, 510, 4, 4, excelDto.getDeptName());
}
if (excelDto != null && null != excelDto.getYq() && excelDto.getYq().length > 0) {
CyEpExcelUtil.selectList(workbook, 3, 510, 3, 3, excelDto.getYq());
}
if (excelDto != null && null != excelDto.getZw() && excelDto.getZw().length > 0) {
CyEpExcelUtil.selectList(workbook, 3, 510, 5, 5, excelDto.getZw());
}
// 班次
if (excelDto != null && null != excelDto.getShift() && excelDto.getShift().length > 0) {
CyEpExcelUtil.selectList(workbook, 3, 510, 7, 7, excelDto.getShift());
CyEpExcelUtil.selectList(workbook, 3, 510, 6, 6, excelDto.getShift());
}
if (workbook != null) {
downLoadExcel(fileName, response, workbook);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment