审批流程

This commit is contained in:
mash 2023-02-16 17:20:12 +08:00
parent 46384229a5
commit 30e1eba3af
20 changed files with 392 additions and 312 deletions

View File

@ -1,8 +1,5 @@
package com.ydool.common.constant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* @author msh
* @version 1.0
@ -58,6 +55,37 @@ public class ArgsConst {
/**
* 选调
*/
public static final String EXCHANGE = "exchange";
/**
* 提交
*/
public static final String SUBMIT = "submit";
/**
* 通过
*/
public static final String PASS = "pass";
/**
* 拒绝
*/
public static final String REJECT = "reject";
/**
* 送审
*/
public static final String GIVE_AUDIT = "giveAudit";
/**
* 初审
*/
public static final String FIRST = "first";
/**
* 终审
*/
public static final String LAST = "last";
}

View File

@ -27,11 +27,11 @@ public class Generator {
public static void main(String[] args) {
//表名
String tableName = "t_sys_job";
String tableName = "t_lc_audit_log";
//表前缀
String tablePrefix = "t_sys_";
String tablePrefix = "t_lc_";
//作者
String author = "ljq";
String author = "msh";
generate(tableName, tablePrefix, author);
}
@ -66,7 +66,7 @@ public class Generator {
//包配置
PackageConfig pc = new PackageConfig();
pc.setParent("com.ydool.system");
pc.setParent("com.ydool.staff");
pc.setEntity("entity");
pc.setServiceImpl("service");
pc.setServiceImpl("service.impl");

View File

@ -1,108 +0,0 @@
package com.ydool.common.utils;
import com.alibaba.excel.write.handler.RowWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteTableHolder;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.util.CellRangeAddress;
/**
* @author liuhaoze
* @date 2022/5/27 14:45
*/
public class ExcelMergeRowByRowUtil implements RowWriteHandler {
private int mergeRowIndex;//从哪一行开始合并
private int[] mergeColumnIndex;//excel合并的列
private int signNum;//合并的唯一标识
private int total;//总行数
private int lastRow;
private int firstCol;
private int lastCol;
private int firstRow;
private int mergeCount =1;
public ExcelMergeRowByRowUtil(int mergeRowIndex, int[] mergeColumnIndex, int signNum, int total) {
this.mergeRowIndex = mergeRowIndex;
this.mergeColumnIndex = mergeColumnIndex;
this.signNum = signNum;
this.total = total;
}
@Override
public void beforeRowCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Integer rowIndex, Integer relativeRowIndex, Boolean isHead) {
}
@Override
public void afterRowCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Integer relativeRowIndex, Boolean isHead) {
}
@Override
public void afterRowDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Integer relativeRowIndex, Boolean isHead) {
//当前行
int curRowIndex = row.getRowNum();
//每一行的最大列数
short lastCellNum = row.getLastCellNum();
if(curRowIndex == 1){
//赋初值 第一行
firstRow = curRowIndex;
}
//开始合并位置
if(curRowIndex > mergeRowIndex && !row.getCell(0).getStringCellValue().equals("")){
for (int i = 0; i < lastCellNum; i++) {
if(i == mergeColumnIndex[i]){
//当前行号 当前行对象 合并的标识位
mergeWithPrevAnyRow(writeSheetHolder.getSheet(),curRowIndex,row,signNum);
break;//已经进入到合并单元格操作里面了执行一次就行
}
}
}
}
public void mergeWithPrevAnyRow(Sheet sheet,int curRowIndex,Row row,int signNum){
Object currentData = row.getCell(signNum).getCellTypeEnum() == CellType.STRING ? row.getCell(signNum).getStringCellValue() : row.getCell(signNum).getNumericCellValue();
Row preRow = row.getSheet().getRow(curRowIndex - 1);
Object preData = preRow.getCell(signNum).getCellTypeEnum() == CellType.STRING ? preRow.getCell(signNum).getStringCellValue() : preRow.getCell(signNum).getNumericCellValue();
//判断是否合并单元格
boolean curEqualsPre = currentData.equals(preData);
//判断前一个和后一个相同 并且 标识位相同
if (curEqualsPre){
lastRow = curRowIndex;
mergeCount++;
}
//excel过程中合并
if(!curEqualsPre && mergeCount>1){
mergeSheet(firstRow,lastRow,mergeColumnIndex,sheet);
mergeCount = 1;
}
//excel结尾处合并
if (mergeCount>1 && total==curRowIndex){
mergeSheet(firstRow,lastRow,mergeColumnIndex,sheet);
mergeCount = 1;
}
if (!curEqualsPre){
firstRow = curRowIndex;
}
}
private void mergeSheet(int firstRow, int lastRow, int[] mergeColumnIndex, Sheet sheet){
for (int colNum : mergeColumnIndex){
firstCol = colNum;
lastCol = colNum;
CellRangeAddress cellRangeAddress = new CellRangeAddress(firstRow,lastRow,firstCol,lastCol);
sheet.addMergedRegion(cellRangeAddress);
}
}
}

View File

@ -1,107 +0,0 @@
package com.ydool.common.utils;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
import com.alibaba.excel.write.metadata.style.WriteFont;
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.ydool.common.exception.ResultException;
import com.ydool.common.handler.ExcelDataValidationHandler;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.IndexedColors;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
public class ExcelUtil {
public static void export(String fileName, List<List<String>> head, String sheetName, List data) {
try {
HttpServletResponse response = HttpServletUtil.getResponse();
response.reset();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
EasyExcel.write(response.getOutputStream()).head(head).registerWriteHandler(getHorizontalCellStyleStrategy()).sheet(sheetName).doWrite(data);
}catch (Exception e) {
e.printStackTrace();
throw new ResultException("下载模板文件失败");
}
}
public static void export(String fileName, List<List<String>> head, Map<Integer, String[]> dataValidation, String sheetName, List data) {
try {
HttpServletResponse response = HttpServletUtil.getResponse();
response.reset();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
EasyExcel.write(response.getOutputStream()).head(head).registerWriteHandler(getHorizontalCellStyleStrategy()).registerWriteHandler(new ExcelDataValidationHandler(dataValidation)).sheet(sheetName).doWrite(data);
}catch (Exception e) {
e.printStackTrace();
throw new ResultException("下载模板文件失败");
}
}
public static void export(String fileName, Class head, String sheetName, List data) {
try {
HttpServletResponse response = HttpServletUtil.getResponse();
response.reset();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
EasyExcel.write(response.getOutputStream()).head(head).autoTrim(false).registerWriteHandler(getHorizontalCellStyleStrategy()).sheet(sheetName).doWrite(data);
}catch (Exception e) {
e.printStackTrace();
throw new ResultException("下载失败");
}
}
public static void export(String fileName, Class head,ExcelMergeRowByRowUtil excelMergeRowByRowStrategy, String sheetName, List data) {
try {
HttpServletResponse response = HttpServletUtil.getResponse();
response.reset();
response.setContentType("multipart/form-data");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
EasyExcel.write(response.getOutputStream()).head(head).autoTrim(false).registerWriteHandler(getHorizontalCellStyleStrategy()).registerWriteHandler(excelMergeRowByRowStrategy).sheet(sheetName).doWrite(data);
}catch (Exception e) {
e.printStackTrace();
throw new ResultException("下载失败");
}
}
public static HorizontalCellStyleStrategy getHorizontalCellStyleStrategy() {
// 头的策略
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
headWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
WriteFont headWriteFont = new WriteFont();
headWriteFont.setFontHeightInPoints((short)9);
headWriteFont.setFontName("宋体");
headWriteFont.setBold(false);//设置字体不加粗
headWriteCellStyle.setWriteFont(headWriteFont);
// 内容的策略
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
// 这里需要指定 FillPatternType 为FillPatternType.SOLID_FOREGROUND 不然无法显示背景颜色.头默认了 FillPatternType所以可以不指定
contentWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
// 背景白色
contentWriteCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
// 字体
WriteFont contentWriteFont = new WriteFont();
contentWriteFont.setFontHeightInPoints((short)9);
contentWriteFont.setFontName("宋体");
contentWriteFont.setBold(false); //设置字体不加粗
contentWriteCellStyle.setWriteFont(contentWriteFont);
//边框
contentWriteCellStyle.setBorderTop(BorderStyle.THIN);
contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);
contentWriteCellStyle.setBorderLeft(BorderStyle.THIN);
contentWriteCellStyle.setBorderRight(BorderStyle.THIN);
// 这个策略是 头是头的样式 内容是内容的样式 其他的策略可以自己实现
HorizontalCellStyleStrategy horizontalCellStyleStrategy =
new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
return horizontalCellStyleStrategy;
}
}

View File

@ -0,0 +1,51 @@
package com.ydool.staff.controller;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ydool.common.base.BaseController;
import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.service.IAuditLogService;
import com.ydool.staff.service.IAuditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @author msh
* @version 1.0
* @date 2023/2/16 14:10
*/
@RestController
@RequestMapping(UrlConstant.ALTERATION)
@Api(tags = "审批", value = "审批")
@ApiSupport(order = 12)
public class AuditController extends BaseController {
@Resource
private IAuditService auditService;
@Resource
private IAuditLogService auditLogService;
@GetMapping("getAuditList")
@ApiOperation(value = "待处理列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "current", value = "当前页"),
@ApiImplicitParam(name = "size", value = "每页条数")})
public AjaxResult getAuditList(){
return auditService.getAuditList(getPage());
}
@GetMapping("audtiLog")
@ApiOperation(value = "处理日志")
@ApiImplicitParam(name = "id",value = "员工id")
public AjaxResult audtiLog(String id){
return auditLogService.auditLog(id);
}
}

View File

@ -6,19 +6,14 @@ import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.ExchangePageDto;
import com.ydool.staff.dto.PersonnelByExchangeDto;
import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.entity.Exchange;
import com.ydool.staff.request.ExchangeRequest;
import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelRequest;
import com.ydool.staff.request.PersonnelUpdateRequest;
import com.ydool.staff.service.IExchangeService;
import com.ydool.staff.service.IPersonnelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -77,7 +72,7 @@ public class ExchangeController extends BaseController {
return personnelService.personnelByExchangeList();
}
@GetMapping("deleteExchange")
@PostMapping("deleteExchange")
@ApiOperation(value = "删除人员选调",response = PersonnelDeleteRequest.class)
public AjaxResult deleteExchange(@RequestBody PersonnelDeleteRequest ids){
return exchangeService.deleteExchangeById(ids);

View File

@ -1,15 +1,11 @@
package com.ydool.staff.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.ydool.common.base.BaseController;
import com.ydool.common.constant.UrlConstant;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.UploadUtils;
import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.dto.PersonnelUpdateDto;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.entity.SelectRequest;
import com.ydool.staff.excel.ExcelPersonnel;
import com.ydool.staff.request.ChangeRequest;
@ -18,20 +14,23 @@ import com.ydool.staff.request.PersonnelRequest;
import com.ydool.staff.request.PersonnelUpdateRequest;
import com.ydool.staff.service.IAttachmentService;
import com.ydool.staff.service.IPersonnelService;
import com.ydool.system.request.IdsRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author msh
@ -113,5 +112,15 @@ public class PersonnelController extends BaseController {
renderJson(ajaxResult);
}
@PostMapping(value = "giveAudit")
@ApiOperation(value = "送审")
@ApiImplicitParams({
@ApiImplicitParam(name = "id",value = "人员id") ,
@ApiImplicitParam(name = "type",value = "人员类型personnel人员 change变更")
})
public AjaxResult giveAudit(String id,String type){
return personnelService.giveAudit(id,type);
}
}

View File

@ -42,4 +42,9 @@ public class Alteration extends BaseEntity{
@ApiModelProperty(value = "变更类型")
private String type;
@ApiModelProperty(value = "审批id")
private String auditId;
}

View File

@ -0,0 +1,50 @@
package com.ydool.staff.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* <p>
* 送审
* </p>
*
* @author msh
* @since 2023-02-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_lc_audit")
@ApiModel(value="Audit对象", description="送审")
public class Audit extends BaseEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "人员id")
private String personnelId;
@ApiModelProperty(value = "审批类型 personnel一般人员 change变更人员")
private String perType;
@ApiModelProperty(value = "审批状态submit提交 pass通过 reject拒绝")
private String auditState;
@ApiModelProperty(value = "审批顺序giveAudit送审 first初审 last终审")
private String auditOrder;
@ApiModelProperty(value = "审批人")
private String approver;
@ApiModelProperty(value = "填报时间")
private Date approverTime;
@ApiModelProperty(value = "处理意见")
private String opinion;
}

View File

@ -0,0 +1,38 @@
package com.ydool.staff.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ydool.common.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
* 审批日志
* </p>
*
* @author msh
* @since 2023-02-16
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_lc_audit_log")
@ApiModel(value="AuditLog对象", description="审批日志")
public class AuditLog extends BaseEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "人员id")
private String personnelId;
@ApiModelProperty(value = "审批人")
private String approver;
@ApiModelProperty(value = "审批状态")
private String auditState;
@ApiModelProperty(value = "处理意见")
private String opinion;
}

View File

@ -0,0 +1,18 @@
package com.ydool.staff.mapper;
import com.ydool.staff.entity.AuditLog;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 审批日志 Mapper 接口
* </p>
*
* @author msh
* @since 2023-02-16
*/
@Mapper
public interface AuditLogMapper extends MPJBaseMapper<AuditLog> {
}

View File

@ -0,0 +1,18 @@
package com.ydool.staff.mapper;
import com.ydool.staff.entity.Audit;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 送审 Mapper 接口
* </p>
*
* @author msh
* @since 2023-02-16
*/
@Mapper
public interface AuditMapper extends MPJBaseMapper<Audit> {
}

View File

@ -0,0 +1,17 @@
package com.ydool.staff.service;
import com.ydool.common.data.dto.AjaxResult;
/**
* <p>
* 审批日志 服务类
* </p>
*
* @author msh
* @since 2023-02-16
*/
public interface IAuditLogService {
AjaxResult auditLog(String id);
}

View File

@ -0,0 +1,18 @@
package com.ydool.staff.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult;
/**
* <p>
* 送审 服务类
* </p>
*
* @author msh
* @since 2023-02-16
*/
public interface IAuditService {
AjaxResult getAuditList(Page page);
}

View File

@ -2,7 +2,6 @@ package com.ydool.staff.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.entity.SelectRequest;
import com.ydool.staff.request.ChangeRequest;
import com.ydool.staff.request.PersonnelDeleteRequest;
@ -11,7 +10,6 @@ import com.ydool.staff.request.PersonnelUpdateRequest;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* <p>
@ -65,5 +63,7 @@ public interface IPersonnelService {
AjaxResult importPersonnel(MultipartFile excl);
AjaxResult getEntityParam();
AjaxResult giveAudit(String id, String type);
}

View File

@ -0,0 +1,31 @@
package com.ydool.staff.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ydool.common.base.BaseService;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.AuditLog;
import com.ydool.staff.mapper.AuditLogMapper;
import com.ydool.staff.service.IAuditLogService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 审批日志 服务类
* </p>
*
* @author msh
* @since 2023-02-16
*/
@Service
public class AuditLogServiceImpl extends BaseService<AuditLogMapper, AuditLog> implements IAuditLogService {
@Override
public AjaxResult auditLog(String id) {
List<AuditLog> list = list(new LambdaQueryWrapper<AuditLog>().eq(AuditLog::getPersonnelId, id));
return AjaxResult.ok().data(list);
}
}

View File

@ -0,0 +1,29 @@
package com.ydool.staff.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.entity.Audit;
import com.ydool.common.base.BaseService;
import com.ydool.staff.mapper.AuditMapper;
import com.ydool.staff.service.IAuditService;
import org.springframework.stereotype.Service;
/**
* <p>
* 送审 服务类
* </p>
*
* @author msh
* @since 2023-02-16
*/
@Service
public class AuditServiceImpl extends BaseService<AuditMapper, Audit> implements IAuditService {
@Override
public AjaxResult getAuditList(Page page) {
Page AuditPage = page(page, new LambdaQueryWrapper<Audit>().eq(Audit::getAuditState, "submit"));
return AjaxResult.ok().data(AuditPage);
}
}

View File

@ -8,7 +8,7 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.query.MPJQueryWrapper;
import com.ydool.common.base.BaseService;
import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.staff.dto.AttachmentDto;
@ -17,18 +17,13 @@ import com.ydool.staff.dto.ExchangePageDto;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Exchange;
import com.ydool.common.base.BaseService;
import com.ydool.staff.entity.Organization;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.mapper.AttachmentMapper;
import com.ydool.staff.mapper.CompanyNameMapper;
import com.ydool.staff.mapper.ExchangeMapper;
import com.ydool.staff.mapper.OrganizationMapper;
import com.ydool.staff.mapper.PersonnelMapper;
import com.ydool.staff.request.AttachmentRequest;
import com.ydool.staff.request.ExchangeRequest;
import com.ydool.staff.request.PersonnelDeleteRequest;
import com.ydool.staff.request.PersonnelUpdateRequest;
import com.ydool.staff.service.IExchangeService;
import com.ydool.system.entity.Dept;
import com.ydool.system.entity.User;
@ -92,14 +87,26 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
Dept originalDept = deptMapper.selectById(personnel.getPresentDept());
Dept willDept = deptMapper.selectById(e.getWillDept());
User user = userMapper.selectById((String)StpUtil.getLoginId());
if(ObjectUtil.isNotEmpty(personnel)){
dto.setUserName(personnel.getUserName());
dto.setOriginalCompanyName(original.getCompanyName());
dto.setWillCompanyName(will.getCompanyName());
dto.setCardId(personnel.getNumberId());
dto.setNowDept(originalDept.getName());
dto.setWillDept(willDept.getName());
dto.setNowPosition(personnel.getPosition());
}
if (ObjectUtil.isNotEmpty(original)){
dto.setOriginalCompanyName(original.getCompanyName());
}
if (ObjectUtil.isNotEmpty(will)){
dto.setWillCompanyName(will.getCompanyName());
}
if (ObjectUtil.isNotEmpty(originalDept)){
dto.setNowDept(originalDept.getName());
}
if (ObjectUtil.isNotEmpty(willDept)){
dto.setWillDept(willDept.getName());
}
if (ObjectUtil.isNotEmpty(user)){
dto.setWritten(user.getUserName());
}
return dto;
}).collect(Collectors.toList()));
return AjaxResult.ok().data(exchangePage);
@ -142,24 +149,24 @@ public class ExchangeServiceImpl extends BaseService<ExchangeMapper, Exchange> i
Exchange exchange = getById(id);
Personnel personnel = personnelMapper.selectById(exchange.getPersonnelId());
if (ObjectUtil.isEmpty(personnel)){
return AjaxResult.fail().msg("用户不存在!");
return AjaxResult.fail().msg("人员不存在!");
}
CompanyName nowCompany = companyNameMapper.selectById(personnel.getCompanyName());
if (ObjectUtil.isEmpty(nowCompany)){
return AjaxResult.fail().msg("用户不存在!");
return AjaxResult.fail().msg("企业不存在!");
}
Dept nowDept = deptMapper.selectById(personnel.getPresentDept());
if (ObjectUtil.isEmpty(nowDept)){
return AjaxResult.fail().msg("用户不存在!");
return AjaxResult.fail().msg("部门不存在!");
}
CompanyName willCompany = companyNameMapper.selectById(exchange.getWillCompanyId());
if (ObjectUtil.isEmpty(willCompany)){
return AjaxResult.fail().msg("用户不存在!");
return AjaxResult.fail().msg("企业不存在!");
}
Dept dept = deptMapper.selectById(exchange.getWillDept());
if (ObjectUtil.isEmpty(dept)){
return AjaxResult.fail().msg("用户不存在!");
return AjaxResult.fail().msg("部门不存在!");
}
List<Attachment> attachments = attachmentMapper.selectList(new LambdaQueryWrapper<Attachment>().eq(Attachment::getTargetId, exchange.getId()));

View File

@ -1,17 +1,13 @@
package com.ydool.staff.service.impl;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.json.JSON;
import cn.hutool.json.JSONUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import cn.hutool.extra.spring.SpringUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ydool.common.base.BaseService;
@ -19,15 +15,14 @@ import com.ydool.common.constant.ArgsConst;
import com.ydool.common.data.dto.AjaxResult;
import com.ydool.common.utils.ColumnUtil;
import com.ydool.common.utils.EasyExcelAlibabaUtil;
import com.ydool.common.utils.ExcelMergeRowByRowUtil;
import com.ydool.common.utils.ExcelUtil;
import com.ydool.common.utils.HttpServletUtil;
import com.ydool.staff.dto.AttachmentDto;
import com.ydool.staff.dto.PersonnelByExchangeDto;
import com.ydool.staff.dto.PersonnelDto;
import com.ydool.staff.dto.PersonnelUpdateDto;
import com.ydool.staff.entity.Alteration;
import com.ydool.staff.entity.Attachment;
import com.ydool.staff.entity.Audit;
import com.ydool.staff.entity.AuditLog;
import com.ydool.staff.entity.CompanyName;
import com.ydool.staff.entity.Personnel;
import com.ydool.staff.entity.SelectRequest;
@ -35,6 +30,8 @@ import com.ydool.staff.excel.ExcelPersonnel;
import com.ydool.staff.excel.PersonnelExportVO;
import com.ydool.staff.excel.PersonnelFailMsgVO;
import com.ydool.staff.mapper.AlterationMapper;
import com.ydool.staff.mapper.AuditLogMapper;
import com.ydool.staff.mapper.AuditMapper;
import com.ydool.staff.mapper.CompanyNameMapper;
import com.ydool.staff.mapper.PersonnelMapper;
import com.ydool.staff.request.AttachmentRequest;
@ -53,7 +50,6 @@ import org.thymeleaf.util.StringUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
@ -353,11 +349,6 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
.eq(StrUtil.isNotBlank(request.getAlterationSign()),Personnel::getAlterationSign,request.getAlterationSign());
wrapper.lambda().like(Personnel::getUserName,request.getUserName())
.like(Personnel::getNumberId,request.getNumberId())
/*.like(Personnel::getAuditFile,request.getFileName()).or()
.like(Personnel::getCardFile,request.getFileName()).or()
.like(Personnel::getEducationFile,request.getFileName()).or()
.like(Personnel::getEngageFile,request.getFileName()).or()
.like(Personnel::getJobTitleFile,request.getFileName()).or()*/
.exists(StrUtil.isNotBlank(request.getCompanyName()), "select t2.id from t_lc_company_name t2 where " +
"t_lc_personnel.company_name = t2.id and t2.company_name like '%" + request.getCompanyName() + "%'");
if ("desc".equals(orderBy) && StrUtil.isNotBlank(column)) {
@ -372,7 +363,6 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
public void export(PersonnelDeleteRequest param ,HttpServletResponse response) {
List<Personnel> list = list();
List<ExcelPersonnel> personnelList = BeanUtil.copyToList(list, ExcelPersonnel.class);
for (ExcelPersonnel excelPersonnel : personnelList) {
CompanyName companyName = companyNameMapper.selectById(excelPersonnel.getCompanyName());
Dept dept = deptMapper.selectById(excelPersonnel.getPresentDept());
@ -384,9 +374,7 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
}
excelPersonnel.setGender("1".equals(excelPersonnel.getGender())?"":"");
excelPersonnel.setFreshGraduate("1".equals(excelPersonnel.getFreshGraduate())?"":"");
}
String fileName = "企业人员申报" + System.currentTimeMillis() + ".xlsx";
Set<String> includeColumnFiledNames = new HashSet<>();
for (String s : param.getIds()) {
@ -401,24 +389,17 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
//判断文件类型
String reg = ".+(.xlsx)$";
String suffix = FileUtil.getSuffix(excl.getOriginalFilename());
if (!Pattern.matches(reg, excl.getOriginalFilename()))
if (!Pattern.matches(reg, excl.getOriginalFilename())){
return AjaxResult.fail("必须上传后缀为" + suffix + "的文件");
System.out.println("准备导入通讯录" + excl);
if (!"企业人员申报模板.xlsx".equals(excl.getOriginalFilename()))
}
if (!"企业人员申报模板.xlsx".equals(excl.getOriginalFilename())){
return AjaxResult.fail("必须上传 企业人员申报模板.xlsx 文件");
}
//导出数据
List<PersonnelFailMsgVO> failList = new ArrayList<>();
//保存数据
// List<Employees> employeesList = new ArrayList<Employees>();
if (!excl.isEmpty()) {
List<PersonnelExportVO> personnelExportVOS = EasyExcelAlibabaUtil.excelToList(excl,
PersonnelExportVO.class);
JSON json = JSONUtil.parseObj(personnelExportVOS);
System.out.println("导入人员信息:" + json + personnelExportVOS);
System.out.println("导入企业人员申报表:" + personnelExportVOS.size() + "");
if (CollectionUtil.isEmpty(personnelExportVOS)){
return AjaxResult.fail("模板必须要有数据");
}
@ -438,19 +419,8 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
}
}
//保存
// if (CollectionUtil.isNotEmpty(employeesList)) {
// saveBatch(employeesList);
// }
}
// String fileName="通讯录导入结果.xlsx";//文件名称
// String urlPath = System.getProperty("user.dir") + File.separator + "upload"; //文件存放路径
// String FileNamePath = urlPath + File.separator + fileName;
// FileOutputStream fis=new FileOutputStream(FileNamePath);
// OutputStreamWriter out = new OutputStreamWriter(fis,"UTF-8");
//导出导入结果
String download = EasyExcelAlibabaUtil.download(PersonnelFailMsgVO.class, failList, "通讯录导入结果");
return AjaxResult.ok().data(download).msg("导入完成");
@ -466,6 +436,30 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
return AjaxResult.ok().data(list);
}
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult giveAudit(String id, String type) {
AuditMapper auditMapper = SpringUtil.getBean(AuditMapper.class);
AuditLogMapper auditLogMapper = SpringUtil.getBean(AuditLogMapper.class);
String loginId = (String) StpUtil.getLoginId();
Audit audit = new Audit();
AuditLog auditLog = new AuditLog();
audit.setPersonnelId(id);
audit.setPerType(type);
audit.setAuditState(ArgsConst.SUBMIT);
audit.setAuditOrder(ArgsConst.GIVE_AUDIT);
audit.setApprover(loginId);
audit.setApproverTime(new Date());
int i = auditMapper.insert(audit);
if(i>0){
auditLog.setPersonnelId(audit.getPersonnelId());
auditLog.setApprover(audit.getApprover());
auditLog.setAuditState("一般送审提交");
auditLogMapper.insert(auditLog);
}
return i>0 ? AjaxResult.ok().msg("送审成功!") : AjaxResult.fail().msg("送审失败!");
}
public PersonnelFailMsgVO checkPersonnelExportVO(PersonnelExportVO personnelExportVO) {
PersonnelFailMsgVO failMsgVO = BeanUtil.copyProperties(personnelExportVO, PersonnelFailMsgVO.class);
failMsgVO.setFailMsg("");
@ -481,25 +475,12 @@ public class PersonnelServiceImpl extends BaseService<PersonnelMapper, Personnel
if (!"".equals(personnelExportVO.getFreshGraduate()) && !"".equals(personnelExportVO.getGender())) {
failMsgVO.setFailMsg(failMsgVO.getFailMsg() + " 请输入正确选项,是或否 ");
}
/* //加密
String phone = employeesExportVO.getPhone();*/
/*int count = count(new LambdaQueryWrapper<Personnel>()
.eq(Personnel::getNumberId, personnelExportVO.getNumberId()));
if (count > 0) {
failMsgVO.setFailMsg(failMsgVO.getFailMsg() + " 身份证已存在 ");
}*/
return failMsgVO;
}
public Personnel interpretPersonnelExportVO(PersonnelExportVO personnelExportVO) {
Personnel personnel = BeanUtil.copyProperties(personnelExportVO, Personnel.class);
/*//手机号码加密
employees.setPhone(CodecUtils.encrypt(employees.getPhone()));*/
//组织编码转组织Id
/* GrapeDept dept = deptService.getOne(new LambdaQueryWrapper<GrapeDept>().eq(GrapeDept::getCode,
employeesExportVO.getDeptCode()));*/
//性别转换
//personnel.setGender("".equals(personnelExportVO.getGender()) ? 1 : 0);
personnel.setFreshGraduate("".equals(personnelExportVO.getFreshGraduate()) ? "1" : "0");
return personnel;
}

View File

@ -107,7 +107,7 @@ sa-token:
# 在多人登录同一账号时是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
is-share: true
# token风格
token-style: uuid
token-style: simple-uuid
# 是否输出操作日志
is-log: false
# token前缀