Commit af064acd authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/develop' into develop

parents 9c61a15d 3ebb9f7f
......@@ -26,6 +26,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
import java.util.Date;
/**
* 证明开具记录表
......@@ -94,14 +95,14 @@ public class TCertRecord extends BaseEntity {
*/
@ExcelAttribute(name = "合同开始时间" )
@Schema(description ="合同开始时间")
private LocalDateTime contractStart;
private Date contractStart;
/**
* 合同截止时间
*/
@ExcelAttribute(name = "合同截止时间" )
@Schema(description ="合同截止时间")
private LocalDateTime contractEnd;
private Date contractEnd;
/**
* 开具当天时间
......@@ -129,7 +130,7 @@ public class TCertRecord extends BaseEntity {
*/
@ExcelAttribute(name = "离职时间" )
@Schema(description ="离职时间")
private LocalDateTime leaveTime;
private Date leaveTime;
/**
* 派减原因
......@@ -150,14 +151,14 @@ public class TCertRecord extends BaseEntity {
*/
@ExcelAttribute(name = "入职时间(来我单位时间)" )
@Schema(description ="入职时间(来我单位时间)")
private LocalDateTime entryTime;
private Date entryTime;
/**
* 签订合同时间-第一次
*/
@ExcelAttribute(name = "签订合同时间-第一次" )
@Schema(description ="签订合同时间-第一次")
private LocalDateTime firstContractTime;
private Date firstContractTime;
/**
* 开具人
......@@ -171,7 +172,7 @@ public class TCertRecord extends BaseEntity {
*/
@ExcelAttribute(name = "开具时间" )
@Schema(description ="开具时间")
private LocalDateTime openTime;
private Date openTime;
/**
* 介绍单位
......@@ -185,7 +186,7 @@ public class TCertRecord extends BaseEntity {
*/
@ExcelAttribute(name = "参保时间" )
@Schema(description ="参保时间")
private LocalDateTime socialTime;
private Date socialTime;
}
......@@ -129,5 +129,6 @@ public class TEmpBadRecord extends BaseEntity {
* @Date 14:53 2022/6/21
**/
@TableField(exist = false)
@ExcelIgnore
private String attaIds;
}
......@@ -17,13 +17,14 @@
package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.Max;
import java.time.LocalDate;
import java.util.Date;
/**
* 员工学历信息表
......@@ -74,8 +75,9 @@ public class TEmpEducation extends BaseEntity {
/**
* 入学时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "入学时间")
private LocalDate entryDate;
private Date entryDate;
/**
* 学历名称
......@@ -87,8 +89,9 @@ public class TEmpEducation extends BaseEntity {
/**
* 结业日期
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd")
@Schema(description = "结业日期")
private LocalDate gradutionDate;
private Date gradutionDate;
/**
* 学校名称
......
......@@ -21,4 +21,14 @@ public class EmpBadRecordSearchVo extends TEmpBadRecord {
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
/**
* @Author fxj
* 查询数据起
**/
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
private int limitEnd;
}
......@@ -37,6 +37,9 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -87,6 +90,21 @@ public class TEmpBadRecordController {
@GetMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('demo_tempbadrecord_get')" )
public R<TEmpBadRecord> getById(@PathVariable("id" ) String id) {
/* TEmpBadRecord record;
List<TEmpBadRecord> list = new ArrayList<>();
for (int i=200000;i<500000;i++){
record = new TEmpBadRecord();
record.setEmpId("1");
record.setEmpName("2");
record.setEmpIdcard("323333333333");
record.setHappenTime(new Date());
record.setLoseFee(BigDecimal.ONE);
record.setId(String.valueOf(i));
record.setProject("test");
record.setProjectCode("test");
list.add(record);
}
tEmpBadRecordService.saveBatch(list);*/
return R.ok(tEmpBadRecordService.getById(id));
}
......
......@@ -66,7 +66,7 @@ public class TEmployeeProjectController {
@Operation(summary = "根据人员档案id获取项目list", description = "根据人员档案id获取项目list")
@GetMapping("/getListByEmpId" )
public R<List<TEmployeeProject>> getListByEmpId(@RequestParam String empId) {
return R.ok(tEmployeeProjectService.getListByEmpId(empId, CommonConstants.ZERO_INT));
return R.ok(tEmployeeProjectService.getListByEmpId(empId, CommonConstants.ONE_INT));
}
/**
......
......@@ -31,7 +31,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpBadRecord;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpWorkRecording;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TAttaInfoMapper;
......@@ -39,7 +38,8 @@ import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpBadRecordMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpBadRecordService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpBadRecordSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpBadRecordVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
......@@ -208,27 +208,49 @@ public class TEmpBadRecordServiceImpl extends ServiceImpl<TEmpBadRecordMapper, T
String fileName = "不良记录批量导出" + LocalDateTime.now() + ".xlsx";
//获取要导出的列表
List<TEmpBadRecord> list = new ArrayList<>();
//获取记录
list = noPageDiy(searchVo);
if (Common.isNotNull(list)){
ExcelUtil<TEmpBadRecord> util = new ExcelUtil<>(TEmpBadRecord.class);
for (TEmpBadRecord vo:list){
util.convertEntity(vo,null,null,null);
}
}
long count = noPageCountDiy(searchVo);
ServletOutputStream out = null;
try {
if (list.size()>0) {
out = response.getOutputStream();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode(fileName , "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
out.flush();
out = response.getOutputStream();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename*=utf-8'zh_cn'" + URLEncoder.encode(fileName , "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
//EasyExcel.write(out, TEmpBadRecord.class).sheet("不良记录").doWrite(list);
ExcelWriter excelWriter = EasyExcel.write(out, TEmpBadRecord.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
for (int i = 0; i <= count; ) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = noPageDiy(searchVo);
if (Common.isNotNull(list)){
ExcelUtil<TEmpBadRecord> util = new ExcelUtil<>(TEmpBadRecord.class);
for (TEmpBadRecord vo:list){
util.convertEntity(vo,null,null,null);
}
}
if (Common.isNotNull(list)){
WriteSheet writeSheet = EasyExcel.writerSheet("不良记录"+index).build();
excelWriter.write(list,writeSheet);
index++;
i = i + CommonConstants.EXCEL_EXPORT_LIMIT;
}
if (Common.isNotNull(list)){
list.clear();
}
}
excelWriter.finish();
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("不良记录"+index).build();
excelWriter.write(list,writeSheet);
excelWriter.finish();
}
if (Common.isNotNull(list)){
list.clear();
}
out.flush();
}catch (Exception e){
log.error("执行异常" ,e);
}finally {
......@@ -256,8 +278,21 @@ public class TEmpBadRecordServiceImpl extends ServiceImpl<TEmpBadRecordMapper, T
if (Common.isNotNull(idList)){
wrapper.in(TEmpBadRecord::getId,idList);
}
if (tEmpBadRecord.getLimitStart() >= 0 && tEmpBadRecord.getLimitEnd() >= 0){
wrapper.last(" limit "+ tEmpBadRecord.getLimitStart() +","+ tEmpBadRecord.getLimitEnd());
}
return baseMapper.selectList(wrapper);
}
private Long noPageCountDiy(EmpBadRecordSearchVo tEmpBadRecord) {
LambdaQueryWrapper<TEmpBadRecord> wrapper = buildQueryWrapper(tEmpBadRecord);
List<String> idList = Common.getList(tEmpBadRecord.getIds());
if (Common.isNotNull(idList)){
wrapper.in(TEmpBadRecord::getId,idList);
}
return baseMapper.selectCount(wrapper);
}
private LambdaQueryWrapper buildQueryWrapper(EmpBadRecordSearchVo entity){
LambdaQueryWrapper<TEmpBadRecord> wrapper = Wrappers.lambdaQuery();
if (ArrayUtil.isNotEmpty(entity.getCreateTimes())) {
......
......@@ -75,12 +75,12 @@ public class TEmpChangeInfoServiceImpl extends ServiceImpl<TEmpChangeInfoMapper,
//划转,更新项目信息
TEmployeeProject updateTEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, tEmpChangeInfo.getEmpIdcard()).eq(TEmployeeProject::getDeptName,tEmpChangeInfo.getOldSettle())
.eq(TEmployeeProject::getEmpIdcard, tEmpChangeInfo.getEmpIdcard()).eq(TEmployeeProject::getDeptNo,tEmpChangeInfo.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.STATUS_NORMAL));
if (Common.isNotNull(updateTEmployeeProject)) {
updateTEmployeeProject.setDeptNo(tEmpChangeInfo.getDeptNo());
updateTEmployeeProject.setDeptId(tEmpChangeInfo.getDeptId());
updateTEmployeeProject.setDeptName(tEmpChangeInfo.getNewDept());
updateTEmployeeProject.setDeptName(tEmpChangeInfo.getNewSettle());
updateTEmployeeProject.setUnitId(tEmpChangeInfo.getUnitId());
updateTEmployeeProject.setUnitNo(tEmpChangeInfo.getUnitNo());
updateTEmployeeProject.setUnitName(tEmpChangeInfo.getNewDept());
......
......@@ -1370,8 +1370,8 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
education.setHighIdentification(CommonConstants.ZERO_STRING);
education.setSchool(employeeInfo.getSchool());
education.setMajor(employeeInfo.getMajor());
education.setEntryDate(employeeInfo.getAdmissionDate());
education.setGradutionDate(employeeInfo.getGradutionDate());
education.setEntryDate(LocalDateTimeUtils.convertLDToDate(employeeInfo.getAdmissionDate()));
education.setGradutionDate(LocalDateTimeUtils.convertLDToDate(employeeInfo.getGradutionDate()));
tEmpEducationService.insertEducationOfEmp(education);
}
......
......@@ -150,6 +150,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
String empNO = getEmpNo(tEmployeeProject.getDeptNo());
tEmployeeProject.setEmpNo(empNO);
tEmployeeProject.setEmpId(tEmployeeInfo.getId());
tEmployeeProject.setProjectSource(CommonConstants.dingleDigitStrArray[5]);
this.save(tEmployeeProject);
return R.ok();
}
......@@ -531,6 +532,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
YifuUser user = SecurityUtils.getUser();
insTEmployeePro.setCreateBy(user.getId());
insTEmployeePro.setCreateName(user.getNickname());
insTEmployeePro.setProjectSource(CommonConstants.dingleDigitStrArray[5]);
proInsList.add(insTEmployeePro);
}
......@@ -683,6 +685,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeProject.setEmpName(employeeInfo.getEmpName());
tEmployeeProject.setEmpIdcard(employeeInfo.getEmpIdcard());
tEmployeeProject.setPost(employeeInfo.getPost());
tEmployeeProject.setProjectSource(CommonConstants.dingleDigitStrArray[4]);
String empNO = getEmpNo(employeeInfo.getDeptNo());
tEmployeeProject.setEmpNo(empNO);
......
......@@ -256,4 +256,5 @@ public interface CommonConstants {
String CREATE_TIME = "create_time";
String ID = "ID";
String PARAM_IS_NOT_ERROR = "传参异常,请检查参数";
int EXCEL_EXPORT_LIMIT = 60000;
}
......@@ -230,6 +230,7 @@ public class ExcelUtil <T> implements Serializable {
if (field == null) {
continue;
}
tempStr=null;
// 设置实体类私有属性可访问
field.setAccessible(true);
attr = field.getAnnotation(ExcelAttribute.class);
......
......@@ -47,7 +47,16 @@ public class LocalDateTimeUtils {
}
return null;
}
public static LocalDateTime convertLocalDateToLDT(LocalDate date) {
return LocalDateTime.ofInstant(date.atStartOfDay(ZoneOffset.ofHours(8)).toInstant(), ZoneId.systemDefault());
}
public static Date convertLDToDate(LocalDate time) {
if (null != time){
return Date.from(time.atStartOfDay(ZoneOffset.ofHours(8)).toInstant());
}
return null;
}
//获取指定日期的毫秒
public static Long getMilliByTime(LocalDateTime time) {
......
......@@ -77,10 +77,11 @@
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-core</artifactId>
</dependency>
<!-- easyExcel -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.0.5</version>
<version>3.1.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
......
package com.yifu.cloud.plus.v1.yifu.common.mybatis.base;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
......@@ -27,6 +28,7 @@ public class BaseEntity implements Serializable {
*/
@Schema(description = "创建人-姓名")
@TableField(fill = FieldFill.INSERT)
@ExcelProperty("创建人")
private String createName;
/**
......@@ -43,6 +45,7 @@ public class BaseEntity implements Serializable {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "创建时间")
@TableField(fill = FieldFill.INSERT)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
/**
......@@ -59,6 +62,7 @@ public class BaseEntity implements Serializable {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "更新时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
@ExcelProperty("更新时间")
private LocalDateTime updateTime;
}
......@@ -22,7 +22,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDict;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysDictItem;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysRoleMenu;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDictItemService;
import com.yifu.cloud.plus.v1.yifu.admin.service.SysDictService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
......@@ -35,16 +34,13 @@ import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <p>
......@@ -96,7 +92,7 @@ public class DictController {
*/
@GetMapping("/type/{type}")
@Cacheable(value = CacheConstants.DICT_DETAILS, key = "#type")
public R<List<SysDictItem>> getDictByType(@PathVariable String type) {
public R<List<SysDictItem>> getDictByType(@PathVariable("type") String type) {
return R.ok(sysDictItemService.list(Wrappers.<SysDictItem>query().lambda().eq(SysDictItem::getType, type)));
}
......
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