From 30e1eba3af71ed7b432a9f4c360ad94e782b2444 Mon Sep 17 00:00:00 2001 From: mash Date: Thu, 16 Feb 2023 17:20:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=89=B9=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ydool/common/constant/ArgsConst.java | 36 +++++- .../java/com/ydool/common/gen/Generator.java | 8 +- .../common/utils/ExcelMergeRowByRowUtil.java | 108 ------------------ .../com/ydool/common/utils/ExcelUtil.java | 107 ----------------- .../staff/controller/AuditController.java | 51 +++++++++ .../staff/controller/ExchangeController.java | 7 +- .../staff/controller/PersonnelController.java | 23 ++-- .../com/ydool/staff/entity/Alteration.java | 5 + .../java/com/ydool/staff/entity/Audit.java | 50 ++++++++ .../java/com/ydool/staff/entity/AuditLog.java | 38 ++++++ .../ydool/staff/mapper/AuditLogMapper.java | 18 +++ .../com/ydool/staff/mapper/AuditMapper.java | 18 +++ .../ydool/staff/service/IAuditLogService.java | 17 +++ .../ydool/staff/service/IAuditService.java | 18 +++ .../staff/service/IPersonnelService.java | 4 +- .../service/impl/AuditLogServiceImpl.java | 31 +++++ .../staff/service/impl/AuditServiceImpl.java | 29 +++++ .../service/impl/ExchangeServiceImpl.java | 45 +++++--- .../service/impl/PersonnelServiceImpl.java | 89 ++++++--------- src/main/resources/application.yml | 2 +- 20 files changed, 392 insertions(+), 312 deletions(-) delete mode 100644 src/main/java/com/ydool/common/utils/ExcelMergeRowByRowUtil.java delete mode 100644 src/main/java/com/ydool/common/utils/ExcelUtil.java create mode 100644 src/main/java/com/ydool/staff/controller/AuditController.java create mode 100644 src/main/java/com/ydool/staff/entity/Audit.java create mode 100644 src/main/java/com/ydool/staff/entity/AuditLog.java create mode 100644 src/main/java/com/ydool/staff/mapper/AuditLogMapper.java create mode 100644 src/main/java/com/ydool/staff/mapper/AuditMapper.java create mode 100644 src/main/java/com/ydool/staff/service/IAuditLogService.java create mode 100644 src/main/java/com/ydool/staff/service/IAuditService.java create mode 100644 src/main/java/com/ydool/staff/service/impl/AuditLogServiceImpl.java create mode 100644 src/main/java/com/ydool/staff/service/impl/AuditServiceImpl.java diff --git a/src/main/java/com/ydool/common/constant/ArgsConst.java b/src/main/java/com/ydool/common/constant/ArgsConst.java index 69a731e..2bcc702 100644 --- a/src/main/java/com/ydool/common/constant/ArgsConst.java +++ b/src/main/java/com/ydool/common/constant/ArgsConst.java @@ -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"; + + } diff --git a/src/main/java/com/ydool/common/gen/Generator.java b/src/main/java/com/ydool/common/gen/Generator.java index 02d63da..6f87997 100644 --- a/src/main/java/com/ydool/common/gen/Generator.java +++ b/src/main/java/com/ydool/common/gen/Generator.java @@ -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"); diff --git a/src/main/java/com/ydool/common/utils/ExcelMergeRowByRowUtil.java b/src/main/java/com/ydool/common/utils/ExcelMergeRowByRowUtil.java deleted file mode 100644 index 7af92c2..0000000 --- a/src/main/java/com/ydool/common/utils/ExcelMergeRowByRowUtil.java +++ /dev/null @@ -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); - } - } - -} diff --git a/src/main/java/com/ydool/common/utils/ExcelUtil.java b/src/main/java/com/ydool/common/utils/ExcelUtil.java deleted file mode 100644 index f760db5..0000000 --- a/src/main/java/com/ydool/common/utils/ExcelUtil.java +++ /dev/null @@ -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> 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> head, Map 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; - } -} diff --git a/src/main/java/com/ydool/staff/controller/AuditController.java b/src/main/java/com/ydool/staff/controller/AuditController.java new file mode 100644 index 0000000..7820f12 --- /dev/null +++ b/src/main/java/com/ydool/staff/controller/AuditController.java @@ -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); + } +} diff --git a/src/main/java/com/ydool/staff/controller/ExchangeController.java b/src/main/java/com/ydool/staff/controller/ExchangeController.java index 25ba4d7..2085757 100644 --- a/src/main/java/com/ydool/staff/controller/ExchangeController.java +++ b/src/main/java/com/ydool/staff/controller/ExchangeController.java @@ -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); diff --git a/src/main/java/com/ydool/staff/controller/PersonnelController.java b/src/main/java/com/ydool/staff/controller/PersonnelController.java index 006e524..4a09baa 100644 --- a/src/main/java/com/ydool/staff/controller/PersonnelController.java +++ b/src/main/java/com/ydool/staff/controller/PersonnelController.java @@ -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); + } + } diff --git a/src/main/java/com/ydool/staff/entity/Alteration.java b/src/main/java/com/ydool/staff/entity/Alteration.java index 9b30ba2..ba0274b 100644 --- a/src/main/java/com/ydool/staff/entity/Alteration.java +++ b/src/main/java/com/ydool/staff/entity/Alteration.java @@ -42,4 +42,9 @@ public class Alteration extends BaseEntity{ @ApiModelProperty(value = "变更类型") private String type; + @ApiModelProperty(value = "审批id") + private String auditId; + + + } diff --git a/src/main/java/com/ydool/staff/entity/Audit.java b/src/main/java/com/ydool/staff/entity/Audit.java new file mode 100644 index 0000000..8d79718 --- /dev/null +++ b/src/main/java/com/ydool/staff/entity/Audit.java @@ -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; +/** + *

+ * 送审 + *

+ * + * @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; + +} diff --git a/src/main/java/com/ydool/staff/entity/AuditLog.java b/src/main/java/com/ydool/staff/entity/AuditLog.java new file mode 100644 index 0000000..4aa1201 --- /dev/null +++ b/src/main/java/com/ydool/staff/entity/AuditLog.java @@ -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; +/** + *

+ * 审批日志 + *

+ * + * @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; + +} diff --git a/src/main/java/com/ydool/staff/mapper/AuditLogMapper.java b/src/main/java/com/ydool/staff/mapper/AuditLogMapper.java new file mode 100644 index 0000000..c8113ba --- /dev/null +++ b/src/main/java/com/ydool/staff/mapper/AuditLogMapper.java @@ -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; + +/** + *

+ * 审批日志 Mapper 接口 + *

+ * + * @author msh + * @since 2023-02-16 + */ +@Mapper +public interface AuditLogMapper extends MPJBaseMapper { + +} diff --git a/src/main/java/com/ydool/staff/mapper/AuditMapper.java b/src/main/java/com/ydool/staff/mapper/AuditMapper.java new file mode 100644 index 0000000..16088d8 --- /dev/null +++ b/src/main/java/com/ydool/staff/mapper/AuditMapper.java @@ -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; + +/** + *

+ * 送审 Mapper 接口 + *

+ * + * @author msh + * @since 2023-02-16 + */ +@Mapper +public interface AuditMapper extends MPJBaseMapper { + +} diff --git a/src/main/java/com/ydool/staff/service/IAuditLogService.java b/src/main/java/com/ydool/staff/service/IAuditLogService.java new file mode 100644 index 0000000..3e3b702 --- /dev/null +++ b/src/main/java/com/ydool/staff/service/IAuditLogService.java @@ -0,0 +1,17 @@ +package com.ydool.staff.service; + +import com.ydool.common.data.dto.AjaxResult; + +/** + *

+ * 审批日志 服务类 + *

+ * + * @author msh + * @since 2023-02-16 + */ +public interface IAuditLogService { + + AjaxResult auditLog(String id); +} + diff --git a/src/main/java/com/ydool/staff/service/IAuditService.java b/src/main/java/com/ydool/staff/service/IAuditService.java new file mode 100644 index 0000000..c259ff4 --- /dev/null +++ b/src/main/java/com/ydool/staff/service/IAuditService.java @@ -0,0 +1,18 @@ +package com.ydool.staff.service; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ydool.common.data.dto.AjaxResult; + +/** + *

+ * 送审 服务类 + *

+ * + * @author msh + * @since 2023-02-16 + */ +public interface IAuditService { + + AjaxResult getAuditList(Page page); +} + diff --git a/src/main/java/com/ydool/staff/service/IPersonnelService.java b/src/main/java/com/ydool/staff/service/IPersonnelService.java index 8f2a628..34d91db 100644 --- a/src/main/java/com/ydool/staff/service/IPersonnelService.java +++ b/src/main/java/com/ydool/staff/service/IPersonnelService.java @@ -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; /** *

@@ -65,5 +63,7 @@ public interface IPersonnelService { AjaxResult importPersonnel(MultipartFile excl); AjaxResult getEntityParam(); + + AjaxResult giveAudit(String id, String type); } diff --git a/src/main/java/com/ydool/staff/service/impl/AuditLogServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/AuditLogServiceImpl.java new file mode 100644 index 0000000..33a5d55 --- /dev/null +++ b/src/main/java/com/ydool/staff/service/impl/AuditLogServiceImpl.java @@ -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; + +/** + *

+ * 审批日志 服务类 + *

+ * + * @author msh + * @since 2023-02-16 + */ +@Service +public class AuditLogServiceImpl extends BaseService implements IAuditLogService { + + + @Override + public AjaxResult auditLog(String id) { + List list = list(new LambdaQueryWrapper().eq(AuditLog::getPersonnelId, id)); + return AjaxResult.ok().data(list); + } +} + diff --git a/src/main/java/com/ydool/staff/service/impl/AuditServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/AuditServiceImpl.java new file mode 100644 index 0000000..ab5b647 --- /dev/null +++ b/src/main/java/com/ydool/staff/service/impl/AuditServiceImpl.java @@ -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; + +/** + *

+ * 送审 服务类 + *

+ * + * @author msh + * @since 2023-02-16 + */ +@Service +public class AuditServiceImpl extends BaseService implements IAuditService { + + @Override + public AjaxResult getAuditList(Page page) { + Page AuditPage = page(page, new LambdaQueryWrapper().eq(Audit::getAuditState, "submit")); + return AjaxResult.ok().data(AuditPage); + } +} + diff --git a/src/main/java/com/ydool/staff/service/impl/ExchangeServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/ExchangeServiceImpl.java index c190efe..bfeaeda 100644 --- a/src/main/java/com/ydool/staff/service/impl/ExchangeServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/ExchangeServiceImpl.java @@ -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 i Dept originalDept = deptMapper.selectById(personnel.getPresentDept()); Dept willDept = deptMapper.selectById(e.getWillDept()); User user = userMapper.selectById((String)StpUtil.getLoginId()); - 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()); - dto.setWritten(user.getUserName()); + if(ObjectUtil.isNotEmpty(personnel)){ + dto.setUserName(personnel.getUserName()); + dto.setCardId(personnel.getNumberId()); + 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 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 attachments = attachmentMapper.selectList(new LambdaQueryWrapper().eq(Attachment::getTargetId, exchange.getId())); diff --git a/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java b/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java index 8fcbdcd..5e43dbe 100644 --- a/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java +++ b/src/main/java/com/ydool/staff/service/impl/PersonnelServiceImpl.java @@ -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 list = list(); List 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 includeColumnFiledNames = new HashSet<>(); for (String s : param.getIds()) { @@ -401,24 +389,17 @@ public class PersonnelServiceImpl extends BaseService failList = new ArrayList<>(); - //保存数据 -// List employeesList = new ArrayList(); if (!excl.isEmpty()) { List 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 BaseService0){ + 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() - .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().eq(GrapeDept::getCode, - employeesExportVO.getDeptCode()));*/ - //性别转换 - //personnel.setGender("男".equals(personnelExportVO.getGender()) ? 1 : 0); personnel.setFreshGraduate("是".equals(personnelExportVO.getFreshGraduate()) ? "1" : "0"); return personnel; } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index dfb2667..c9379dc 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -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前缀