Commit 62693996 by 284718418@qq.com

合并华颐 审批流程 代码

parent 5b52fe85
......@@ -26,7 +26,7 @@ import cn.hutool.core.net.NetUtil;
public class Application {
public static void main(String[] args) {
final Integer port = 8089;
final Integer port = 8189;
if (!NetUtil.isUsableLocalPort(port)) {
System.err.printf("端口%d被占用了,无法启动%n", port);
System.exit(1);
......
......@@ -3,8 +3,10 @@ package cn.timer.api.bean.kqmk;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
......@@ -15,6 +17,8 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author LAL 2020-05-09
*/
......@@ -27,7 +31,7 @@ import lombok.NoArgsConstructor;
public class KqglAssoLeaveBalance extends Model<KqglAssoLeaveBalance> {
/**
*
*
*/
private static final long serialVersionUID = 1L;
......@@ -67,4 +71,9 @@ public class KqglAssoLeaveBalance extends Model<KqglAssoLeaveBalance> {
@ApiModelProperty(value = "是否为系统自动 0:否;1:是", example = "101")
private Integer isAutomatic;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "假期统调用户ID")
private List<Integer> userIds;
}
\ No newline at end of file
......@@ -35,115 +35,115 @@ public class CmsContent extends Model<CmsContent>{
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号", example = "1")
private Integer id;
@ApiModelProperty(value = "讯息ID", example = "101")
private String xxbh;// 内容类型ID
@ApiModelProperty(value = "内容类型ID", example = "101")
private String contenttypeid;// 内容类型ID
@ApiModelProperty(value = "标题", example = "101")
private String title;// 标题
@ApiModelProperty(value = "作者", example = "101")
private String author;// 作者
@ApiModelProperty(value = "内容", example = "101")
private String summary;// 内容
@ApiModelProperty(value = "摘要", example = "101")
private String introduction;// 摘要
@ApiModelProperty(value = "链接", example = "101")
private String linkaddress;// 链接
@ApiModelProperty(value = "录入日期", example = "101")
private Long addeddate;// 录入日期
@ApiModelProperty(value = "发布状态", example = "101")
private Integer releasestate;// 发布状态
@ApiModelProperty(value = "审核状态", example = "101")
private Integer status;// 审核状态
@ApiModelProperty(value = "添加人---责任编辑人姓名", example = "101")
private Integer userid;// 添加人---责任编辑人姓名
@ApiModelProperty(value = "org_code", example = "101")
private Integer organizationId;// 归属商户id
// @ApiModelProperty(value = "有效起始时间", example = "101")
// private String starttime;// 有效起始时间
//
// @ApiModelProperty(value = "有效结束时间", example = "101")
// private String endtime;// 有效结束时间
@ApiModelProperty(value = "状态 1:正常 2:删除", example = "101")
private Integer existencestatus;// 状态 1:正常 2:删除
@ApiModelProperty(value = "审核人姓名", example = "101")
private String auditor;// 审核人(用户ID)
@ApiModelProperty(value = "审核时间", example = "101")
private String audittime;// 审核时间
@ApiModelProperty(value = "上级审核意见", example = "101")
private String auditopinion;// 上级审核意见
@ApiModelProperty(value = "评论内容", example = "101")
private String reviewcontent;// 评论内容
@ApiModelProperty(value = "评论时间", example = "101")
private Long reviewtime;// 评论时间
// @ApiModelProperty(value = "评论人", example = "101")
// private String commentator;// 评论人
@ApiModelProperty(value = "发布人(用户ID)", example = "101")
private Integer publisher;// 发布人(用户ID)
@ApiModelProperty(value = "发布时间", example = "101")
private String releasetime;// 发布时间
// @ApiModelProperty(value = "归属人", example = "101")
// private Integer belonger;// 归属人
// @ApiModelProperty(value = "提醒时间", example = "101")
// private Long eventremindingtime;// 提醒时间
// @ApiModelProperty(value = "发送人-0:默认全部人员,1:批量人员", example = "101")
// private Integer sender;// 发送人-0:默认全部人员,1:批量人员
@ApiModelProperty(value = "所属模块ID", example = "101")
private Integer modularid;// 所属模块ID
@ApiModelProperty(value = "发布方式:1-编辑文本;2-文本识别", example = "101")
private Integer releasemode;// 发布方式:1-编辑文本;2-文本识别
// @ApiModelProperty(value = "别名-0:已过期;1:未到期", example = "101")
// private int termstate;// 别名-0:已过期;1:未到期
@ApiModelProperty(value = "别名-用户名", example = "101")
private String uname;// 别名-用户名
@ApiModelProperty(value = "封面文件路径", example = "101")
private String fmtpath;//
@ApiModelProperty(value = "附件文件路径", example = "101")
private String filepath;//
@ApiModelProperty(value = "发布者姓名", example = "101")
private String publisherName;// 发布者姓名
@ApiModelProperty(value = "发布方式:1,审核通过后立即发布,2定时发布,3手动发布", example = "101")
private Integer releasetype;// 发布方式:1,审核通过后立即发布,2定时发布,3手动发布
@ApiModelProperty(value = "收回人(用户ID)", example = "101")
private Integer takeBack;// 收回人(用户ID)
@ApiModelProperty(value = "收回时间", example = "101")
private String takeBackTime;// 收回时间
@ApiModelProperty(value = "定时发布时间", example = "101")
private Long fixedTime;// 定时发布时间
......
......@@ -54,7 +54,7 @@ public class CmsContentModular extends Model<CmsContentModular> {
@ApiModelProperty(value = "0- 开启 1-关闭", example = "0")
private Integer isOpen;
@ApiModelProperty(value = "排序:升序", example = "0")
@ApiModelProperty(value = "排序", example = "0")
private Integer sort;
}
......@@ -39,13 +39,13 @@ public class CmsContentRead extends Model<CmsContentRead>{
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "编号", example = "1")
private Integer id;
@ApiModelProperty(value = "企业讯息主表ID", example = "101")
private Integer cmsContentId;
@ApiModelProperty(value = "留言/意见反馈", example = "")
private String reviewContent;
@ApiModelProperty(value = "留言/意见反馈时间", example = "")
private Date reviewTime;
......@@ -69,6 +69,6 @@ public class CmsContentRead extends Model<CmsContentRead>{
@ApiModelProperty(value = "更新时间", example = "")
private Date updateTime;
}
......@@ -34,7 +34,7 @@ import lombok.NoArgsConstructor;
public class SpmkApprovalG extends Model<SpmkApprovalG> {
/**
*
*
*/
private static final long serialVersionUID = 1L;
......@@ -58,5 +58,4 @@ public class SpmkApprovalG extends Model<SpmkApprovalG> {
@ApiModelProperty(value = "是否可编辑 0是 1否", example = "101")
private Integer isEditable;
}
\ No newline at end of file
}
package cn.timer.api.bean.spmk;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Table;
/**
* 审批草稿详情
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-08-16 14:52:01
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "spmk_approve_detail_drafts")
@ApiModel("审批草稿详情")
public class SpmkApproveDetailDrafts extends Model<SpmkApproveDetailDrafts> {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
private Integer id;
/**
* 审批汇总id
*/
private Integer approveSummaryId;
/**
* 标题
*/
private String name;
/**
* 所在部门名称
*/
private String departmentName;
/**
* 申请数据
*/
private String requestData;
/**
* 审批表单
*/
private String froms;
/**
* 审批流程
*/
private String router;
/**
* 通过节点
*/
private String flowChildren;
/**
* 设置:编号
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取:编号
*/
public Integer getId() {
return id;
}
/**
* 设置:审批汇总id
*/
public void setApproveSummaryId(Integer approveSummaryId) {
this.approveSummaryId = approveSummaryId;
}
/**
* 获取:审批汇总id
*/
public Integer getApproveSummaryId() {
return approveSummaryId;
}
/**
* 设置:标题
*/
public void setName(String name) {
this.name = name;
}
/**
* 获取:标题
*/
public String getName() {
return name;
}
/**
* 设置:所在部门名称
*/
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
/**
* 获取:所在部门名称
*/
public String getDepartmentName() {
return departmentName;
}
/**
* 设置:申请数据
*/
public void setRequestData(String requestData) {
this.requestData = requestData;
}
/**
* 获取:申请数据
*/
public String getRequestData() {
return requestData;
}
/**
* 设置:审批表单
*/
public void setFroms(String froms) {
this.froms = froms;
}
/**
* 获取:审批表单
*/
public String getFroms() {
return froms;
}
/**
* 设置:审批流程
*/
public void setRouter(String router) {
this.router = router;
}
/**
* 获取:审批流程
*/
public String getRouter() {
return router;
}
/**
* 设置:通过节点
*/
public void setFlowChildren(String flowChildren) {
this.flowChildren = flowChildren;
}
/**
* 获取:通过节点
*/
public String getFlowChildren() {
return flowChildren;
}
}
package cn.timer.api.bean.spmk;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* 审批草稿箱
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-08-16 14:52:01
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "spmk_approve_drafts")
@ApiModel("审批草稿箱")
public class SpmkApproveDrafts extends Model<SpmkApproveDrafts> implements Serializable{
private static final long serialVersionUID = 1L;
/**
* 审批编号
*/
private Integer id;
/**
* 企业组织代码
*/
private Integer orgCode;
/**
* 发起人id 用于搜索(所在部门)
*/
private Integer empNum;
/**
* 标题
*/
private String title;
/**
* 所在部门名称
*/
private String departmentName;
/**
* 发起人名称
*/
private String initiator;
/**
* 发起时间
*/
private Date createTime;
/**
* 审批名称
*/
private String approveName;
/**
* 状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝
*/
private Integer sts;
/**
* 当前审批人
*/
private String currentApprover;
/**
* 历史审批人
*/
private String historyApprover;
/**
* assoType 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 10调薪
*/
private Integer assoType;
/**
* 最近处理时间
*/
private Date updateTime;
/**
* 结束时间
*/
private Date endTime;
/**
* 摘要
*/
private String digest;
/**
* 是否删除 0-否 1-是
*/
private Integer isDelete;
/**
* 是否加急 0-否 1-是
*/
private Integer isUrgent;
/**
* 设置:审批编号
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取:审批编号
*/
public Integer getId() {
return id;
}
/**
* 设置:企业组织代码
*/
public void setOrgCode(Integer orgCode) {
this.orgCode = orgCode;
}
/**
* 获取:企业组织代码
*/
public Integer getOrgCode() {
return orgCode;
}
/**
* 设置:发起人id 用于搜索(所在部门)
*/
public void setEmpNum(Integer empNum) {
this.empNum = empNum;
}
/**
* 获取:发起人id 用于搜索(所在部门)
*/
public Integer getEmpNum() {
return empNum;
}
/**
* 设置:标题
*/
public void setTitle(String title) {
this.title = title;
}
/**
* 获取:标题
*/
public String getTitle() {
return title;
}
/**
* 设置:所在部门名称
*/
public void setDepartmentName(String departmentName) {
this.departmentName = departmentName;
}
/**
* 获取:所在部门名称
*/
public String getDepartmentName() {
return departmentName;
}
/**
* 设置:发起人名称
*/
public void setInitiator(String initiator) {
this.initiator = initiator;
}
/**
* 获取:发起人名称
*/
public String getInitiator() {
return initiator;
}
/**
* 设置:发起时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:发起时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置:审批名称
*/
public void setApproveName(String approveName) {
this.approveName = approveName;
}
/**
* 获取:审批名称
*/
public String getApproveName() {
return approveName;
}
/**
* 设置:状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝
*/
public void setSts(Integer sts) {
this.sts = sts;
}
/**
* 获取:状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝
*/
public Integer getSts() {
return sts;
}
/**
* 设置:当前审批人
*/
public void setCurrentApprover(String currentApprover) {
this.currentApprover = currentApprover;
}
/**
* 获取:当前审批人
*/
public String getCurrentApprover() {
return currentApprover;
}
/**
* 设置:历史审批人
*/
public void setHistoryApprover(String historyApprover) {
this.historyApprover = historyApprover;
}
/**
* 获取:历史审批人
*/
public String getHistoryApprover() {
return historyApprover;
}
/**
* 设置:assoType 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 10调薪
*/
public void setAssoType(Integer assoType) {
this.assoType = assoType;
}
/**
* 获取:assoType 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 10调薪
*/
public Integer getAssoType() {
return assoType;
}
/**
* 设置:最近处理时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取:最近处理时间
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* 设置:结束时间
*/
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
/**
* 获取:结束时间
*/
public Date getEndTime() {
return endTime;
}
/**
* 设置:摘要
*/
public void setDigest(String digest) {
this.digest = digest;
}
/**
* 获取:摘要
*/
public String getDigest() {
return digest;
}
/**
* 设置:是否删除 0-否 1-是
*/
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
/**
* 获取:是否删除 0-否 1-是
*/
public Integer getIsDelete() {
return isDelete;
}
/**
* 设置:是否加急 0-否 1-是
*/
public void setIsUrgent(Integer isUrgent) {
this.isUrgent = isUrgent;
}
/**
* 获取:是否加急 0-否 1-是
*/
public Integer getIsUrgent() {
return isUrgent;
}
}
......@@ -19,6 +19,7 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Transient;
/**
* @author Tang 2020-04-17
......@@ -32,7 +33,7 @@ import lombok.NoArgsConstructor;
public class SpmkApproveExecuteRecord extends Model<SpmkApproveExecuteRecord> {
/**
*
*
*/
private static final long serialVersionUID = 1L;
......@@ -57,11 +58,14 @@ public class SpmkApproveExecuteRecord extends Model<SpmkApproveExecuteRecord> {
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "操作时间 ", example = "操作时间")
private Date updateTime;
@Transient
@TableField(exist = false)
@ApiModelProperty(value = "")
private List<SpmkExecutor> spmkExecutors;
}
\ No newline at end of file
}
package cn.timer.api.bean.spmk;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
* 审批执行记录 发起人、抄送人、审批人操作记录--草稿
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-08-19 14:53:36
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "spmk_approve_execute_record_drafts")
@ApiModel("审批执行记录 发起人、抄送人、审批人操作记录--草稿")
public class SpmkApproveExecuteRecordDrafts extends Model<SpmkApproveExecuteRecordDrafts> implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 编号
*/
private Integer id;
/**
* 审批汇总id
*/
private Integer approveSummaryId;
/**
* 名称 发起申请 1抄送人 审批人 连续多级主管
*/
private String name;
/**
* 类型 0发起申请 1抄送人 2审批人 3连续多级主管
*/
private Integer type;
/**
* 状态 0未执行 1审批中 2同意 3拒绝
*/
private Integer sts;
/**
* 创建时间
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
* 设置:编号
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取:编号
*/
public Integer getId() {
return id;
}
/**
* 设置:审批汇总id
*/
public void setApproveSummaryId(Integer approveSummaryId) {
this.approveSummaryId = approveSummaryId;
}
/**
* 获取:审批汇总id
*/
public Integer getApproveSummaryId() {
return approveSummaryId;
}
/**
* 设置:名称 发起申请 1抄送人 审批人 连续多级主管
*/
public void setName(String name) {
this.name = name;
}
/**
* 获取:名称 发起申请 1抄送人 审批人 连续多级主管
*/
public String getName() {
return name;
}
/**
* 设置:类型 0发起申请 1抄送人 2审批人 3连续多级主管
*/
public void setType(Integer type) {
this.type = type;
}
/**
* 获取:类型 0发起申请 1抄送人 2审批人 3连续多级主管
*/
public Integer getType() {
return type;
}
/**
* 设置:状态 0未执行 1审批中 2同意 3拒绝
*/
public void setSts(Integer sts) {
this.sts = sts;
}
/**
* 获取:状态 0未执行 1审批中 2同意 3拒绝
*/
public Integer getSts() {
return sts;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置:
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取:
*/
public Date getUpdateTime() {
return updateTime;
}
}
......@@ -32,7 +32,7 @@ import lombok.NoArgsConstructor;
public class SpmkApproveSummary extends Model<SpmkApproveSummary> {
/**
*
*
*/
private static final long serialVersionUID = 1L;
......@@ -73,7 +73,7 @@ public class SpmkApproveSummary extends Model<SpmkApproveSummary> {
@ApiModelProperty(value = "历史审批人 ", example = "历史审批人")
private String historyApprover;
@ApiModelProperty(value = "1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡", example = "1")
private Integer assoType;
......@@ -89,7 +89,7 @@ public class SpmkApproveSummary extends Model<SpmkApproveSummary> {
@ApiModelProperty(value = "是否删除", example = "0-否 1-是")
private Integer isDelete;
@ApiModelProperty(value = "岗位名称", example = "岗位名称")
private String gwName;
@ApiModelProperty(value = "部门id", example = "1")
......@@ -99,8 +99,7 @@ public class SpmkApproveSummary extends Model<SpmkApproveSummary> {
@ApiModelProperty(value = "是否加急", example = "0-否 1-是")
private Integer isUrgent;
}
\ No newline at end of file
......@@ -33,7 +33,7 @@ import lombok.NoArgsConstructor;
public class SpmkExecutor extends Model<SpmkExecutor> {
/**
*
*
*/
private static final long serialVersionUID = 1L;
......@@ -61,10 +61,13 @@ public class SpmkExecutor extends Model<SpmkExecutor> {
@ApiModelProperty(value = "状态 0未执行 1执行中 2同意 3拒接 4转派", example = "101")
private Integer sts;
@ApiModelProperty(value = "阅读标记0.未读 1.已读", example = "0")
private Integer readStatus;
@TableField(fill = FieldFill.INSERT)
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
@TableField(fill = FieldFill.UPDATE)
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date updateTime;
......
......@@ -63,9 +63,18 @@ public class DiskFilesController {
@Autowired
private SftpConfiguration config;
@Value("${sftp.client.targetPath}")
private String targetPath;
@Value("${sftp.client.reservedName}")
private boolean reservedName;
@Value("${sftp.client.serverUrl}")
private String serverUrl;
@Autowired
private OSSService ossService;
@ResponseBody
@PostMapping("/upload")
@ApiOperation(value = "上传普通文件", httpMethod = "POST", notes = "接口发布说明")
......@@ -326,7 +335,7 @@ public class DiskFilesController {
@ApiOperation(value = "查询文件是否存在", httpMethod = "GET", notes = "查询文件是否存在")
@GetMapping(value = "/query_file_isExist")
public Result<Object> queryFileIsExist(@CurrentUser UserBean userBean,@ApiParam("文件ID") @RequestParam(required = true) Integer fileId,
@ApiParam("默认不传,我收到的列表查询传type=1") @RequestParam(required = false) Integer type){
@ApiParam("默认不传,我收到的列表查询传type=1") @RequestParam(required = false) Integer type){
DiskFiles diskFiles = DiskFiles.builder().id(fileId).build().selectById();
DiskFilesLog diskFilesLog = DiskFilesLog.builder().build();
if(StringUtils.isEmpty(diskFiles)){
......
......@@ -18,4 +18,4 @@ public class FileAddressConstant {
*/
public static final String PHYSICS_OSS = "physics-oss";
}
}
\ No newline at end of file
......@@ -9,13 +9,30 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.dzht.DzhtAssoMbzj;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
import cn.timer.api.config.enuminterface.YgEnumInterface;
import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.config.enums.SysRoleType;
import cn.timer.api.config.exception.Regular;
import cn.timer.api.config.validation.ValidList;
import cn.timer.api.dto.kqmk.*;
import cn.timer.api.dto.yggl.AddygdaDto;
import cn.timer.api.utils.*;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
......@@ -23,6 +40,8 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
......@@ -95,52 +114,10 @@ import cn.timer.api.dao.kqmk.KqglAssoYhkqzMapper;
import cn.timer.api.dao.kqmk.KqglAssoYhsbMapper;
import cn.timer.api.dao.kqmk.KqglAssoZhoupaibanMapper;
import cn.timer.api.dao.kqmk.KqglMainKqzMapper;
import cn.timer.api.dto.kqmk.AdditionalDto;
import cn.timer.api.dto.kqmk.AttLateLate;
import cn.timer.api.dto.kqmk.AttMemberSettings;
import cn.timer.api.dto.kqmk.AttSchedule;
import cn.timer.api.dto.kqmk.AttSchedulingDto;
import cn.timer.api.dto.kqmk.AttendanceAssistantDto;
import cn.timer.api.dto.kqmk.AttendanceCardListDto;
import cn.timer.api.dto.kqmk.AttendanceMachineStatus;
import cn.timer.api.dto.kqmk.AttendanceSummaryQueryDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.AttstateDate;
import cn.timer.api.dto.kqmk.BalanceSheetDataDto;
import cn.timer.api.dto.kqmk.CalendarDetailsDto;
import cn.timer.api.dto.kqmk.CalendarPunchDetailsDto;
import cn.timer.api.dto.kqmk.CalendarTableDataDto;
import cn.timer.api.dto.kqmk.ChangePunchResultsDto;
import cn.timer.api.dto.kqmk.CompensateDto;
import cn.timer.api.dto.kqmk.DailyDetailsDto;
import cn.timer.api.dto.kqmk.DetailsofbusinessDto;
import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto;
import cn.timer.api.dto.kqmk.IndividualOvertimeRuleDto;
import cn.timer.api.dto.kqmk.JiaqibalanceDto;
import cn.timer.api.dto.kqmk.KqglAssoLeaveRulesDto;
import cn.timer.api.dto.kqmk.KqglAssoMonthPunchSummaryDto;
import cn.timer.api.dto.kqmk.KqglAssoOvertimeRulesDto;
import cn.timer.api.dto.kqmk.KqglAssoPbmxDto;
import cn.timer.api.dto.kqmk.KqglAssoRulesViceDto;
import cn.timer.api.dto.kqmk.KqglMainKqzDto;
import cn.timer.api.dto.kqmk.KqzAttendanceGroupSearchDto;
import cn.timer.api.dto.kqmk.LeaveTypeDto;
import cn.timer.api.dto.kqmk.MachinememberDto;
import cn.timer.api.dto.kqmk.ModifyEmployeeBalanceDto;
import cn.timer.api.dto.kqmk.OriginalRecordDto;
import cn.timer.api.dto.kqmk.ResttryfixdayDto;
import cn.timer.api.dto.kqmk.SetConditionsDto;
import cn.timer.api.dto.kqmk.StartTimeRestDto;
import cn.timer.api.dto.kqmk.UserAttendanceRelDto;
import cn.timer.api.dto.kqmk.VacationInformationDto;
import cn.timer.api.dto.kqmk.WorkbenchCalendarDto;
import cn.timer.api.utils.DateUtil;
import cn.timer.api.utils.ResponseResult;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Slf4j
@Api(tags = "3.0[1]考勤模块")
@RestController
@Transactional
......@@ -984,6 +961,65 @@ public class TimeCardController {
}
/**
* 假期统调
*/
@PostMapping(value = "/leave_balance_all")
@ApiOperation(value = "假期统调", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> LeaveBalanceAll(@CurrentUser UserBean userBean,@RequestBody KqglAssoLeaveBalance balance) {
balance.setModifyUserid(userBean.getEmpNum());
balance.setModifyTimer(new Date().getTime());
balance.setOrgCode(userBean.getOrgCode());
String balanceDays = "0";
if(balance.getModifyAction() == 1) {//增加
balanceDays = "+" + balance.getBalanceDays();
}else {
balanceDays = "-" + balance.getBalanceDays();
}
balance.setBalanceDays(balanceDays);
if(!CollectionUtils.isEmpty(balance.getUserIds())){
for (Integer userId :balance.getUserIds()) {
KqglAssoLeaveBalance balan = kqglassoleavebalancemapper.selectOne(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getUserid, userId)
.orderByDesc(KqglAssoLeaveBalance :: getModifyNumber).last("LIMIT 1"));
if(balan != null) {
balance.setModifyNumber(balan.getModifyNumber()+1);
}else {
balance.setModifyNumber(1);
}
balance.setUserid(userId);
//添加成功
if(balance.insert()) {
//查询员工假期余额表中所对应的假期id
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, balance.getLeaveRulesId())
.eq(KqglAssoLeaveEmployeeBalance::getUserid, userId).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, userBean.getOrgCode()));
//获取最后得到的最终余额
double balance_days = kqglassoleavebalancemapper.Sumbalancedays(userId, userBean.getOrgCode(),balance.getLeaveRulesId());
if(emba != null && balance_days > 0) {
if(emba.getBalanceDays() != -1) {//确认为限制余额的
//修改最终的余额数
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(balance_days).build().updateById();
}
}else{
if(emba.getBalanceDays() != -1) {//确认为限制余额的
//修改最终的余额数
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(0).build().updateById();
}
}
}
}
}
return ResultUtil.success("操作成功!") ;
}
/**
* 根据考勤余额id获取信息 ||大于“0”为有数字限制 ||为“-1”时为无数字限制
*/
@GetMapping(value="/hqleavebalance/{id}")
......@@ -1721,6 +1757,86 @@ public class TimeCardController {
return ResultUtil.data(pageAs, sumlist, "操作成功!");
}
@PostMapping(value = "/export_leave_balance")
@ApiOperation(value = "导出假期余额列表数据", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> ExportLeaveBalance(@CurrentUser UserBean userBean, @Validated @RequestBody AttqueryCriteriaDto attquerycriteriadto) {
attquerycriteriadto.setOrgCode(userBean.getOrgCode());
attquerycriteriadto.setEmpNum(userBean.getEmpNum());
List<ExportEmployeeLeaveBalanceDto> list = kqglassoleavebalancemapper.selectLeaveBalance(attquerycriteriadto);
for(ExportEmployeeLeaveBalanceDto endo : list) {
List<KqglAssoLeaveEmployeeBalance> empye = KqglAssoLeaveEmployeeBalance.builder().build().selectList(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getUserid, endo.getEmpnum())
.eq(KqglAssoLeaveEmployeeBalance::getOrgCode, endo.getOrgcode()));
List<BalanceSheetDataDto> balanceTo = new ArrayList<BalanceSheetDataDto>();
for(KqglAssoLeaveEmployeeBalance empyes : empye) {
BalanceSheetDataDto bal = BalanceSheetDataDto.builder().build();
bal.setBalancedays(empyes.getBalanceDays());
bal.setLeaverulesid(empyes.getLeaveRulesId());
balanceTo.add(bal);
}
endo.setBalanceTo(balanceTo);
}
return ResultUtil.data(list, "操作成功!");
}
/**
* 导入假期余额数据
*/
@PostMapping(value = "/import_leave_balance")
@ApiOperation(value = "导入假期余额数据", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> importLeaveBalance(@CurrentUser UserBean userBean,
@RequestBody Object o) throws Exception {
Integer orgCode = userBean.getOrgCode();
JSONArray jsonArray = (JSONArray)o;
for (Object object :jsonArray) {
JSONObject jsonObject = (JSONObject)object;
if(StringUtils.isEmpty(jsonObject.get("empnum"))){
continue;
}
String empnum = jsonObject.get("empnum").toString();
for (Map.Entry<String, Object> entity:jsonObject.entrySet()) {
log.info("entity key:{},vlue{}",entity.getKey(),entity.getValue());
if("empnum".equals(entity.getKey())){
}else if("department".equals(entity.getKey())){
}else{
Integer leaveRulesId = Integer.parseInt(entity.getKey());
double balanceDays = 0;
if(StringUtils.isEmpty(entity.getValue())){
continue;
}else {
if("不限制余额".equals(entity.getValue().toString())){
balanceDays = -1;
}else {
balanceDays = Double.parseDouble(entity.getValue().toString());
}
}
//查询员工假期余额表中所对应的假期id
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, leaveRulesId)
.eq(KqglAssoLeaveEmployeeBalance::getUserid, empnum).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, userBean.getOrgCode()));
if(emba != null && balanceDays > 0) {
if(emba.getBalanceDays() != -1) {//确认为限制余额的
//修改最终的余额数
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(balanceDays).build().updateById();
}
}else{
if(emba.getBalanceDays() != -1) {//确认为限制余额的
//修改最终的余额数
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(0).build().updateById();
}
}
}
}
}
return ResultUtil.success("导入假期余额成功!");
}
/**
* 移除考勤机管理员
......@@ -1781,7 +1897,7 @@ public class TimeCardController {
@ApiOperationSupport(order = 34)
public Result<Object> AttendanceCalendar(@CurrentUser UserBean userBean, @Validated @RequestBody OriginalRecordDto originalrecorddto) throws ParseException{
IPage<PunchRecord> page = new Page<PunchRecord>(
IPage<PunchRecord> page = new Page<PunchRecord>(
originalrecorddto.getCurrentPage() == null ? 1 : originalrecorddto.getCurrentPage(),
originalrecorddto.getTotalPage() == null ? 10 : originalrecorddto.getTotalPage());
originalrecorddto.setQyid(userBean.getOrgCode());
......
......@@ -55,7 +55,7 @@ public class KqglServiceImpl implements KqglService {
@Autowired
private KqglAssoLeaveBalanceMapper kqglassoleavebalancemapper;
/**
* 考勤请假审批
*/
......@@ -68,34 +68,34 @@ public class KqglServiceImpl implements KqglService {
for(String num : days) {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(leaveappr.getUserid()).appTime(num).approvalId(leaveappr.getLeaveid()).approvalType(2).duration(leaveappr.getDuration())
.leaveTypeId(leaveappr.getLeavetype()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getStarttime()))
.endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getEndtime())).orgCode(leaveappr.getOrgcode()).ordernum(i).totals(days.length).build().insert();
.leaveTypeId(leaveappr.getLeavetype()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getStarttime()))
.endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getEndtime())).orgCode(leaveappr.getOrgcode()).ordernum(i).totals(days.length).build().insert();
i++;
}
YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, leaveappr.getUserid()).eq(YgglMainEmp::getOrgCode, leaveappr.getOrgcode()));
int modifynumber = 1;
KqglAssoLeaveBalance balan = kqglassoleavebalancemapper.selectOne(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getUserid, leaveappr.getUserid()).eq(KqglAssoLeaveBalance::getOrgCode, leaveappr.getOrgcode())
.orderByDesc(KqglAssoLeaveBalance :: getModifyNumber).last("LIMIT 1"));
if(balan != null) {
modifynumber = balan.getModifyNumber()+1;
}
String mse = "考勤请假审批";
KqglAssoLeaveRulesT rult = KqglAssoLeaveRulesT.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveRulesT>().lambda().eq(KqglAssoLeaveRulesT::getId, leaveappr.getLeavetype()));
if(rult != null) {
mse = "考勤"+rult.getName()+"审批";
}
KqglAssoLeaveBalance.builder().leaveRulesId(leaveappr.getLeavetype()).userid(leaveappr.getUserid()).modifyAction(2).balanceDays("-"+leaveappr.getDuration())
.reason(mse).modifyUserid(emp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
.reason(mse).modifyUserid(emp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
//查询员工假期余额表中所对应的假期id
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, leaveappr.getLeavetype())
.eq(KqglAssoLeaveEmployeeBalance::getUserid, leaveappr.getUserid()).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, leaveappr.getOrgcode()));
//获取最后得到的最终余额
double balance_days = kqglassoleavebalancemapper.Sumbalancedays(leaveappr.getUserid(), leaveappr.getOrgcode(),leaveappr.getLeavetype());
if(emba != null && balance_days >= 0) {
......@@ -104,7 +104,7 @@ public class KqglServiceImpl implements KqglService {
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(balance_days).build().updateById();
}
}
return true;
}
......@@ -120,29 +120,29 @@ public class KqglServiceImpl implements KqglService {
for(String num : days) {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(overappr.getUserid()).appTime(num).approvalId(overappr.getOvertimeid()).approvalType(1).duration(overappr.getDuration())
.overtimeTypeId(overappr.getOvertimetype()).compensateId(overappr.getCompensate()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(overappr.getStarttime()))
.endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(overappr.getEndtime())).ordernum(i).orgCode(overappr.getOrgcode()).totals(days.length).build().insert();
.overtimeTypeId(overappr.getOvertimetype()).compensateId(overappr.getCompensate()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(overappr.getStarttime()))
.endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(overappr.getEndtime())).ordernum(i).orgCode(overappr.getOrgcode()).totals(days.length).build().insert();
i++;
}
YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, overappr.getUserid()).eq(YgglMainEmp::getOrgCode, overappr.getOrgcode()));
//查询当前公司调休的id
KqglAssoLeaveRules learul = KqglAssoLeaveRules.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, emp.getOrgCode()).eq(KqglAssoLeaveRules::getRulesType, 2));
//
if(overappr.getCompensate() == 1 || overappr.getCompensate() == 3) {
double duration = 0l;//
int modifynumber = 1;
KqglAssoLeaveBalance balan = kqglassoleavebalancemapper.selectOne(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getUserid, overappr.getUserid()).eq(KqglAssoLeaveBalance::getOrgCode, overappr.getOrgcode())
.orderByDesc(KqglAssoLeaveBalance :: getModifyNumber).last("LIMIT 1"));
if(balan != null) {
modifynumber = balan.getModifyNumber()+1;
}
KqglAssoYhkqz yhd = KqglAssoYhkqz.builder().build().selectOne(new QueryWrapper<KqglAssoYhkqz>().lambda().eq(KqglAssoYhkqz::getUserid, overappr.getUserid()).eq(KqglAssoYhkqz::getQyid, overappr.getOrgcode()));
if(yhd != null) {
KqglAssoOvertimeRange timeran = KqglAssoOvertimeRange.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getAttgroupId, yhd.getKqzid()));
......@@ -178,47 +178,47 @@ public class KqglServiceImpl implements KqglService {
}
}
}
//调休单位是“天”时 按照=》加班时长/班次的工作时长=调休天数
if(learul.getCompany() == 1) {
try {
AttendanceCardListDto attdate = MethodCall(overappr.getOrgcode(),overappr.getUserid(),startdate);//获取当天打卡班次信息
long starttime1 = 0,endtime1 = 0,starttime2 = 0,endtime2 = 0,starttime3 = 0,endtime3 = 0;
long starttime1 = 0,endtime1 = 0,starttime2 = 0,endtime2 = 0,starttime3 = 0,endtime3 = 0;
double time1 = 0,time2 = 0,time3 = 0;
BigDecimal num0 = new BigDecimal(60);
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
List<AttSchedule> ash = attdate.getAttsch();//获取当天应打卡时间
if(attdate.getAttsch().size() == 2 || attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime1 = ash.get(0).getTime();
endtime1 = ash.get(1).getTime();
BigDecimal num = new BigDecimal((endtime1 - starttime1)/1000/60);
time1 = num.divide(num0,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime2 = ash.get(2).getTime();
endtime2 = ash.get(3).getTime();
BigDecimal num = new BigDecimal((endtime2 - starttime2)/1000/60);
starttime1 = ash.get(0).getTime();
endtime1 = ash.get(1).getTime();
BigDecimal num = new BigDecimal((endtime1 - starttime1)/1000/60);
time1 = num.divide(num0,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime2 = ash.get(2).getTime();
endtime2 = ash.get(3).getTime();
BigDecimal num = new BigDecimal((endtime2 - starttime2)/1000/60);
time2 = num.divide(num0,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
if(attdate.getAttsch().size() == 6) {
starttime3 = ash.get(4).getTime();
if(attdate.getAttsch().size() == 6) {
starttime3 = ash.get(4).getTime();
endtime3 = ash.get(5).getTime();
BigDecimal num = new BigDecimal((endtime3 - starttime3)/1000/60);
time3 = num.divide(num0,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
}
}
BigDecimal num1 = new BigDecimal(time1);
BigDecimal num2 = new BigDecimal(time2);
BigDecimal num3 = num1.add(num2);
BigDecimal num4 = new BigDecimal(time3);
double shift_duration = ClockInTool.round(num3.add(num4).doubleValue());//班次时长
if(shift_duration > 0) {
BigDecimal num5 = new BigDecimal(duration);
BigDecimal num6 = new BigDecimal(shift_duration);
......@@ -226,21 +226,21 @@ public class KqglServiceImpl implements KqglService {
//加班时长/班次的工作时长=调休天数
duration = num5.divide(num6,2,BigDecimal.ROUND_HALF_UP).doubleValue();
}
} catch (ParseException e) {
e.printStackTrace();
}
}
KqglAssoLeaveBalance.builder().leaveRulesId(learul.getId()).userid(overappr.getUserid()).modifyAction(2).balanceDays("+"+duration)
.reason("考勤加班审批").modifyUserid(emp.getEmpNum()).modifyTimer(overappr.getStarttime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
.reason("考勤加班审批").modifyUserid(emp.getEmpNum()).modifyTimer(overappr.getStarttime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
//查询员工假期余额表中所对应的假期id
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, learul.getId())
.eq(KqglAssoLeaveEmployeeBalance::getUserid, overappr.getUserid()).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, overappr.getOrgcode()));
//获取最后得到的最终余额
double balance_days = kqglassoleavebalancemapper.Sumbalancedays(overappr.getUserid(), overappr.getOrgcode(),learul.getId());
if(emba != null && balance_days > 0) {
......@@ -249,9 +249,9 @@ public class KqglServiceImpl implements KqglService {
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(balance_days).build().updateById();
}
}
}
return true;
}
......@@ -268,8 +268,8 @@ public class KqglServiceImpl implements KqglService {
for(String num : days) {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(3).duration(evecappr.getDuration())
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime()))
.orgCode(evecappr.getOrgcode()).ordernum(i).totals(days.length).build().insert();
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime()))
.orgCode(evecappr.getOrgcode()).ordernum(i).totals(days.length).build().insert();
i++;
}
}else { //外出
......@@ -280,8 +280,8 @@ public class KqglServiceImpl implements KqglService {
for(String num : days) {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(4).duration(evecappr.getDuration())
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime()))
.orgCode(evecappr.getOrgcode()).ordernum(i).totals(days.length).build().insert();
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime()))
.orgCode(evecappr.getOrgcode()).ordernum(i).totals(days.length).build().insert();
i++;
}
}
......@@ -290,25 +290,25 @@ public class KqglServiceImpl implements KqglService {
@Autowired
private KqglMainKqzMapper kqglmainkqzmapper;
@Autowired
private KqglAssoRelationSummaryMapper kqglassorelationsummarymapper;
/**
* 考勤补卡审批
*/
@Override
public boolean attrepairapproval(AttRepairApprovalDto repaappr) {
String cardrepltime = new SimpleDateFormat("yyyy-MM-dd").format(repaappr.getCardrepltime());//补卡时间
boolean isRange = true;
int atttype = 0;//类型(0:无排班打卡 1:上班 2:下班)
int results = 0;//打卡结果
int type = 0;
long attime = 0l;//应打卡时间戳
int dkmxid = 0;//打卡明细ID
Long start_time = null;
Long end_time = null;
try {
......@@ -317,10 +317,10 @@ public class KqglServiceImpl implements KqglService {
} catch (ParseException e1) {
e1.printStackTrace();
}
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(repaappr.getUserid()).appTime(cardrepltime).approvalId(repaappr.getRepairid()).approvalType(5).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(repaappr.getCardrepltime())).orgCode(repaappr.getOrgcode()).build().insert();
int shifid = 0;
try {
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(repaappr.getUserid(),repaappr.getOrgcode()); //考勤组信息
......@@ -332,490 +332,41 @@ public class KqglServiceImpl implements KqglService {
List<AttSchedule> ash = attdate.getAttsch();//获取当天应打卡时间
shifid = ash.get(0).getId();//班次id
long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0,
endtime3 = 0,endtime3ks = 0,endtime3js = 0;
endtime3 = 0,endtime3ks = 0,endtime3js = 0;
if(attdate.getAttsch().size() == 2 || attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime1 = ash.get(0).getTime();starttime1ks = ash.get(0).getStarttime();starttime1js = ash.get(0).getEndtime();
endtime1 = ash.get(1).getTime();endtime1ks = ash.get(1).getStarttime();endtime1js = ash.get(1).getEndtime();
}
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime2 = ash.get(2).getTime();starttime2ks = ash.get(2).getStarttime();starttime2js = ash.get(2).getEndtime();
endtime2 = ash.get(3).getTime();endtime2ks = ash.get(3).getStarttime();endtime2js = ash.get(3).getEndtime();
starttime1 = ash.get(0).getTime();starttime1ks = ash.get(0).getStarttime();starttime1js = ash.get(0).getEndtime();
endtime1 = ash.get(1).getTime();endtime1ks = ash.get(1).getStarttime();endtime1js = ash.get(1).getEndtime();
}
if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
starttime2 = ash.get(2).getTime();starttime2ks = ash.get(2).getStarttime();starttime2js = ash.get(2).getEndtime();
endtime2 = ash.get(3).getTime();endtime2ks = ash.get(3).getStarttime();endtime2js = ash.get(3).getEndtime();
}
if(attdate.getAttsch().size() == 6) {
starttime3 = ash.get(4).getTime();starttime3ks = ash.get(4).getStarttime();starttime3js = ash.get(4).getEndtime();
if(attdate.getAttsch().size() == 6) {
starttime3 = ash.get(4).getTime();starttime3ks = ash.get(4).getStarttime();starttime3js = ash.get(4).getEndtime();
endtime3 = ash.get(5).getTime();endtime3ks = ash.get(5).getStarttime();endtime3js = ash.get(5).getEndtime();
}
if(ash.get(0).getId() != 0) { //有排班 非休息
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, shifid));
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, repaappr.getUserid()).eq(KqglAssoDkmx::getQyid, repaappr.getOrgcode())
.ge(KqglAssoDkmx::getDksj, start_time).le(KqglAssoDkmx::getDksj, end_time));//获取补卡当天是否有打卡记录
if(dkmc != null) {
dkmxid = dkmc.getId();
if(attdate.getAttsch().size() == 2) {//一套班次
if(repaappr.getCardreplperiod() == 1 && dkmc.getSbdk1() == null) {//上班
if(starttime1ks > 0 && starttime1js > 0) {
// boolean sb1 = verification_range(starttime1ks,starttime1js,repaappr.getCardrepltime());
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1ks);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1js);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(repaappr.getCardrepltime());//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
Logoutput("当前打卡时间不在范围内");
isRange = false;
}
}
int sbdkjg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
if(dkmc.getXbdk1() != null){
Long time1 = (repaappr.getCardrepltime() - dkmc.getXbdk1())/1000/60;
gzsctime = Math.abs(Double.valueOf(time1.toString()));//只打一次卡时计算工作时长
}
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk1(repaappr.getCardrepltime()).sbdk1jg(sbdkjg).dktj1(1).gzsc(gzsctime).build().updateById();
}
atttype = 1;
results = sbdkjg;
attime = starttime1;
}else if(repaappr.getCardreplperiod() == 2 && dkmc.getXbdk1() == null) {//下班
if(endtime1ks > 0 && endtime1js > 0) {
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1ks);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1js);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(repaappr.getCardrepltime());//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
Logoutput("当前打卡时间不在范围内");
isRange = false;
}
}
int xbdk1jg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
if(dkmc.getSbdk1() != null) {
Long time1 = (repaappr.getCardrepltime() - dkmc.getSbdk1())/1000/60;
gzsctime = Math.abs(Double.valueOf(time1.toString()));
}
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk1(repaappr.getCardrepltime()).xbdk1jg(xbdk1jg).dktj2(1).gzsc(gzsctime).build().updateById();
}
atttype = 2;
results = xbdk1jg;
attime = endtime1;
}
}else if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
if(repaappr.getCardreplperiod() == 1) {
boolean sb1 = verification_range(starttime1ks,starttime1js,repaappr.getCardrepltime());
if(sb1 && dkmc.getSbdk1() == null) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk1(repaappr.getCardrepltime()).sbdk1jg(sbdkjg).dktj1(1).gzsc(gzsctime).build().updateById();
atttype = 1;
results = sbdkjg;
attime = starttime1;
}
boolean sb2 = verification_range(starttime2ks,starttime2js,repaappr.getCardrepltime());
if(sb2 && dkmc.getSbdk2() == null) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime2)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk2(repaappr.getCardrepltime()).sbdk2jg(sbdkjg).dktj3(1).gzsc(gzsctime).build().updateById();
atttype = 3;
results = sbdkjg;
attime = starttime2;
}
}else if(repaappr.getCardreplperiod() == 2) {
boolean xb1 = verification_range(endtime1ks,endtime1js,repaappr.getCardrepltime());
if(xb1 && dkmc.getXbdk1() == null) {
int xbdk1jg = 0;
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk1(repaappr.getCardrepltime()).xbdk1jg(xbdk1jg).dktj2(1).gzsc(gzsctime).build().updateById();
atttype = 2;
results = xbdk1jg;
attime = endtime1;
}
boolean xb2 = verification_range(endtime2ks,endtime2js,repaappr.getCardrepltime());
if(xb2 && dkmc.getXbdk2() == null) {
int xbdk2jg = 0;
Long time = (repaappr.getCardrepltime() - endtime2)/1000/60;
if(time > 0){}else{
xbdk2jg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk2(repaappr.getCardrepltime()).xbdk2jg(xbdk2jg).dktj4(1).gzsc(gzsctime).build().updateById();
atttype = 4;
results = xbdk2jg;
attime = endtime2;
}
}
}else if(attdate.getAttsch().size() == 6) {
if(repaappr.getCardreplperiod() == 1) {
boolean sb3 = verification_range(starttime3ks,starttime3js,repaappr.getCardrepltime());
if(sb3 && dkmc.getSbdk3() == null) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime3)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk3(repaappr.getCardrepltime()).sbdk3jg(sbdkjg).dktj5(1).gzsc(gzsctime).build().updateById();
atttype = 5;
results = sbdkjg;
attime = starttime3;
}
}else if(repaappr.getCardreplperiod() == 2) {
boolean xb3 = verification_range(endtime3ks,endtime3js,repaappr.getCardrepltime());
if(xb3 && dkmc.getXbdk3() == null) {
int xbdk3jg = 0;
Long time = (repaappr.getCardrepltime() - endtime3)/1000/60;
if(time > 0){}else{
xbdk3jg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk3(repaappr.getCardrepltime()).xbdk3jg(xbdk3jg).dktj6(1).gzsc(gzsctime).build().updateById();
atttype = 6;
results = xbdk3jg;
attime = endtime3;
}
}
}
}else {//补卡当天无打卡记录时
KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(repaappr.getUserid()).data(cardrepltime).qyid(repaappr.getOrgcode()).dksj(start_time).ydkcs(shif.getSxbcs()*2)
.gzsc(0d).build();
// int yzcd = shif.getYzcdfzs();//严重迟到分钟数
// int kgcdfzs = shif.getKgcdfzs();//旷工迟到分钟数
if(attdate.getAttsch().size() == 2) {//一套班次
if(repaappr.getCardreplperiod() == 1) {//上班
if(starttime1ks > 0 && starttime1js > 0) {
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1ks);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1js);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(repaappr.getCardrepltime());//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
Logoutput("当前打卡时间不在范围内");
isRange = false;
}
}
int sbdkjg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setSbdk1(repaappr.getCardrepltime());
pcd.setSbdk1jg(sbdkjg);
pcd.setDktj1(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
}
atttype = 1;
results = sbdkjg;
attime = starttime1;
}else if(repaappr.getCardreplperiod() == 2) {//下班
if(endtime1ks > 0 && endtime1js > 0) {
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1ks);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1js);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(repaappr.getCardrepltime());//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
Logoutput("当前打卡时间不在范围内");
isRange = false;
}
}
int xbdk1jg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setXbdk1(repaappr.getCardrepltime());
pcd.setXbdk1jg(xbdk1jg);
pcd.setDktj2(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
}
atttype = 2;
results = xbdk1jg;
attime = endtime1;
}
}else if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
if(repaappr.getCardreplperiod() == 1) {
boolean sb1 = verification_range(starttime1ks,starttime1js,repaappr.getCardrepltime());
if(sb1) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setSbdk1(repaappr.getCardrepltime());
pcd.setSbdk1jg(sbdkjg);
pcd.setDktj1(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 1;
results = sbdkjg;
attime = starttime1;
}
boolean sb2 = verification_range(starttime2ks,starttime2js,repaappr.getCardrepltime());
if(sb2) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime2)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setSbdk2(repaappr.getCardrepltime());
pcd.setSbdk2jg(sbdkjg);
pcd.setDktj3(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 3;
results = sbdkjg;
attime = starttime2;
}
}else if(repaappr.getCardreplperiod() == 2) {
boolean xb1 = verification_range(endtime1ks,endtime1js,repaappr.getCardrepltime());
if(xb1) {
int xbdk1jg = 0;
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setXbdk1(repaappr.getCardrepltime());
pcd.setXbdk1jg(xbdk1jg);
pcd.setDktj2(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 2;
results = xbdk1jg;
attime = endtime1;
}
boolean xb2 = verification_range(endtime2ks,endtime2js,repaappr.getCardrepltime());
if(xb2) {
int xbdk2jg = 0;
Long time = (repaappr.getCardrepltime() - endtime2)/1000/60;
if(time > 0){}else{
xbdk2jg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setXbdk2(repaappr.getCardrepltime());
pcd.setXbdk2jg(xbdk2jg);
pcd.setDktj4(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 4;
results = xbdk2jg;
attime = endtime2;
}
}
}else if(attdate.getAttsch().size() == 6) {
if(repaappr.getCardreplperiod() == 1) {
boolean sb3 = verification_range(starttime3ks,starttime3js,repaappr.getCardrepltime());
if(sb3) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime3)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setSbdk3(repaappr.getCardrepltime());
pcd.setSbdk3jg(sbdkjg);
pcd.setDktj5(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 5;
results = sbdkjg;
attime = starttime3;
}
}else if(repaappr.getCardreplperiod() == 2) {
boolean xb3 = verification_range(endtime3ks,endtime3js,repaappr.getCardrepltime());
if(xb3) {
int xbdk3jg = 0;
Long time = (repaappr.getCardrepltime() - endtime3)/1000/60;
if(time > 0){}else{
xbdk3jg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setXbdk3(repaappr.getCardrepltime());
pcd.setXbdk3jg(xbdk3jg);
pcd.setDktj6(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 6;
results = xbdk3jg;
attime = endtime3;
}
}
}
if(isRange) {
dkmxid = pcd.getId();
}else {
throw new CustomException("当前时间,没有考勤异常无需补卡");
}
}
//0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休
//9:管理员改为正常 10:管理员改为迟到 11:管理员改为早退 12:补卡通过/正常 13:补卡通过/迟到 14:补卡通过/早退
int status = 2;
if((atttype)%2 > 0){
type = 1;
if(results == 0) {
status = 12;
}else {
status = 13;
}
}else {
type = 2;
if(results == 0) {
status = 12;
}else {
status = 14;
}
}
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(cardrepltime,"yyyy-MM-dd")).getTime();
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
//attime 应打卡时间
double gzsc = 0;
long rest_time = 0;
if(shif.getStartTime() != null && !("").equals(shif.getStartTime()) && shif.getEndTime() != null && !("").equals(shif.getEndTime())) {
long kaishixiuxi = Long.valueOf(ClockInTool.dateToStamp(cardrepltime + " " +shif.getStartTime()+":00"));
long jieshuxiuxi = Long.valueOf(ClockInTool.dateToStamp(cardrepltime + " " +shif.getEndTime()+":00"));
rest_time = (jieshuxiuxi - kaishixiuxi)/1000/60;//休息时间
}
//请假时长
KqglAssoRelationSummary qjsc = kqglassorelationsummarymapper.Businessdayclockin(repaappr.getUserid(), 2, cardrepltime, repaappr.getOrgcode());
//计算工作时长
KqglAssoDkmx dkgzsc = KqglAssoDkmx.builder().id(dkmxid).build().selectById();
if(dkgzsc.getYdkcs() == 2 || dkgzsc.getYdkcs() == 4 || dkgzsc.getYdkcs() == 6) {
if(dkgzsc.getSbdk1() != null && dkgzsc.getXbdk1() != null) {
gzsc = gzsc + (dkgzsc.getXbdk1() - dkgzsc.getSbdk1())/1000/60;
}
}
if(dkgzsc.getYdkcs() == 4 || dkgzsc.getYdkcs() == 6) {
if(dkgzsc.getSbdk2() != null && dkgzsc.getXbdk2() != null) {
gzsc = gzsc + (dkgzsc.getXbdk2() - dkgzsc.getSbdk2())/1000/60;
}
}
if(dkgzsc.getYdkcs() == 6) {
if(dkgzsc.getSbdk3() != null && dkgzsc.getXbdk3() != null) {
gzsc = gzsc + (dkgzsc.getXbdk3() - dkgzsc.getSbdk3())/1000/60;
}
}
gzsc = gzsc - rest_time - qjsc.getDuration();
KqglAssoDkmx.builder().id(dkmxid).gzsc(gzsc).build().updateById();
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(repaappr.getCardrepltime()).results(results).userId(repaappr.getUserid()).type(type).status(status).sort(atttype)
.cardType(0).qyid(repaappr.getOrgcode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(cardrepltime)).attime(attime).dkmxid(dkmxid).bcid(shifid).remarks("审批补卡通过打卡").punchmode(0)
.punchequipment("").commentary("成功打卡").build();
if (!pre.insert()) {
throw new CustomException("打卡记录-新增异常-2");
}
}
}
if(attgro.getPbfs() == 3){
long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0,
endtime3 = 0,endtime3ks = 0,endtime3js = 0;
}
if(ash.get(0).getId() != 0) { //有排班 非休息
KqglAssoBcsz shif = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, shifid));
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, repaappr.getUserid()).eq(KqglAssoDkmx::getQyid, repaappr.getOrgcode())
.ge(KqglAssoDkmx::getDksj, start_time).le(KqglAssoDkmx::getDksj, end_time));//获取补卡当天是否有打卡记录
if(dkmc != null) {
dkmxid = dkmc.getId();
if(attdate.getAttsch().size() == 2) {//一套班次
if(repaappr.getCardreplperiod() == 1 && dkmc.getSbdk1() == null) {//上班
if(starttime1ks > 0 && starttime1js > 0) {
// boolean sb1 = verification_range(starttime1ks,starttime1js,repaappr.getCardrepltime());
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1ks);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1js);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(repaappr.getCardrepltime());//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
Logoutput("当前打卡时间不在范围内");
isRange = false;
}
}
int sbdkjg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
......@@ -833,7 +384,18 @@ public class KqglServiceImpl implements KqglService {
atttype = 1;
results = sbdkjg;
attime = starttime1;
}else if(repaappr.getCardreplperiod() == 2 && dkmc.getXbdk1() == null) {//下班
if(endtime1ks > 0 && endtime1js > 0) {
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1ks);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1js);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(repaappr.getCardrepltime());//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
Logoutput("当前打卡时间不在范围内");
isRange = false;
}
}
int xbdk1jg = 0;
if(isRange) {
......@@ -851,15 +413,139 @@ public class KqglServiceImpl implements KqglService {
atttype = 2;
results = xbdk1jg;
attime = endtime1;
}
}else if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
if(repaappr.getCardreplperiod() == 1) {
boolean sb1 = verification_range(starttime1ks,starttime1js,repaappr.getCardrepltime());
if(sb1 && dkmc.getSbdk1() == null) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk1(repaappr.getCardrepltime()).sbdk1jg(sbdkjg).dktj1(1).gzsc(gzsctime).build().updateById();
atttype = 1;
results = sbdkjg;
attime = starttime1;
}
boolean sb2 = verification_range(starttime2ks,starttime2js,repaappr.getCardrepltime());
if(sb2 && dkmc.getSbdk2() == null) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime2)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk2(repaappr.getCardrepltime()).sbdk2jg(sbdkjg).dktj3(1).gzsc(gzsctime).build().updateById();
atttype = 3;
results = sbdkjg;
attime = starttime2;
}
}else if(repaappr.getCardreplperiod() == 2) {
boolean xb1 = verification_range(endtime1ks,endtime1js,repaappr.getCardrepltime());
if(xb1 && dkmc.getXbdk1() == null) {
int xbdk1jg = 0;
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk1(repaappr.getCardrepltime()).xbdk1jg(xbdk1jg).dktj2(1).gzsc(gzsctime).build().updateById();
atttype = 2;
results = xbdk1jg;
attime = endtime1;
}
boolean xb2 = verification_range(endtime2ks,endtime2js,repaappr.getCardrepltime());
if(xb2 && dkmc.getXbdk2() == null) {
int xbdk2jg = 0;
Long time = (repaappr.getCardrepltime() - endtime2)/1000/60;
if(time > 0){}else{
xbdk2jg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk2(repaappr.getCardrepltime()).xbdk2jg(xbdk2jg).dktj4(1).gzsc(gzsctime).build().updateById();
atttype = 4;
results = xbdk2jg;
attime = endtime2;
}
}
}else if(attdate.getAttsch().size() == 6) {
if(repaappr.getCardreplperiod() == 1) {
boolean sb3 = verification_range(starttime3ks,starttime3js,repaappr.getCardrepltime());
if(sb3 && dkmc.getSbdk3() == null) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime3)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk3(repaappr.getCardrepltime()).sbdk3jg(sbdkjg).dktj5(1).gzsc(gzsctime).build().updateById();
atttype = 5;
results = sbdkjg;
attime = starttime3;
}
}else if(repaappr.getCardreplperiod() == 2) {
boolean xb3 = verification_range(endtime3ks,endtime3js,repaappr.getCardrepltime());
if(xb3 && dkmc.getXbdk3() == null) {
int xbdk3jg = 0;
Long time = (repaappr.getCardrepltime() - endtime3)/1000/60;
if(time > 0){}else{
xbdk3jg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk3(repaappr.getCardrepltime()).xbdk3jg(xbdk3jg).dktj6(1).gzsc(gzsctime).build().updateById();
atttype = 6;
results = xbdk3jg;
attime = endtime3;
}
}
}
}else {//补卡当天无打卡记录时
KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(repaappr.getUserid()).data(cardrepltime).qyid(repaappr.getOrgcode()).dksj(start_time).ydkcs(2)
KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(repaappr.getUserid()).data(cardrepltime).qyid(repaappr.getOrgcode()).dksj(start_time).ydkcs(shif.getSxbcs()*2)
.gzsc(0d).build();
// int yzcd = shif.getYzcdfzs();//严重迟到分钟数
// int kgcdfzs = shif.getKgcdfzs();//旷工迟到分钟数
if(attdate.getAttsch().size() == 2) {//一套班次
if(repaappr.getCardreplperiod() == 1) {//上班
if(starttime1ks > 0 && starttime1js > 0) {
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1ks);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(starttime1js);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(repaappr.getCardrepltime());//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
Logoutput("当前打卡时间不在范围内");
isRange = false;
}
}
int sbdkjg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setSbdk1(repaappr.getCardrepltime());
pcd.setSbdk1jg(sbdkjg);
pcd.setDktj1(1);
......@@ -871,10 +557,27 @@ public class KqglServiceImpl implements KqglService {
}
atttype = 1;
results = sbdkjg;
attime = starttime1;
}else if(repaappr.getCardreplperiod() == 2) {//下班
if(endtime1ks > 0 && endtime1js > 0) {
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1ks);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(endtime1js);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(repaappr.getCardrepltime());//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
Logoutput("当前打卡时间不在范围内");
isRange = false;
}
}
int xbdk1jg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setXbdk1(repaappr.getCardrepltime());
pcd.setXbdk1jg(xbdk1jg);
pcd.setDktj2(1);
......@@ -883,8 +586,146 @@ public class KqglServiceImpl implements KqglService {
throw new CustomException("打卡明细-新增异常-1");
}
}
atttype = 2;
results = xbdk1jg;
attime = endtime1;
}
}else if(attdate.getAttsch().size() == 4 || attdate.getAttsch().size() == 6) {
if(repaappr.getCardreplperiod() == 1) {
boolean sb1 = verification_range(starttime1ks,starttime1js,repaappr.getCardrepltime());
if(sb1) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setSbdk1(repaappr.getCardrepltime());
pcd.setSbdk1jg(sbdkjg);
pcd.setDktj1(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 1;
results = sbdkjg;
attime = starttime1;
}
boolean sb2 = verification_range(starttime2ks,starttime2js,repaappr.getCardrepltime());
if(sb2) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime2)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setSbdk2(repaappr.getCardrepltime());
pcd.setSbdk2jg(sbdkjg);
pcd.setDktj3(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 3;
results = sbdkjg;
attime = starttime2;
}
}else if(repaappr.getCardreplperiod() == 2) {
boolean xb1 = verification_range(endtime1ks,endtime1js,repaappr.getCardrepltime());
if(xb1) {
int xbdk1jg = 0;
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setXbdk1(repaappr.getCardrepltime());
pcd.setXbdk1jg(xbdk1jg);
pcd.setDktj2(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 2;
results = xbdk1jg;
attime = endtime1;
}
boolean xb2 = verification_range(endtime2ks,endtime2js,repaappr.getCardrepltime());
if(xb2) {
int xbdk2jg = 0;
Long time = (repaappr.getCardrepltime() - endtime2)/1000/60;
if(time > 0){}else{
xbdk2jg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setXbdk2(repaappr.getCardrepltime());
pcd.setXbdk2jg(xbdk2jg);
pcd.setDktj4(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 4;
results = xbdk2jg;
attime = endtime2;
}
}
}else if(attdate.getAttsch().size() == 6) {
if(repaappr.getCardreplperiod() == 1) {
boolean sb3 = verification_range(starttime3ks,starttime3js,repaappr.getCardrepltime());
if(sb3) {
int sbdkjg = 0;
Long time = (repaappr.getCardrepltime() - starttime3)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setSbdk3(repaappr.getCardrepltime());
pcd.setSbdk3jg(sbdkjg);
pcd.setDktj5(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 5;
results = sbdkjg;
attime = starttime3;
}
}else if(repaappr.getCardreplperiod() == 2) {
boolean xb3 = verification_range(endtime3ks,endtime3js,repaappr.getCardrepltime());
if(xb3) {
int xbdk3jg = 0;
Long time = (repaappr.getCardrepltime() - endtime3)/1000/60;
if(time > 0){}else{
xbdk3jg = Math.abs(Integer.valueOf(time.toString()));
}
pcd.setXbdk3(repaappr.getCardrepltime());
pcd.setXbdk3jg(xbdk3jg);
pcd.setDktj6(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
atttype = 6;
results = xbdk3jg;
attime = endtime3;
}
}
}
if(isRange) {
dkmxid = pcd.getId();
}else {
......@@ -922,15 +763,15 @@ public class KqglServiceImpl implements KqglService {
double gzsc = 0;
//long rest_time = 0;
/*if(shif.getStartTime() != null && !("").equals(shif.getStartTime()) && shif.getEndTime() != null && !("").equals(shif.getEndTime())) {
long rest_time = 0;
if(shif.getStartTime() != null && !("").equals(shif.getStartTime()) && shif.getEndTime() != null && !("").equals(shif.getEndTime())) {
long kaishixiuxi = Long.valueOf(ClockInTool.dateToStamp(cardrepltime + " " +shif.getStartTime()+":00"));
long jieshuxiuxi = Long.valueOf(ClockInTool.dateToStamp(cardrepltime + " " +shif.getEndTime()+":00"));
rest_time = (jieshuxiuxi - kaishixiuxi)/1000/60;//休息时间
}*/
}
//请假时长
//KqglAssoRelationSummary qjsc = kqglassorelationsummarymapper.Businessdayclockin(repaappr.getUserid(), 2, cardrepltime, repaappr.getOrgcode());
KqglAssoRelationSummary qjsc = kqglassorelationsummarymapper.Businessdayclockin(repaappr.getUserid(), 2, cardrepltime, repaappr.getOrgcode());
//计算工作时长
KqglAssoDkmx dkgzsc = KqglAssoDkmx.builder().id(dkmxid).build().selectById();
......@@ -949,14 +790,14 @@ public class KqglServiceImpl implements KqglService {
gzsc = gzsc + (dkgzsc.getXbdk3() - dkgzsc.getSbdk3())/1000/60;
}
}
//gzsc = gzsc - rest_time - qjsc.getDuration();
gzsc = gzsc - rest_time - qjsc.getDuration();
KqglAssoDkmx.builder().id(dkmxid).gzsc(gzsc).build().updateById();
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(repaappr.getCardrepltime()).results(results).userId(repaappr.getUserid()).type(type).status(status).sort(atttype)
.cardType(0).qyid(repaappr.getOrgcode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(cardrepltime)).attime(repaappr.getCardrepltime()).dkmxid(dkmxid).bcid(shifid).remarks("审批补卡通过打卡").punchmode(0)
.cardType(0).qyid(repaappr.getOrgcode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(cardrepltime)).attime(attime).dkmxid(dkmxid).bcid(shifid).remarks("审批补卡通过打卡").punchmode(0)
.punchequipment("").commentary("成功打卡").build();
if (!pre.insert()) {
......@@ -965,93 +806,252 @@ public class KqglServiceImpl implements KqglService {
}
}
if(attgro.getPbfs() == 3){
long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0,
endtime3 = 0,endtime3ks = 0,endtime3js = 0;
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, repaappr.getUserid()).eq(KqglAssoDkmx::getQyid, repaappr.getOrgcode())
.ge(KqglAssoDkmx::getDksj, start_time).le(KqglAssoDkmx::getDksj, end_time));//获取补卡当天是否有打卡记录
if(dkmc != null) {
dkmxid = dkmc.getId();
if(repaappr.getCardreplperiod() == 1 && dkmc.getSbdk1() == null) {//上班
int sbdkjg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
if(dkmc.getXbdk1() != null){
Long time1 = (repaappr.getCardrepltime() - dkmc.getXbdk1())/1000/60;
gzsctime = Math.abs(Double.valueOf(time1.toString()));//只打一次卡时计算工作时长
}
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk1(repaappr.getCardrepltime()).sbdk1jg(sbdkjg).dktj1(1).gzsc(gzsctime).build().updateById();
}
atttype = 1;
results = sbdkjg;
}else if(repaappr.getCardreplperiod() == 2 && dkmc.getXbdk1() == null) {//下班
int xbdk1jg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
if(dkmc.getSbdk1() != null) {
Long time1 = (repaappr.getCardrepltime() - dkmc.getSbdk1())/1000/60;
gzsctime = Math.abs(Double.valueOf(time1.toString()));
}
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk1(repaappr.getCardrepltime()).xbdk1jg(xbdk1jg).dktj2(1).gzsc(gzsctime).build().updateById();
}
atttype = 2;
results = xbdk1jg;
}
}else {//补卡当天无打卡记录时
KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(repaappr.getUserid()).data(cardrepltime).qyid(repaappr.getOrgcode()).dksj(start_time).ydkcs(2)
.gzsc(0d).build();
if(repaappr.getCardreplperiod() == 1) {//上班
int sbdkjg = 0;
if(isRange) {
pcd.setSbdk1(repaappr.getCardrepltime());
pcd.setSbdk1jg(sbdkjg);
pcd.setDktj1(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
}
atttype = 1;
}else if(repaappr.getCardreplperiod() == 2) {//下班
int xbdk1jg = 0;
if(isRange) {
pcd.setXbdk1(repaappr.getCardrepltime());
pcd.setXbdk1jg(xbdk1jg);
pcd.setDktj2(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
}
atttype = 2;
}
if(isRange) {
dkmxid = pcd.getId();
}else {
throw new CustomException("当前时间,没有考勤异常无需补卡");
}
}
//0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休
//9:管理员改为正常 10:管理员改为迟到 11:管理员改为早退 12:补卡通过/正常 13:补卡通过/迟到 14:补卡通过/早退
int status = 2;
if((atttype)%2 > 0){
type = 1;
if(results == 0) {
status = 12;
}else {
status = 13;
}
}else {
type = 2;
if(results == 0) {
status = 12;
}else {
status = 14;
}
}
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(cardrepltime,"yyyy-MM-dd")).getTime();
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
//attime 应打卡时间
double gzsc = 0;
//long rest_time = 0;
/*if(shif.getStartTime() != null && !("").equals(shif.getStartTime()) && shif.getEndTime() != null && !("").equals(shif.getEndTime())) {
long kaishixiuxi = Long.valueOf(ClockInTool.dateToStamp(cardrepltime + " " +shif.getStartTime()+":00"));
long jieshuxiuxi = Long.valueOf(ClockInTool.dateToStamp(cardrepltime + " " +shif.getEndTime()+":00"));
rest_time = (jieshuxiuxi - kaishixiuxi)/1000/60;//休息时间
}*/
//请假时长
//KqglAssoRelationSummary qjsc = kqglassorelationsummarymapper.Businessdayclockin(repaappr.getUserid(), 2, cardrepltime, repaappr.getOrgcode());
//计算工作时长
KqglAssoDkmx dkgzsc = KqglAssoDkmx.builder().id(dkmxid).build().selectById();
if(dkgzsc.getYdkcs() == 2 || dkgzsc.getYdkcs() == 4 || dkgzsc.getYdkcs() == 6) {
if(dkgzsc.getSbdk1() != null && dkgzsc.getXbdk1() != null) {
gzsc = gzsc + (dkgzsc.getXbdk1() - dkgzsc.getSbdk1())/1000/60;
}
}
if(dkgzsc.getYdkcs() == 4 || dkgzsc.getYdkcs() == 6) {
if(dkgzsc.getSbdk2() != null && dkgzsc.getXbdk2() != null) {
gzsc = gzsc + (dkgzsc.getXbdk2() - dkgzsc.getSbdk2())/1000/60;
}
}
if(dkgzsc.getYdkcs() == 6) {
if(dkgzsc.getSbdk3() != null && dkgzsc.getXbdk3() != null) {
gzsc = gzsc + (dkgzsc.getXbdk3() - dkgzsc.getSbdk3())/1000/60;
}
}
//gzsc = gzsc - rest_time - qjsc.getDuration();
KqglAssoDkmx.builder().id(dkmxid).gzsc(gzsc).build().updateById();
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(repaappr.getCardrepltime()).results(results).userId(repaappr.getUserid()).type(type).status(status).sort(atttype)
.cardType(0).qyid(repaappr.getOrgcode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(cardrepltime)).attime(repaappr.getCardrepltime()).dkmxid(dkmxid).bcid(shifid).remarks("审批补卡通过打卡").punchmode(0)
.punchequipment("").commentary("成功打卡").build();
if (!pre.insert()) {
throw new CustomException("打卡记录-新增异常-2");
}
}
//}
}
} catch (ParseException e) {
e.printStackTrace();
}
return true;
}
public boolean verification_range(long punchstart,long punchend,long time_) {
boolean isRange = true;
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(punchstart);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(punchend);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_);//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
Logoutput("当前打卡时间不在范围内");
isRange = false;
}
return isRange;
boolean isRange = true;
String staputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(punchstart);//应打卡开始时间
String entputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(punchend);//应打卡结束时间
String DKputime = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(time_);//打卡时间
boolean effectiveDate = ClockInTool.hourMinuteBetween(DKputime, staputime, entputime,"yyyy-MM-dd HH:mm");
if (!effectiveDate) {
Logoutput("当前打卡时间不在范围内");
isRange = false;
}
return isRange;
}
@Autowired
private KqglAssoPbmxMapper kqglassopbmxmapper;
public AttendanceCardListDto MethodCall(int qyid,int userid,String date) throws ParseException {
AttendanceCardListDto attcar = new AttendanceCardListDto();
String str = null;
if(!("").equals(date)){
str = date;
}else{
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
str = sdf.format(d);
}
String str = null;
if(!("").equals(date)){
str = date;
}else{
Date d = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
str = sdf.format(d);
}
// Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(str,"yyyy-MM-dd")).getTime();
// Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(str,"yyyy-MM-dd")).getTime();
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userid,qyid); //考勤组信息
//pbfs:排班方式 1:固定排班;2:自由排班;3:自由工时
if(attgro != null){//判断当前用户是否加入到考勤组
//排班制
KqglAssoPbmxDto jrpb = kqglassopbmxmapper.getScheduleSpecificAttendance(attgro.getId(),userid,str);
//固定排班
int week = Integer.valueOf(ClockInTool.dateToWeek(str));//4
KqglAssoZhoupaiban atwek = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, week).ne(KqglAssoZhoupaiban::getBcid, 0));
if(attgro.getPbfs() == 1){//固定排班
if(atwek != null){//有固定周排班
KqglAssoTeshu rest = KqglAssoTeshu.builder().build().selectOne(new QueryWrapper<KqglAssoTeshu>().lambda().eq(KqglAssoTeshu::getKqzid, attgro.getId())
.eq(KqglAssoTeshu::getTsrq, str).eq(KqglAssoTeshu::getBcid, 0));
if(rest != null){//今天休息 Sort返回0【特殊日期--休息】
List<AttSchedule> atts = new ArrayList<AttSchedule>();
AttSchedule as = AttSchedule.builder().id(0).sort(0).time(0l).starttime(0l).endtime(0l).build();
atts.add(as);
attcar.setAttsch(atts);
}else{//今天上班
KqglAssoBcsz bcz = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, atwek.getBcid()));
if(bcz != null){
Getshiftinformationbatch(bcz,attcar,str);
}
}
}else{//必须打卡
KqglAssoTeshu tsri = KqglAssoTeshu.builder().build().selectOne(new QueryWrapper<KqglAssoTeshu>().lambda().eq(KqglAssoTeshu::getKqzid, attgro.getId())
.eq(KqglAssoTeshu::getTsrq, str).ne(KqglAssoTeshu::getBcid, 0));
if(tsri != null){
KqglAssoBcsz tsrq = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, tsri.getBcid()));
if(tsrq!=null){
Getshiftinformationbatch(tsrq,attcar,str);
}
}else{//休息
List<AttSchedule> atts = new ArrayList<AttSchedule>();
AttSchedule as = AttSchedule.builder().id(0).sort(0).time(0l).starttime(0l).endtime(0l).build();
atts.add(as);
attcar.setAttsch(atts);
}
}
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(userid,qyid); //考勤组信息
//pbfs:排班方式 1:固定排班;2:自由排班;3:自由工时
if(attgro != null){//判断当前用户是否加入到考勤组
//排班制
KqglAssoPbmxDto jrpb = kqglassopbmxmapper.getScheduleSpecificAttendance(attgro.getId(),userid,str);
//固定排班
int week = Integer.valueOf(ClockInTool.dateToWeek(str));//4
KqglAssoZhoupaiban atwek = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getType, week).ne(KqglAssoZhoupaiban::getBcid, 0));
if(attgro.getPbfs() == 1){//固定排班
if(atwek != null){//有固定周排班
KqglAssoTeshu rest = KqglAssoTeshu.builder().build().selectOne(new QueryWrapper<KqglAssoTeshu>().lambda().eq(KqglAssoTeshu::getKqzid, attgro.getId())
.eq(KqglAssoTeshu::getTsrq, str).eq(KqglAssoTeshu::getBcid, 0));
if(rest != null){//今天休息 Sort返回0【特殊日期--休息】
List<AttSchedule> atts = new ArrayList<AttSchedule>();
AttSchedule as = AttSchedule.builder().id(0).sort(0).time(0l).starttime(0l).endtime(0l).build();
atts.add(as);
attcar.setAttsch(atts);
}else{//今天上班
KqglAssoBcsz bcz = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, atwek.getBcid()));
if(bcz != null){
Getshiftinformationbatch(bcz,attcar,str);
}
}
}else{//必须打卡
KqglAssoTeshu tsri = KqglAssoTeshu.builder().build().selectOne(new QueryWrapper<KqglAssoTeshu>().lambda().eq(KqglAssoTeshu::getKqzid, attgro.getId())
.eq(KqglAssoTeshu::getTsrq, str).ne(KqglAssoTeshu::getBcid, 0));
if(tsri != null){
KqglAssoBcsz tsrq = KqglAssoBcsz.builder().build().selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, tsri.getBcid()));
if(tsrq!=null){
Getshiftinformationbatch(tsrq,attcar,str);
}
}else{//休息
List<AttSchedule> atts = new ArrayList<AttSchedule>();
AttSchedule as = AttSchedule.builder().id(0).sort(0).time(0l).starttime(0l).endtime(0l).build();
atts.add(as);
attcar.setAttsch(atts);
}
}
}else if(attgro.getPbfs() == 2){//自由排班
//未排班时,员工可选择班次打卡
// if(attgro.getIsXzbcdk() == 1){
......@@ -1066,203 +1066,203 @@ public class KqglServiceImpl implements KqglService {
Getshiftinformationbatch(tsrq,attcar,str);
}else{//当天排班为休息
List<AttSchedule> atts1 = new ArrayList<AttSchedule>();
AttSchedule as = AttSchedule.builder().id(0).sort(0).time(0l).starttime(0l).endtime(0l).build();
atts1.add(as);
attcar.setAttsch(atts1);
AttSchedule as = AttSchedule.builder().id(0).sort(0).time(0l).starttime(0l).endtime(0l).build();
atts1.add(as);
attcar.setAttsch(atts1);
}
}
}else{//自由工时
KqglAssoZhoupaiban wekz = KqglAssoZhoupaiban.builder().build().selectOne(new QueryWrapper<KqglAssoZhoupaiban>().lambda().eq(KqglAssoZhoupaiban::getKqzid, attgro.getId())
.eq(KqglAssoZhoupaiban::getBcid, 0).eq(KqglAssoZhoupaiban::getType, week));
if(wekz != null){//
String dada = str+" "+attgro.getKqkssjTime()+":00";
attcar.setStapclotime(Long.valueOf(ClockInTool.dateToStamp(dada)));
}
if(!("").equals(attgro.getJbzdsc())){
attcar.setCanpunchworkdate(Double.valueOf(attgro.getJbzdsc()));//上班打卡后多久大下班卡
}
}
if(jrpb != null || atwek != null){
KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
if(attgro.getPbfs() == 1){
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, atwek.getBcid()));
}else if(attgro.getPbfs() == 2){
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, jrpb.getBcid()));
}
if(shif != null){
if(shif.getIsXbdk() == 1){
attcar.setNoclockout(true);// 下班不用打卡
}else{
attcar.setNoclockout(false);// 下班不用打卡
}
attcar.setAllowlate(shif.getYxcdfzs());// 允许迟到分钟数
attcar.setSeriouslate(shif.getYzcdfzs());// 严重迟到分钟数
attcar.setAbsenteeismlate(shif.getKgcdfzs());// 旷工迟到分钟数
if(shif.getIsWzwd() == 1){
attcar.setIslatelate(true);// 晚走晚到
List<AttLateLate> atwzwd = new ArrayList<AttLateLate>();
int p = 0;
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1())){p = 2;}
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1()) && !("").equals(shif.getXbwz2()) && !("").equals(shif.getSbwd2())){p = 4;}
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1()) && !("").equals(shif.getXbwz2()) && !("").equals(shif.getSbwd2()) && !("").equals(shif.getXbwz3()) && !("").equals(shif.getSbwd3())){p = 6;}
AttLateLate ala = AttLateLate.builder().build();
ala.setLatewalk(shif.getXbwz1());
ala.setArrivelate(shif.getSbwd1());
atwzwd.add(ala);
if(p == 4 || p == 6){
AttLateLate alat = AttLateLate.builder().build();
alat.setLatewalk(shif.getXbwz2());
alat.setArrivelate(shif.getSbwd2());
atwzwd.add(alat);
}
if(p == 6){
AttLateLate alas = AttLateLate.builder().build();
alas.setLatewalk(shif.getXbwz3());
alas.setArrivelate(shif.getSbwd3());
atwzwd.add(alas);
}
attcar.setAttlat(atwzwd);
}else{
attcar.setIslatelate(false);// 晚走晚到
}
}
}
attcar.setAttgrouptype(attgro.getPbfs());//1:固定排班;2:自由排班;3:自由工时
}else{
attcar.setAttgrouptype(0);//1:固定排班;2:自由排班;3:自由工时
}
return attcar;
}
if(jrpb != null || atwek != null){
KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
if(attgro.getPbfs() == 1){
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, atwek.getBcid()));
}else if(attgro.getPbfs() == 2){
shif = shif.selectOne(new QueryWrapper<KqglAssoBcsz>().lambda().eq(KqglAssoBcsz::getId, jrpb.getBcid()));
}
if(shif != null){
if(shif.getIsXbdk() == 1){
attcar.setNoclockout(true);// 下班不用打卡
}else{
attcar.setNoclockout(false);// 下班不用打卡
}
attcar.setAllowlate(shif.getYxcdfzs());// 允许迟到分钟数
attcar.setSeriouslate(shif.getYzcdfzs());// 严重迟到分钟数
attcar.setAbsenteeismlate(shif.getKgcdfzs());// 旷工迟到分钟数
if(shif.getIsWzwd() == 1){
attcar.setIslatelate(true);// 晚走晚到
List<AttLateLate> atwzwd = new ArrayList<AttLateLate>();
int p = 0;
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1())){p = 2;}
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1()) && !("").equals(shif.getXbwz2()) && !("").equals(shif.getSbwd2())){p = 4;}
if(!("").equals(shif.getXbwz1()) && !("").equals(shif.getSbwd1()) && !("").equals(shif.getXbwz2()) && !("").equals(shif.getSbwd2()) && !("").equals(shif.getXbwz3()) && !("").equals(shif.getSbwd3())){p = 6;}
AttLateLate ala = AttLateLate.builder().build();
ala.setLatewalk(shif.getXbwz1());
ala.setArrivelate(shif.getSbwd1());
atwzwd.add(ala);
if(p == 4 || p == 6){
AttLateLate alat = AttLateLate.builder().build();
alat.setLatewalk(shif.getXbwz2());
alat.setArrivelate(shif.getSbwd2());
atwzwd.add(alat);
}
if(p == 6){
AttLateLate alas = AttLateLate.builder().build();
alas.setLatewalk(shif.getXbwz3());
alas.setArrivelate(shif.getSbwd3());
atwzwd.add(alas);
}
attcar.setAttlat(atwzwd);
}else{
attcar.setIslatelate(false);// 晚走晚到
}
}
}
attcar.setAttgrouptype(attgro.getPbfs());//1:固定排班;2:自由排班;3:自由工时
}else{
attcar.setAttgrouptype(0);//1:固定排班;2:自由排班;3:自由工时
}
return attcar;
}
public void Getshiftinformationbatch(KqglAssoBcsz shiftm,AttendanceCardListDto attcar,String str){
int isXbdk1Cr = shiftm.getIsXbdk1Cr();//下班1是否次日(0:否;1:是)
int isSbdk2Cr = shiftm.getIsSbdk2Cr();//上班2是否次日(0:否;1:是)
int isXbdk2Cr = shiftm.getIsXbdk2Cr();//下班2是否次日(0:否;1:是)
int isSbdk3Cr = shiftm.getIsSbdk3Cr();//上班3是否次日(0:否;1:是)
int isXbdk3Cr = shiftm.getIsXbdk3Cr();//下班3是否次日(0:否;1:是)
//次日专用
String next_day = ClockInTool.requires_extra_times(str,1,2,1);
List<AttSchedule> atts = new ArrayList<AttSchedule>();
if(shiftm.getSxbcs() == 1 || shiftm.getSxbcs() == 2 || shiftm.getSxbcs() == 3){//1次上下班
for(int o=0;o<2;o++){
if(o==0){
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(1).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbdk1()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks1()) || shiftm.getSbqjks1() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjks1()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs1()) || shiftm.getSbqjjs1() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjjs1()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}else{
//次日
if(isXbdk1Cr > 0) {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(2).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbdk1()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks1()) || shiftm.getXbqjks1() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjks1()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs1()) || shiftm.getXbqjjs1() ==null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjjs1()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(2).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbdk1()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks1()) || shiftm.getXbqjks1() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjks1()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs1()) || shiftm.getXbqjjs1() ==null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjjs1()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}
}
attcar.setAttsch(atts);
}
if(shiftm.getSxbcs() == 2 || shiftm.getSxbcs() == 3){//2次上下班
for(int o=0;o<2;o++){
if(o==0){
if(isSbdk2Cr > 0) {//次日
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(3).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbdk2()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks2())|| shiftm.getSbqjks2()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbqjks2()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs2()) || shiftm.getSbqjjs2()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbqjjs2()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(3).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbdk2()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks2())|| shiftm.getSbqjks2()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjks2()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs2()) || shiftm.getSbqjjs2()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjjs2()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}else{
if(isXbdk2Cr > 0) {//次日
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(4).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbdk2()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks2()) || shiftm.getXbqjks2()== null? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjks2()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs2()) || shiftm.getXbqjjs2()== null? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjjs2()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(4).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbdk2()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks2()) || shiftm.getXbqjks2()== null? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjks2()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs2()) || shiftm.getXbqjjs2()== null? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjjs2()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}
}
attcar.setAttsch(atts);
}
if(shiftm.getSxbcs() == 3){//3次上下班
for(int o=0;o<2;o++){
if(o==0){
if(isSbdk3Cr > 0) {//次日
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(5).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbdk3()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks3()) || shiftm.getSbqjks3() == null? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbqjks3()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs3()) || shiftm.getSbqjjs3() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbqjjs3()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(5).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbdk3()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks3()) || shiftm.getSbqjks3() == null? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjks3()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs3()) || shiftm.getSbqjjs3() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjjs3()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}else{
if(isXbdk3Cr > 0) {//次日
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(6).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbdk3()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks3()) || shiftm.getXbqjks3()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjks3()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs3()) || shiftm.getXbqjjs3() ==null? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjjs3()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(6).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbdk3()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks3()) || shiftm.getXbqjks3()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjks3()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs3()) || shiftm.getXbqjjs3() ==null? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjjs3()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}
}
attcar.setAttsch(atts);
}
}
List<AttSchedule> atts = new ArrayList<AttSchedule>();
if(shiftm.getSxbcs() == 1 || shiftm.getSxbcs() == 2 || shiftm.getSxbcs() == 3){//1次上下班
for(int o=0;o<2;o++){
if(o==0){
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(1).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbdk1()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks1()) || shiftm.getSbqjks1() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjks1()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs1()) || shiftm.getSbqjjs1() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjjs1()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}else{
//次日
if(isXbdk1Cr > 0) {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(2).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbdk1()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks1()) || shiftm.getXbqjks1() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjks1()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs1()) || shiftm.getXbqjjs1() ==null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjjs1()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(2).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbdk1()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks1()) || shiftm.getXbqjks1() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjks1()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs1()) || shiftm.getXbqjjs1() ==null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjjs1()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}
}
attcar.setAttsch(atts);
}
if(shiftm.getSxbcs() == 2 || shiftm.getSxbcs() == 3){//2次上下班
for(int o=0;o<2;o++){
if(o==0){
if(isSbdk2Cr > 0) {//次日
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(3).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbdk2()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks2())|| shiftm.getSbqjks2()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbqjks2()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs2()) || shiftm.getSbqjjs2()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbqjjs2()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(3).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbdk2()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks2())|| shiftm.getSbqjks2()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjks2()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs2()) || shiftm.getSbqjjs2()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjjs2()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}else{
if(isXbdk2Cr > 0) {//次日
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(4).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbdk2()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks2()) || shiftm.getXbqjks2()== null? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjks2()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs2()) || shiftm.getXbqjjs2()== null? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjjs2()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(4).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbdk2()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks2()) || shiftm.getXbqjks2()== null? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjks2()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs2()) || shiftm.getXbqjjs2()== null? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjjs2()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}
}
attcar.setAttsch(atts);
}
if(shiftm.getSxbcs() == 3){//3次上下班
for(int o=0;o<2;o++){
if(o==0){
if(isSbdk3Cr > 0) {//次日
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(5).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbdk3()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks3()) || shiftm.getSbqjks3() == null? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbqjks3()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs3()) || shiftm.getSbqjjs3() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getSbqjjs3()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(5).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbdk3()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getSbqjks3()) || shiftm.getSbqjks3() == null? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjks3()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getSbqjjs3()) || shiftm.getSbqjjs3() == null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getSbqjjs3()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}else{
if(isXbdk3Cr > 0) {//次日
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(6).time(Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbdk3()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks3()) || shiftm.getXbqjks3()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjks3()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs3()) || shiftm.getXbqjjs3() ==null? 0 : Long.valueOf(ClockInTool.dateToStamp((next_day+" "+shiftm.getXbqjjs3()+":00").replaceAll("\r|\n", ""))))
.nextday(1).build();
atts.add(as);
}else {
AttSchedule as = AttSchedule.builder().id(shiftm.getId()).sort(6).time(Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbdk3()+":00").replaceAll("\r|\n", ""))))
.starttime(("").equals(shiftm.getXbqjks3()) || shiftm.getXbqjks3()== null ? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjks3()+":00").replaceAll("\r|\n", ""))))
.endtime(("").equals(shiftm.getXbqjjs3()) || shiftm.getXbqjjs3() ==null? 0 : Long.valueOf(ClockInTool.dateToStamp((str+" "+shiftm.getXbqjjs3()+":00").replaceAll("\r|\n", ""))))
.nextday(0).build();
atts.add(as);
}
}
}
attcar.setAttsch(atts);
}
}
@Value("${config-8timer.environmental-science}")
public String environmental_science;
public void Logoutput(String science) {
if(!("pro").equals(environmental_science)) {
System.out.println(science);
}else {
System.out.println("");
}
}
}
......@@ -3,11 +3,16 @@ package cn.timer.api.controller.qyxx;
import java.util.*;
import cn.timer.api.bean.qyxx.*;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.dto.qyxx.CmsContentReadDto;
import cn.timer.api.utils.redis.RedisUtil;
import com.github.yulichang.query.MPJQueryWrapper;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
......@@ -47,7 +52,7 @@ import javax.annotation.Resource;
@RestController
@Api(tags = "5.0企业讯息")
@Transactional
@RequestMapping(value = "/qyxx", produces = { "application/json" })
@RequestMapping(value = "/qyxx", produces = {"application/json"})
@Slf4j
public class CmsController {
......@@ -57,6 +62,7 @@ public class CmsController {
@Autowired
private CmsIsReadMapper cmsIsReadMapper;
// @Autowired
// private CmsAnnouncementMapper cmsAnnouncementMapper;
......@@ -106,7 +112,6 @@ public class CmsController {
List<CmsContent> picList = CmsContent.builder().build().selectList(qw);
map.put("list",qynr);
map.put("picList",picList);
return ResultUtil.data(map, "查询分类成功!");
}
......@@ -145,7 +150,6 @@ public class CmsController {
/**
* 分类内容获取
*
*/
@GetMapping(value = "/getType")
@ApiOperation(value = "分类内容获取", httpMethod = "GET", notes = "接口发布说明")
......@@ -164,8 +168,8 @@ public class CmsController {
.leftJoin("cms_content_read ccr on t.id = ccr.cms_content_id");
queryWrapper.eq("t.releasestate", 0)
.and(!StringUtils.isEmpty(userBean.getEmpNum()), wq -> wq.eq("t.open_status", 1)
.or(true,q -> q.eq("t.open_status", 0).eq("ccr.user_id",userBean.getEmpNum()))
.or(true,q -> q.eq("t.open_status", 0).eq("t.userid",userBean.getEmpNum())))
.or(true, q -> q.eq("t.open_status", 0).eq("ccr.user_id", userBean.getEmpNum()))
.or(true, q -> q.eq("t.open_status", 0).eq("t.userid", userBean.getEmpNum())))
.eq("t.organization_id", userBean.getOrgCode()).eq("t.modularid", id)
.groupBy("t.id")
.orderByDesc("t.releasetime")
......@@ -178,7 +182,6 @@ public class CmsController {
/**
* 获取分类
*
*/
@GetMapping(value = "/xxfl")
@ApiOperation(value = "获取分类", httpMethod = "GET", notes = "接口发布说明")
......@@ -186,7 +189,7 @@ public class CmsController {
return ResultUtil.data(CmsContentModular.builder().build().selectList(new QueryWrapper<CmsContentModular>()
// .eq("organization_id", userBean.getOrgCode())
.eq("is_open", 0)
.orderByAsc("sort")), "查询分类成功!");
.orderByAsc("sort")), "查询分类成功!");
}
/**
......@@ -208,7 +211,7 @@ public class CmsController {
// qynr.setXxbh("XX" + i++);
Boolean a = qynr.getId() == null;
if(a){
if (a) {
qynr.setUserid(empNum);
}
if (a && qynr.getPublisher() == null)
......@@ -229,16 +232,16 @@ public class CmsController {
.eq(YgglMainEmp::getOrgCode, orgCode).eq(YgglMainEmp::getEmpNum, empNum)).getName());
qynr.setReleasetype(fbfs);
qynr.setStatus(0);
if(fbfs != null && fbfs == 4){
if (fbfs != null && fbfs == 4) {
qynr.setReleasestate(0);
qynr.setStatus(1);
qynr.setReleasetime(now.toString());
}
qynr.insertOrUpdate();
// 新增 文件传阅 人员数据
if(a){
if(!CollectionUtils.isEmpty(cmsContentDto.getCmsContentReads())){
for (CmsContentRead entity :cmsContentDto.getCmsContentReads() ) {
if (a) {
if (!CollectionUtils.isEmpty(cmsContentDto.getCmsContentReads())) {
for (CmsContentRead entity : cmsContentDto.getCmsContentReads()) {
entity.setCmsContentId(qynr.getId());
entity.setOrgCode(orgCode);
entity.setReadStatus(0);
......@@ -248,8 +251,8 @@ public class CmsController {
}
}
if (a){
String msg = fbfs==4?"提交成功":"提交成功、等待管理员审核";
if (a) {
String msg = fbfs == 4 ? "提交成功" : "提交成功、等待管理员审核";
return ResultUtil.data(qynr, msg);
} else {
return ResultUtil.data(qynr, "修改成功");
......@@ -351,7 +354,7 @@ public class CmsController {
MPJQueryWrapper<CmsContent> queryWrapper = new MPJQueryWrapper<>();
queryWrapper.selectAll(CmsContent.class)
.leftJoin("cms_content_read ccr on t.id = ccr.cms_content_id");
queryWrapper.and(!StringUtils.isEmpty(userBean.getEmpNum()), wq -> wq.eq("t.open_status", 1).or(true,sq -> sq.eq("t.open_status", 0).eq("ccr.user_id",userBean.getEmpNum())));
queryWrapper.and(!StringUtils.isEmpty(userBean.getEmpNum()), wq -> wq.eq("t.open_status", 1).or(true, sq -> sq.eq("t.open_status", 0).eq("ccr.user_id", userBean.getEmpNum())));
queryWrapper.eq("t.organization_id", userBean.getOrgCode()).eq("t.status", 1).eq("t.releasestate", 0)
.eq(t != null && t > -1, "t.modularid", t).eq(r != null && r > -1, "t.releasestate", r)
.between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "t.releasetime",
......@@ -402,6 +405,35 @@ public class CmsController {
return ResultUtil.data(cmsContentPage, cmsContents, "企业OA讯息搜索成功");
}
@PostMapping(value = "/oaCirculate")
@ApiOperation(value = "搜索OA文件传阅记录", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> oaCirculate(@CurrentUser UserBean userBean, @RequestBody QyxxQueryDto qyxxQueryDto) {
String s = qyxxQueryDto.getStartTime();
String e = qyxxQueryDto.getEndTime();
Integer r = qyxxQueryDto.getReleasestate();
Page<CmsContent> page = new Page<CmsContent>(
qyxxQueryDto.getCurrentPage() == null ? 1 : qyxxQueryDto.getCurrentPage(),
qyxxQueryDto.getTotalPage() == null ? 10 : qyxxQueryDto.getTotalPage());
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("organization_id", userBean.getOrgCode())
.eq("modularid", 7).eq(r != null && r > -1, "releasestate", r)
.between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "releasetime",
!StrUtil.hasBlank(s) ? s : "1000-01-01 00:00:00",
!StrUtil.hasBlank(e) ? e : "9999-01-01 00:00:00")
.and(wq -> wq.eq("publisher", userBean.getEmpNum()).or().eq("author", userBean.getUserInfo().getName()).or().inSql("id", "select cms_content_id from cms_content_read where user_id =" + userBean.getEmpNum()))
.orderByDesc("addeddate");
IPage<CmsContent> cmsContentPage = CmsContent.builder().build().selectPage(page, queryWrapper);
List<CmsContent> cmsContents = cmsContentPage.getRecords();
cmsContentPage.getCurrent();
cmsContentPage.getPages();
cmsContentPage.getTotal();
cmsContentPage.getSize();
return ResultUtil.data(cmsContentPage, cmsContents, "企业OA讯息搜索成功");
}
/**
* 根据id查讯息
*
......@@ -442,7 +474,7 @@ public class CmsController {
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("organization_id", userBean.getOrgCode())
.select("id", "publisher_name", "auditopinion", "modularid", "status", "title", "releasetime",
"addeddate", "author", "summary", "releasetype", "fmtpath","filepath","open_status")
"addeddate", "author", "summary", "releasetype", "fmtpath", "filepath", "open_status")
.ne("status", 1).eq(t != null && t > -1, "modularid", t)
.between(!StrUtil.hasBlank(s) && !StrUtil.hasBlank(e), "releasetime",
!StrUtil.hasBlank(s) ? s : "1000-01-01 00:00:00",
......@@ -500,7 +532,6 @@ public class CmsController {
* 添加已读
*
* @param userBean
* @param id
* @return
*/
@GetMapping(value = "/isread")
......@@ -544,7 +575,7 @@ public class CmsController {
@PostMapping(value = "/addCarousel")
@ApiOperation(value = "新增轮播信息", httpMethod = "POST", notes = "接口发布说明")
public Result<CmsAnnouncement> addCarousel(@CurrentUser UserBean userBean,
@RequestBody CmsAnnouncement cmsAnnouncement) {
@RequestBody CmsAnnouncement cmsAnnouncement) {
cmsAnnouncement.setFbrid(userBean.getEmpNum());
cmsAnnouncement.setFbtime(new Date());
cmsAnnouncement.setOrgCode(userBean.getOrgCode());
......@@ -623,6 +654,7 @@ public class CmsController {
/**
* 查询传阅列表
*
* @return
*/
@PostMapping(value = "/getCmsContentReads")
......@@ -632,7 +664,7 @@ public class CmsController {
//查询传阅列表
IPage<CmsContentRead> cmsContentReads = CmsContentRead.builder().build()
.selectPage(page, new QueryWrapper<CmsContentRead>()
.lambda().eq(CmsContentRead::getCmsContentId, cmsContentReadDto.getCmsContentId()).orderByDesc(CmsContentRead::getReviewTime));
.lambda().eq(CmsContentRead::getCmsContentId, cmsContentReadDto.getCmsContentId()).orderByDesc(CmsContentRead::getReviewTime));
return ResultUtil.data(cmsContentReads);
}
......@@ -648,17 +680,17 @@ public class CmsController {
.selectOne(new QueryWrapper<CmsContentRead>().lambda()
.eq(CmsContentRead::getUserId, userBean.getEmpNum())
.eq(CmsContentRead::getOrgCode, userBean.getOrgCode())
.eq(CmsContentRead::getCmsContentId,id));
.eq(CmsContentRead::getCmsContentId, id));
if(cmsContentRead == null){
if (cmsContentRead == null) {
cmsContentRead = new CmsContentRead();
cmsContentRead.setUserId(userBean.getEmpNum());
cmsContentRead.setUserName(userBean.getUserInfo().getName());
cmsContentRead.setOrgCode(userBean.getOrgCode());
cmsContentRead.setCmsContentId(id);
}else {
} else {
//已阅 直接返回
if(cmsContentRead.getReadStatus() == 1){
if (cmsContentRead.getReadStatus() == 1) {
return ResultUtil.data(1);
}
}
......@@ -667,7 +699,7 @@ public class CmsController {
cmsContentRead.setReadStatus(1);
cmsContentRead.setReviewTime(new Date());
cmsContentRead.insertOrUpdate();
}catch (Exception e){
} catch (Exception e) {
log.error("=============已阅操作失败, " + e);
return ResultUtil.error(e);
}
......@@ -676,6 +708,7 @@ public class CmsController {
/**
* 根据讯息id查传阅列表
*
* @return
*/
@PostMapping(value = "/comment")
......@@ -686,11 +719,11 @@ public class CmsController {
.selectOne(new QueryWrapper<CmsContentRead>().lambda()
.eq(CmsContentRead::getUserId, userBean.getEmpNum())
.eq(CmsContentRead::getOrgCode, userBean.getOrgCode())
.eq(CmsContentRead::getCmsContentId,cmsContentReadDto.getCmsContentId()));
.eq(CmsContentRead::getCmsContentId, cmsContentReadDto.getCmsContentId()));
try {
cmsContentRead.setReviewContent(cmsContentReadDto.getReviewContent());
cmsContentRead.insertOrUpdate();
}catch (Exception e){
} catch (Exception e) {
log.error("=============评论失败, " + e);
return ResultUtil.error(e);
}
......@@ -698,18 +731,63 @@ public class CmsController {
}
/**
* 根据讯息id查传阅增加文件
*
* @return
*/
@PostMapping(value = "/cmsAddFile")
@ApiOperation(value = "文件传阅增加文件", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> cmsAddFile(@CurrentUser UserBean userBean, @RequestBody JSONObject request) {
String cmsContentId = request.getString("cmsContentId");
//用户id查询传阅消息
QueryWrapper<CmsContent> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", cmsContentId);
CmsContent cmsContent = CmsContent.builder().build().selectOne(queryWrapper);
JSONArray addjsonArray = JSONArray.fromObject(request.getString("filepathcms"));
JSONArray resjsonArray = JSONArray.fromObject(cmsContent.getFilepath());
resjsonArray.addAll(addjsonArray);
cmsContent.setFilepath(resjsonArray.toString());
cmsContentMapper.updateById(cmsContent);
return ResultUtil.data(resjsonArray.toString());
}
/**
* 添加传阅人员
*
* @return
*/
@PostMapping(value = "/addReadPersonnel")
@ApiOperation(value = "添加传阅人员", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> addReadPersonnel(@CurrentUser UserBean userBean, @RequestBody List<CmsContentRead> cmsContentReads) {
for (CmsContentRead ccr:cmsContentReads
) {
for (CmsContentRead ccr : cmsContentReads
) {
ccr.insert();
}
return ResultUtil.success();
}
@PostMapping(value = "/getUnreadCmsList")
@ApiOperation(value = "获取当前用户的未读传阅列表", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> shxxquery(@CurrentUser UserBean userBean) {
return ResultUtil.data(cmsIsReadMapper.getUnreadList(userBean.getEmpNum()));
}
@PostMapping(value = "/adminDeleteFile")
@ApiOperation(value = "管理员删除附件", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> adminDeleteFile(@CurrentUser UserBean userBean, @RequestBody CmsContentReadDto cmsContentReadDto) {
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if (ent.getUserType() == 2) {
return ResultUtil.error("当前用户没有权限操作");
}
CmsContent cmsContent = CmsContent.builder().id(cmsContentReadDto.getId()).build().selectById();
JSONArray resjsonArray = JSONArray.fromObject(cmsContent.getFilepath());
/*不转为int会默认使用remove(object)*/
resjsonArray.remove((int)cmsContentReadDto.getFileIndex());
cmsContent.setFilepath(resjsonArray.toString());
cmsContent.updateById();
return ResultUtil.success("删除附件成功");
}
}
package cn.timer.api.controller.spmk;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.spmk.SpmkApproveDetailSummary;
import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.bean.spmk.SpmkExecutor;
import cn.timer.api.bean.zzgl.ZzglAuth;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.enuminterface.SpmkEnumInterface.ApproveSummarySts;
import cn.timer.api.config.enuminterface.SpmkEnumInterface.ExecutorSts;
import cn.timer.api.config.enums.CommonEnum;
import cn.timer.api.config.enums.SysRoleType;
import cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper;
import cn.timer.api.dao.spmk.SpmkApproveExecuteRecordMapper;
import cn.timer.api.dao.spmk.SpmkApproveSummaryMapper;
import cn.timer.api.dao.spmk.SpmkExecutorMapper;
import cn.timer.api.dto.spmk.AdminApprovingDto;
import cn.timer.api.dto.spmk.FlowChildren;
import cn.timer.api.dto.spmk.FromData;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import cn.timer.api.utils.redis.RedisUtil;
import cn.timer.api.utils.router.RouterUtils;
import cn.timer.api.utils.router.business.SpmkAssoBusiness;
import cn.timer.api.utils.router.business.SpmkAssoBusinessFactory;
import cn.timer.api.utils.router.enums.ApproveEnum;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
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.RestController;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Slf4j
@Api(tags = "3.0Admin审批模块")
@RestController
@Transactional
@RequestMapping(value = "/admin/spmk", produces = { "application/json","multipart/form-data" })
public class AdminSpmkController {
@Autowired
private QyzxEmpEntAssoMapper qyzxEmpEntAssoMapper;
@Autowired
private SpmkApproveSummaryMapper spmkApproveSummaryMapper;
@Autowired
private SpmkExecutorMapper spmkExecutorMapper;
@Autowired
private SpmkAssoBusinessFactory spmkAssoBusinessFactory;
@Autowired
private SpmkApproveExecuteRecordMapper spmkApproveExecuteRecordMapper;
private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
@Resource
private RedisUtil redisUtil;
//TODO 管理员审批
/**
* 管理员审批
*/
@PostMapping(value = "/approving")
@ApiOperation(value = "1.审批人审批", httpMethod = "POST", notes = "审批人审批")
@Transactional(rollbackFor = Exception.class)
@ApiOperationSupport(order = 20)
@Log(title = "审批-审批流程", businessType = BusinessType.UPDATE)
public Result<Object> approving(@CurrentUser UserBean userBean,@Validated @RequestBody AdminApprovingDto approvingDto) throws Exception {
/*判断是否有权限转派*/
//if(approvingDto.getSts()==4){
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if(ent != null) {
/*超管和管理员不受权限控制*/
if(ent.getUserType() == 2) {
ZzglAuth zzglAuth = ZzglAuth.builder().build().selectOne(new QueryWrapper<ZzglAuth>().lambda().eq(ZzglAuth::getBmgwId, userBean.getUserInfo().getBmgwId())
.eq(ZzglAuth::getMenuId, "/Approvalspbutonspbuton020102"));
if (zzglAuth == null) {
return ResultUtil.error("您没有权限");
}
}
}
//}
Integer asId = approvingDto.getAsId();
//查询redis中当前有没有在被审批执行中,0是没有在执行,1是在执行
Integer approStatus=Integer.parseInt(redisUtil.get(asId.toString())==null?"0":redisUtil.get(asId.toString()).toString());
if(approStatus==1){
return ResultUtil.error("该审批已在审批中!");
}else{
redisUtil.set(asId.toString(),1,2);
}
SpmkApproveDetailSummary ad = SpmkApproveDetailSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailSummary>()
.lambda()
.select(SpmkApproveDetailSummary::getId,
SpmkApproveDetailSummary::getRequestData,
SpmkApproveDetailSummary::getFroms,
SpmkApproveDetailSummary::getFlowChildren)
.eq(SpmkApproveDetailSummary::getApproveSummaryId, asId));
// 查询 SpmkApproveSummary 状态,
SpmkApproveSummary aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda()
.select(SpmkApproveSummary::getSts)
.eq(SpmkApproveSummary::getId, asId));
// if (aSummary.getSts() > ApproveSummarySts.IN.ordinal()) {
// redisUtil.set(asId.toString(),0,500);
// return ResultUtil.error("该审批已结束!");
// }
//
// // 查询该 审批的状态 是否为 1 审批中
// Integer count = SpmkExecutor.builder().build().selectCount(new QueryWrapper<SpmkExecutor>().lambda()
// .eq(SpmkExecutor::getId, approvingDto.getExecutorId())
// .eq(SpmkExecutor::getSts, ExecutorSts.IN_EXECUTION.ordinal()));
//
// if (count == 0) {
// redisUtil.set(asId.toString(),0,500);
// return ResultUtil.error("您已审批过!");
// }
if ( spmkExecutorMapper.selectCount(new QueryWrapper<SpmkExecutor>().lambda()
.eq(SpmkExecutor::getId, approvingDto.getExecutorId())
.eq(SpmkExecutor::getEmpNum, userBean.getEmpNum())
.eq(SpmkExecutor::getSts, ExecutorSts.IN_EXECUTION.ordinal())) == 0) {
Integer adminNum = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode())
.in(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_ADMIN,SysRoleType.U_TYPE_C_ADMIN)
.count();
if (adminNum <= 0) {
redisUtil.set(asId.toString(),0,500);
return ResultUtil.error("非当前审批人 或 管理员,无法操作!");
}
}
//如果是再次审批
SpmkApproveExecuteRecord spmkApproveExecuteRecord = SpmkApproveExecuteRecord.builder().id(approvingDto.getExecuteRecordId()).build().selectById();
if(spmkApproveExecuteRecord.getSts()>1){
spmkApproveExecuteRecordMapper.delExecuteRecord(approvingDto.getExecuteRecordId(), asId);
}
List<FlowChildren> listFlowChildren = jsonObject.parseArray(ad.getFlowChildren(),FlowChildren.class);
RouterUtils.updateRefuseToAgree(
listFlowChildren,
asId,
approvingDto.getExecuteRecordId(),
approvingDto.getExecutorId(),
approvingDto.getOpinion(),
approvingDto.getSts(),
aSummary.getSts(),
approvingDto.getUser(),
approvingDto.getSignatureImg(),
userBean.getEmpNum(),
approvingDto.getUserList(),
approvingDto.getTypeIndex(),
approvingDto.getUserIndex()
);
// 更新 flowChildren
SpmkApproveDetailSummary sadsUpdate = SpmkApproveDetailSummary.builder().id(ad.getId()).flowChildren(JSONArray.fromObject(listFlowChildren).toString()).build();
/*// 审批详情 审批时添加 附件
if(RequestDataUtils.addFileList(ad,approvingDto.getFileList())){
sadsUpdate.setRequestData(ad.getRequestData());
}*/
sadsUpdate.updateById();
//最后一条数据
FlowChildren fc = CollUtil.getLast(listFlowChildren);
if (fc.getExecute() == "2") {
// 查询 SpmkApproveSummary 状态
aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda()
.select(SpmkApproveSummary::getSts,SpmkApproveSummary::getAssoType)
.eq(SpmkApproveSummary::getId, asId));
// if (aSummary.getSts() != ApproveSummarySts.REFUSE.ordinal()) {
SpmkApproveSummary.builder().id(asId).currentApprover(CommonEnum.NULL_STR.getDesc()).endTime(new Date()).sts(ApproveSummarySts.FINISH.ordinal()).build().updateById();
JSONObject jSONObject = jsonObject.parseObject(ad.getRequestData(),JSONObject.class);
jSONObject.set("approveId", FromData.builder().value(String.valueOf(asId)).build());
jSONObject.set("orgCode", userBean.getOrgCode());
//审批完成后 业务
SpmkAssoBusiness sab = spmkAssoBusinessFactory.createSpmkService(ApproveEnum.getEnums(aSummary.getAssoType()));
if (sab != null){
log.info("1----------{}",sab);
}
log.info("2----------{}", jSONObject);
sab.handleApprove(jSONObject);
}
// }
// }else {
// redisUtil.set(asId.toString(),0,500);
// return ResultUtil.error("该审批已结束!");
// }
redisUtil.set(asId.toString(),0,500);
return ResultUtil.success();
}
/**
* 删除-考核模板
@DeleteMapping(value = "/del_appraisal_t/{id}")
@ApiOperation(value = "2.移除-审批人", httpMethod = "DELETE", notes = "移除-审批人")
@ApiOperationSupport(order = 6)
@Role
public Result<Object> delAT(@CurrentUser UserBean userBean,@Validated @RequestBody AdminApprovingDto approvingDto) throws Exception {
jxglAppraisalTMapper.delete(new QueryWrapper<JxglAppraisalT>().lambda().eq(JxglAppraisalT::getId, id)
.eq(JxglAppraisalT::getOrgCode, userBean.getOrgCode()));
return ResultUtil.success();
}*/
}
......@@ -2,22 +2,27 @@ package cn.timer.api.controller.spmk;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
import cn.timer.api.bean.crm.CrmClientContacts;
import cn.timer.api.bean.sche.ScheduleTask;
import cn.timer.api.bean.spmk.*;
import cn.timer.api.bean.zzgl.ZzglAuth;
import cn.timer.api.dao.spmk.*;
import cn.timer.api.dto.spmk.*;
import cn.timer.api.utils.redis.RedisUtil;
import cn.timer.api.utils.router.RequestDataUtils;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.SerializationUtils;
import net.sf.json.JSON;
import com.beust.jcommander.internal.Lists;
import net.sf.json.JSONArray;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.DeleteMapping;
......@@ -80,7 +85,7 @@ import javax.annotation.Resource;
@Api(tags = "3.0审批模块")
@RestController
@Transactional
@RequestMapping(value = "/spmk", produces = { "application/json","multipart/form-data" })
@RequestMapping(value = "/spmk", produces = {"application/json", "multipart/form-data"})
public class SpmkController {
@Autowired
......@@ -112,25 +117,32 @@ public class SpmkController {
@Autowired
private SpmkAssoBusinessFactory spmkAssoBusinessFactory;
private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
@Autowired
private SpmkApproveDetailDraftsMapper spmkApproveDetailDraftsMapper;
private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
private boolean ISFIRST = true; // 第一次启动审批流程
@Resource
private RedisUtil redisUtil;
@Autowired
private SpmkApproveDraftsMapper spmkApproveDraftsMapper;
//TODO 审批模板组
/**
* 新增或编辑-审批模板组
*/
@PostMapping(value = "/save_approval_template_g")
@ApiOperation(value = "1.新增或编辑-审批模板组", httpMethod = "POST", notes = "新增或编辑-审批模板组")
@ApiOperationSupport(order = 1)
public Result<Object> saveAtg(@Validated({Insert.class,Update.class}) @RequestBody SpmkApprovalTemplateG spmkApprovalTemplateG){
public Result<Object> saveAtg(@Validated({Insert.class, Update.class}) @RequestBody SpmkApprovalTemplateG spmkApprovalTemplateG) {
if (spmkApprovalTemplateG.selectCount(new QueryWrapper<SpmkApprovalTemplateG>().lambda()
.ne(spmkApprovalTemplateG.getId() != null,SpmkApprovalTemplateG::getId, spmkApprovalTemplateG.getId())
.ne(spmkApprovalTemplateG.getId() != null, SpmkApprovalTemplateG::getId, spmkApprovalTemplateG.getId())
.eq(SpmkApprovalTemplateG::getName, spmkApprovalTemplateG.getName())) > 0) {
return ResultUtil.error("审批模板组名重复!");
}
......@@ -145,9 +157,9 @@ public class SpmkController {
@DeleteMapping(value = "/delete_approval_template_g/{id}")
@ApiOperation(value = "2.删除-审批模板组", httpMethod = "DELETE", notes = "删除-审批模板组")
@ApiOperationSupport(order = 2)
public Result<Object> deleteAtgById(@PathVariable int id){
public Result<Object> deleteAtgById(@PathVariable int id) {
if (spmkApprovalTemplateMapper.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda().eq(SpmkApprovalTemplate::getApprovalTemplateGId, id)) > 0 )
if (spmkApprovalTemplateMapper.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda().eq(SpmkApprovalTemplate::getApprovalTemplateGId, id)) > 0)
return ResultUtil.error("审批模板组存在 模板,不可直接删除!");
return SpmkApprovalTemplateG.builder().id(id).build().deleteById() ?
......@@ -160,7 +172,7 @@ public class SpmkController {
@GetMapping(value = "/list_approval_template_g")
@ApiOperation(value = "3.查询列表-审批模板组", httpMethod = "GET", notes = "查询列表-审批模板组")
@ApiOperationSupport(order = 3)
public Result<Object> selectListAtg(){
public Result<Object> selectListAtg() {
return ResultUtil.data(spmkApprovalTemplateGMapper.selectListAtInAtg());
}
......@@ -171,7 +183,7 @@ public class SpmkController {
@PutMapping(value = "/update_approval_template_g")
@ApiOperation(value = "4.排序-审批模板组", httpMethod = "PUT", notes = "排序-审批模板组")
@ApiOperationSupport(order = 4)
public Result<Object> ranksAtg(@Validated(Ranks.class) @RequestBody ValidList<SpmkApprovalTemplateG> list){
public Result<Object> ranksAtg(@Validated(Ranks.class) @RequestBody ValidList<SpmkApprovalTemplateG> list) {
if (list == null || (list != null && list.size() <= 0)) {
return ResultUtil.success();
......@@ -180,13 +192,14 @@ public class SpmkController {
}
//TODO 审批模板
/**
* 新增或编辑-审批模板
*/
@PostMapping(value = "/save_approval_template")
@ApiOperation(value = "5.新增或编辑-审批模板", httpMethod = "POST", notes = "新增或编辑-审批模板")
@ApiOperationSupport(order = 5)
public Result<Object> saveAt(@Validated @RequestBody SpmkApprovalTemplateDto spmkApprovalTemplateDto){
public Result<Object> saveAt(@Validated @RequestBody SpmkApprovalTemplateDto spmkApprovalTemplateDto) {
Integer approvalTemplateGId = spmkApprovalTemplateDto.getApprovalTemplateGId();
if (ObjectUtil.isNull(approvalTemplateGId))
......@@ -195,9 +208,9 @@ public class SpmkController {
SpmkApprovalTemplate at = SpmkApprovalTemplate.builder().build();
// 克隆 SpmkApprovalTemplateDto对象 到 SpmkApprovalTemplate对象,排除属性froms,router
BeanUtil.copyProperties(spmkApprovalTemplateDto, at , "froms","router");
BeanUtil.copyProperties(spmkApprovalTemplateDto, at, "froms", "router");
// 序列化 后 写入 SpmkApprovalTemplate对象
at.setFroms(ObjectUtil.serialize((List<JSONObject>)spmkApprovalTemplateDto.getFroms()));
at.setFroms(ObjectUtil.serialize((List<JSONObject>) spmkApprovalTemplateDto.getFroms()));
at.setRouter(ObjectUtil.serialize(spmkApprovalTemplateDto.getRouter()));
if (at.selectCount(new QueryWrapper<SpmkApprovalTemplate>().lambda()
......@@ -212,7 +225,7 @@ public class SpmkController {
// 清空前端不需要的字段再返回,节省流量
at.setFroms(null);
at.setRouter(null);
return ResultUtil.data(at);
return ResultUtil.data(at);
}
......@@ -222,7 +235,7 @@ public class SpmkController {
@DeleteMapping(value = "/delete_approval_template/{id}")
@ApiOperation(value = "6.删除-审批模板", httpMethod = "DELETE", notes = "删除-审批模板")
@ApiOperationSupport(order = 6)
public Result<Object> deleteAtById(@PathVariable int id){
public Result<Object> deleteAtById(@PathVariable int id) {
return SpmkApprovalTemplate.builder().id(id).build().deleteById() ? ResultUtil.success() : ResultUtil.error("没有找到该对象");
......@@ -234,11 +247,11 @@ public class SpmkController {
@GetMapping(value = "/select_approval_template/{id}")
@ApiOperation(value = "7.id查询-审批模板", httpMethod = "GET", notes = "id查询-审批模板")
@ApiOperationSupport(order = 7)
public Result<Object> selectAtById(@PathVariable int id){
public Result<Object> selectAtById(@PathVariable int id) {
SpmkApprovalTemplate at = SpmkApprovalTemplate.builder().id(id).build().selectById();
SpmkApprovalTemplateDto atd = SpmkApprovalTemplateDto.builder().build();
BeanUtil.copyProperties(at, atd,"froms","router");
BeanUtil.copyProperties(at, atd, "froms", "router");
atd.setFroms(ObjectUtil.deserialize(at.getFroms()));
atd.setRouter(ObjectUtil.deserialize(at.getRouter()));
return ResultUtil.data(atd);
......@@ -251,7 +264,7 @@ public class SpmkController {
@PutMapping(value = "/update_approval_template")
@ApiOperation(value = "8.排序-审批模板", httpMethod = "PUT", notes = "查询列表-审批模板组")
@ApiOperationSupport(order = 8)
public Result<Object> ranksAt(@Validated({Ranks.class})@RequestBody ValidList<SpmkApprovalTemplate> list){
public Result<Object> ranksAt(@Validated({Ranks.class}) @RequestBody ValidList<SpmkApprovalTemplate> list) {
if (list == null || (list != null && list.size() <= 0)) {
return ResultUtil.success();
......@@ -262,15 +275,15 @@ public class SpmkController {
}
//TODO 审批组
/**
* 新增或编辑-审批组
*/
@PostMapping(value = "/save_approval_g")
@ApiOperation(value = "9.新增或编辑-审批组", httpMethod = "POST", notes = "新增或编辑-审批组")
@ApiOperationSupport(order = 9)
public Result<Object> saveAg(@CurrentUser UserBean userBean, @Validated({Insert.class,Update.class}) @RequestBody SpmkApprovalG spmkApprovalG){
public Result<Object> saveAg(@CurrentUser UserBean userBean, @Validated({Insert.class, Update.class}) @RequestBody SpmkApprovalG spmkApprovalG) {
if (spmkApprovalG.selectCount(new QueryWrapper<SpmkApprovalG>().lambda()
.ne(spmkApprovalG.getId() != null, SpmkApprovalG::getId, spmkApprovalG.getId())
......@@ -290,7 +303,7 @@ public class SpmkController {
@DeleteMapping(value = "/delete_approval_g/{id}")
@ApiOperation(value = "10.删除-审批组", httpMethod = "DELETE", notes = "删除-审批组")
@ApiOperationSupport(order = 10)
public Result<Object> deleteAgById(@PathVariable int id){
public Result<Object> deleteAgById(@PathVariable int id) {
// if (spmkCustomApprovalMapper.selectCount(new QueryWrapper<SpmkCustomApproval>().lambda().eq(SpmkCustomApproval::getApprovalGId, id)) > 0 )
// return ResultUtil.error("审批组存在 自定义审批,不可直接删除!");
......@@ -306,7 +319,7 @@ public class SpmkController {
@GetMapping(value = "/all_approval_g")
@ApiOperation(value = "11.查询列表-审批组-审批管理", httpMethod = "GET", notes = "查询列表-审批组-审批管理")
@ApiOperationSupport(order = 11)
public Result<Object> selectListAgByAdmin(@CurrentUser UserBean userBean){
public Result<Object> selectListAgByAdmin(@CurrentUser UserBean userBean) {
List<Integer> depts = zzglBmgwMService.empNumupGetDepts(userBean.getOrgCode(), userBean.getEmpNum());
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCaByAdmin(userBean.getOrgCode(), userBean.getEmpNum(), depts));
......@@ -319,10 +332,10 @@ public class SpmkController {
@GetMapping(value = "/all_approval_g1")
@ApiOperation(value = "11.查询列表-审批组-审批管理", httpMethod = "GET", notes = "查询列表-审批组-审批管理")
@ApiOperationSupport(order = 11)
public Result<Object> selectListAgByAdmin1(@CurrentUser UserBean userBean,@RequestParam("eaaname")String eaaname){
public Result<Object> selectListAgByAdmin1(@CurrentUser UserBean userBean, @RequestParam("eaaname") String eaaname) {
List<Integer> depts = zzglBmgwMService.empNumupGetDepts(userBean.getOrgCode(), userBean.getEmpNum());
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCaByAdmin1(userBean.getOrgCode(), userBean.getEmpNum(), depts,eaaname));
return ResultUtil.data(spmkApprovalGMapper.selectListAgInCaByAdmin1(userBean.getOrgCode(), userBean.getEmpNum(), depts, eaaname));
}
......@@ -332,7 +345,7 @@ public class SpmkController {
@GetMapping(value = "/list_approval_g")
@ApiOperation(value = "11.查询列表-审批组-个人审批", httpMethod = "GET", notes = "查询列表-审批组-个人审批")
@ApiOperationSupport(order = 11)
public Result<Object> selectListAg(@CurrentUser UserBean userBean){
public Result<Object> selectListAg(@CurrentUser UserBean userBean) {
List<SpmkApprovalG> spmkApprovalGS = spmkService.selectListAg(userBean);
return ResultUtil.data(spmkService.selectListAg(userBean));
}
......@@ -343,7 +356,7 @@ public class SpmkController {
@PutMapping(value = "/update_approval_g")
@ApiOperation(value = "12.排序-审批组", httpMethod = "PUT", notes = "排序-审批组")
@ApiOperationSupport(order = 12)
public Result<Object> ranksAg(@Validated({Ranks.class}) @RequestBody ValidList<SpmkApprovalG> list){
public Result<Object> ranksAg(@Validated({Ranks.class}) @RequestBody ValidList<SpmkApprovalG> list) {
if (list == null || list.size() <= 0) {
return ResultUtil.success();
......@@ -361,11 +374,11 @@ public class SpmkController {
@ApiOperation(value = "13.新增或编辑-自定义审批", httpMethod = "POST", notes = "新增或编辑-自定义审批")
@ApiOperationSupport(order = 13)
@Transactional(rollbackFor = Exception.class)
public Result<Object> saveCa(@CurrentUser UserBean userBean,@Validated @RequestBody SpmkCustomApprovalDto spmkCustomApprovalDto) throws Exception{
public Result<Object> saveCa(@CurrentUser UserBean userBean, @Validated @RequestBody SpmkCustomApprovalDto spmkCustomApprovalDto) throws Exception {
SpmkCustomApproval ca = SpmkCustomApproval.builder().build();
BeanUtil.copyProperties(spmkCustomApprovalDto, ca , "froms","router","initiatorConfigs");
BeanUtil.copyProperties(spmkCustomApprovalDto, ca, "froms", "router", "initiatorConfigs");
if (ca.selectCount(new QueryWrapper<SpmkCustomApproval>().lambda()
.ne(ca.getId() != null, SpmkCustomApproval::getId, ca.getId())
......@@ -418,20 +431,21 @@ public class SpmkController {
/**
* 删除-自定义审批
*
* @throws Exception
*/
@DeleteMapping(value = "/delete_custom_approval/{id}")
@ApiOperation(value = "14.删除-自定义审批", httpMethod = "DELETE", notes = "删除-自定义审批")
@Transactional(rollbackFor = Exception.class)
@ApiOperationSupport(order = 14)
public Result<Object> deleteCaById(@PathVariable int id) throws Exception{
public Result<Object> deleteCaById(@PathVariable int id) throws Exception {
SpmkInitiatorConfig.builder().build().delete(new QueryWrapper<SpmkInitiatorConfig>().lambda().eq(SpmkInitiatorConfig::getCustomApprovalId, id));
if (!SpmkCustomApproval.builder().id(id).build().deleteById()) {
throw new Exception();
}
return ResultUtil.success();
return ResultUtil.success();
}
/**
......@@ -440,14 +454,14 @@ public class SpmkController {
@GetMapping(value = "/select_custom_approval/{id}")
@ApiOperation(value = "15.id查询-自定义审批", httpMethod = "GET", notes = "id查询-自定义审批")
@ApiOperationSupport(order = 15)
public Result<Object> selectCaById(@PathVariable int id){
public Result<Object> selectCaById(@PathVariable int id) {
SpmkCustomApproval ca = SpmkCustomApproval.builder().id(id).build().selectById();
List<SpmkInitiatorConfig> listIc = SpmkInitiatorConfig.builder().build().selectList(new QueryWrapper<SpmkInitiatorConfig>().lambda().eq(SpmkInitiatorConfig::getCustomApprovalId, id));
SpmkCustomApprovalDto caD = SpmkCustomApprovalDto.builder()
.froms(ObjectUtil.deserialize(ca.getFroms()))
.router(ObjectUtil.deserialize(ca.getRouter()))
.build();
BeanUtil.copyProperties(ca, caD,"froms","router");
BeanUtil.copyProperties(ca, caD, "froms", "router");
caD.setInitiatorConfigs(listIc);
return ResultUtil.data(caD);
}
......@@ -458,7 +472,7 @@ public class SpmkController {
@PutMapping(value = "/update_custom_approval")
@ApiOperation(value = "16.排序-自定义审批", httpMethod = "PUT", notes = "排序-自定义审批")
@ApiOperationSupport(order = 16)
public Result<Object> ranksCa(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list){
public Result<Object> ranksCa(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list) {
if (list == null || (list != null && list.size() <= 0)) {
return ResultUtil.success();
......@@ -476,7 +490,7 @@ public class SpmkController {
@PutMapping(value = "/test_spmk")
@ApiOperation(value = "16.测试", httpMethod = "PUT", notes = "排序-自定义审批")
@ApiOperationSupport(order = 16)
public Result<Object> test222(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list){
public Result<Object> test222(@Validated({Ranks.class}) @RequestBody ValidList<SpmkCustomApproval> list) {
Set<Integer> lanzi = new HashSet<Integer>();
//所有部门岗位
......@@ -493,11 +507,11 @@ public class SpmkController {
}
//遍历
public static Set<Integer> empNumupdept2(Set<Integer> lanzi,List<ZzglBmgwM> bmgws,Integer getId) {
public static Set<Integer> empNumupdept2(Set<Integer> lanzi, List<ZzglBmgwM> bmgws, Integer getId) {
for (ZzglBmgwM z : bmgws) {
if (getId.equals(z.getId())) {
lanzi.add(getId);
if (z.getUpId()==null || z.getUpId() == 0) {
if (z.getUpId() == null || z.getUpId() == 0) {
return lanzi;
}
getId = z.getUpId();
......@@ -508,8 +522,10 @@ public class SpmkController {
}
// TODO 审批汇总(发起审批)
/**
* 发起审批
*
* @throws Exception
*/
@PostMapping(value = "/start_approval")
......@@ -517,10 +533,10 @@ public class SpmkController {
@ApiOperationSupport(order = 17)
@Transactional(rollbackFor = Exception.class)
@Log(title = "审批-发起审批", businessType = BusinessType.INSERT)
public Result<Object> saveA(@CurrentUser UserBean userBean,@Validated @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto) throws Exception{
public Result<Object> saveA(@CurrentUser UserBean userBean, @Validated @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto) throws Exception {
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>()
.lambda()
.select(YgglMainEmp::getHeadUrl,YgglMainEmp::getName)
.select(YgglMainEmp::getHeadUrl, YgglMainEmp::getName)
.eq(YgglMainEmp::getEmpNum, userBean.getEmpNum())
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
);
......@@ -532,8 +548,7 @@ public class SpmkController {
Router router = spmkApproveSummaryDto.getRouter();
List<Router> routers = router.getChildren();
// routers = RouterUtils.clearRouters(routers);
if(routers==null){
if (routers == null) {
return ResultUtil.error("无法发起,请完善审批流程");
}
if (CollectionUtil.isNotEmpty(routers)) {
......@@ -556,7 +571,7 @@ public class SpmkController {
// if(!hasAudit){
// return ResultUtil.error("请选择审批人!");
// }
}else {
} else {
return ResultUtil.error("无法发起,请完善审批流程");
}
......@@ -570,17 +585,17 @@ public class SpmkController {
.set("id", userBean.getEmpNum());
RouterUtils.NextNode(listRouter, jSONObject, ISFIRST);
List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>();
RouterUtils.getIsFlowChildren(listRouter,listFlowChildren);
RouterUtils.getIsFlowChildren(listRouter, listFlowChildren);
if(listFlowChildren.isEmpty()){
if (listFlowChildren.isEmpty()) {
return ResultUtil.error("无法发起,请完善审批流程");
}
List<FlowChildren> listFlowChildren1 = (ArrayList<FlowChildren>) SerializationUtils.clone((Serializable) listFlowChildren);
List<String> uidlist = new ArrayList<>();
int i=0;
int i = 0;
int fsize = listFlowChildren.size();
int f=0;//listFlowChildren删除次数
for (FlowChildren flowChildrenItem: listFlowChildren) {
int f = 0;//listFlowChildren删除次数
for (FlowChildren flowChildrenItem : listFlowChildren) {
if ("audit".equals(flowChildrenItem.getClassName())) {
boolean hasAudit = false;
......@@ -588,29 +603,29 @@ public class SpmkController {
if (relation.getUsers().size() > 0) {
hasAudit = true;
//审批人去重
if (relation.getUsers().size() > 1){
int j=0;
int usize=relation.getUsers().size();//
int r=0;//user list删除次数
for (User user:relation.getUsers()
if (relation.getUsers().size() > 1) {
int j = 0;
int usize = relation.getUsers().size();//
int r = 0;//user list删除次数
for (User user : relation.getUsers()
) {
if (!uidlist.contains(user.getId())) {
uidlist.add(user.getId());
}else {
listFlowChildren1.get(i).getRelation().get(0).getUsers().remove(j-r);
} else {
listFlowChildren1.get(i).getRelation().get(0).getUsers().remove(j - r);
r++;
}
j++;
}
if (usize==r){
listFlowChildren1.remove(i-f);
if (usize == r) {
listFlowChildren1.remove(i - f);
f++;
}
}else {
} else {
if (!uidlist.contains(relation.getUsers().get(0).getId())) {
uidlist.add(relation.getUsers().get(0).getId());
}else {
listFlowChildren1.remove(i-f);
} else {
listFlowChildren1.remove(i - f);
f++;
}
}
......@@ -648,6 +663,7 @@ public class SpmkController {
.orgCode(userBean.getOrgCode())
.empNum(userBean.getEmpNum())
.title(spmkApproveSummaryDto.getTitle())
.digest(spmkApproveSummaryDto.getDigest())
.initiator(spmkApproveSummaryDto.getInitiator())
.approveName(spmkApproveSummaryDto.getApproveName())
.assoType(spmkApproveSummaryDto.getAssoType())
......@@ -672,7 +688,7 @@ public class SpmkController {
adm.setFlowChildren(JSONArray.fromObject(listFlowChildren).toString());
try {
spmkApproveDetailSummaryMapper.insert(adm);
}catch (Exception e){
} catch (Exception e) {
throw new CustomException("审批详情-新增异常");
}
......@@ -680,8 +696,10 @@ public class SpmkController {
}
//TODO 审批汇总
/**
* 审批汇总
*
* @param summaryQueryDto
* @return
* @throws
......@@ -719,6 +737,7 @@ public class SpmkController {
}
//TODO 审批详情
/**
* 审批详情
*/
......@@ -726,14 +745,28 @@ public class SpmkController {
@ApiOperation(value = "19.审批详情", httpMethod = "GET", notes = "审批详情")
@ApiOperationSupport(order = 19)
@Log(title = "审批-审批详情", businessType = BusinessType.OTHER)
public Result<Object> selectAd(@PathVariable(required = true) Integer id) {
SpmkApproveDetailDto adD = spmkService.selectApproveDetailByAsId(id);
public Result<Object> selectAd(@CurrentUser UserBean userBean, @PathVariable(required = true) Integer id) {
SpmkApproveDetailDto adD = spmkService.selectApproveDetailByAsId(id, userBean.getEmpNum());
System.out.println(ResultUtil.data(adD));
return ResultUtil.data(adD);
}
/**
* 审批详情
*/
@GetMapping(value = "/select_drafts_detail/{id}")
@ApiOperation(value = "草稿箱审批详情", httpMethod = "GET", notes = "审批详情")
@Log(title = "审批-审批详情", businessType = BusinessType.OTHER)
public Result<Object> selectdd(@CurrentUser UserBean userBean, @PathVariable(required = true) Integer id) {
SpmkApproveDetailDto adD = spmkService.selectDraftsDetailByAsId(id);
System.out.println(ResultUtil.data(adD));
return ResultUtil.data(adD);
}
//TODO 审批人审批
/**
* 审批人审批
*/
......@@ -743,19 +776,36 @@ public class SpmkController {
@ApiOperationSupport(order = 20)
@Log(title = "审批-审批流程", businessType = BusinessType.UPDATE)
// @BindingResultCtrol(title = "审批人审批")
public Result<Object> approving(@CurrentUser UserBean userBean,@Validated @RequestBody ApprovingDto approvingDto) throws Exception {
public Result<Object> approving(@CurrentUser UserBean userBean, @Validated @RequestBody ApprovingDto approvingDto) throws Exception {
/*判断是否有权限转派*/
if (approvingDto.getSts() == 4) {
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if (ent != null) {
/*超管和管理员不受权限控制*/
if (ent.getUserType() == 2) {
ZzglAuth zzglAuth = ZzglAuth.builder().build().selectOne(new QueryWrapper<ZzglAuth>().lambda().eq(ZzglAuth::getBmgwId, userBean.getUserInfo().getBmgwId())
.eq(ZzglAuth::getMenuId, "/Approvalspbutonspbuton020102"));
if (zzglAuth == null) {
return ResultUtil.error("您没有转派权限");
}
}
}
}
Integer asId = approvingDto.getAsId();
//查询redis中当前有没有在被审批执行中,0是没有在执行,1是在执行
Integer approStatus=Integer.parseInt(redisUtil.get(asId.toString())==null?"0":redisUtil.get(asId.toString()).toString());
if(approStatus==1){
Integer approStatus = Integer.parseInt(redisUtil.get(asId.toString()) == null ? "0" : redisUtil.get(asId.toString()).toString());
if (approStatus == 1) {
return ResultUtil.error("该审批已在审批中!");
}else{
redisUtil.set(asId.toString(),1,5000);
} else {
redisUtil.set(asId.toString(), 1, 2);
}
SpmkApproveDetailSummary ad = SpmkApproveDetailSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailSummary>()
.lambda()
.select(SpmkApproveDetailSummary::getId,
SpmkApproveDetailSummary::getRequestData,
SpmkApproveDetailSummary::getFroms,
SpmkApproveDetailSummary::getFlowChildren)
.eq(SpmkApproveDetailSummary::getApproveSummaryId, asId));
......@@ -765,7 +815,7 @@ public class SpmkController {
.eq(SpmkApproveSummary::getId, asId));
if (aSummary.getSts() > ApproveSummarySts.IN.ordinal()) {
redisUtil.set(asId.toString(),0,500);
redisUtil.set(asId.toString(), 0, 500);
return ResultUtil.error("该审批已结束!");
}
......@@ -775,11 +825,11 @@ public class SpmkController {
.eq(SpmkExecutor::getSts, ExecutorSts.IN_EXECUTION.ordinal()));
if (count == 0) {
redisUtil.set(asId.toString(),0,500);
redisUtil.set(asId.toString(), 0, 500);
return ResultUtil.error("您已审批过!");
}
if ( spmkExecutorMapper.selectCount(new QueryWrapper<SpmkExecutor>().lambda()
if (spmkExecutorMapper.selectCount(new QueryWrapper<SpmkExecutor>().lambda()
.eq(SpmkExecutor::getId, approvingDto.getExecutorId())
.eq(SpmkExecutor::getEmpNum, userBean.getEmpNum())
.eq(SpmkExecutor::getSts, ExecutorSts.IN_EXECUTION.ordinal())) == 0) {
......@@ -787,18 +837,18 @@ public class SpmkController {
Integer adminNum = new LambdaQueryChainWrapper<QyzxEmpEntAsso>(qyzxEmpEntAssoMapper)
.eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum())
.eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode())
.in(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_ADMIN,SysRoleType.U_TYPE_C_ADMIN)
.in(QyzxEmpEntAsso::getUserType, SysRoleType.U_TYPE_ADMIN, SysRoleType.U_TYPE_C_ADMIN)
.count();
if (adminNum <= 0) {
redisUtil.set(asId.toString(),0,500);
redisUtil.set(asId.toString(), 0, 500);
return ResultUtil.error("非当前审批人 或 管理员,无法操作!");
}
}
if (aSummary.getSts() == 0) {
List<FlowChildren> listFlowChildren = jsonObject.parseArray(ad.getFlowChildren(),FlowChildren.class);
List<FlowChildren> listFlowChildren = jsonObject.parseArray(ad.getFlowChildren(), FlowChildren.class);
// 审批逻辑
RouterUtils.approving(
listFlowChildren,
......@@ -809,46 +859,54 @@ public class SpmkController {
approvingDto.getSts(),
approvingDto.getUser(),
approvingDto.getSignatureImg(),
userBean.getEmpNum()
userBean.getEmpNum(),
approvingDto.getUserList()
);
// 更新 flowChildren
SpmkApproveDetailSummary.builder().id(ad.getId()).flowChildren(JSONArray.fromObject(listFlowChildren).toString()).build().updateById();
SpmkApproveDetailSummary sadsUpdate = SpmkApproveDetailSummary.builder().id(ad.getId()).flowChildren(JSONArray.fromObject(listFlowChildren).toString()).build();
// 审批详情 审批时添加 附件
if (RequestDataUtils.addFileList(ad, approvingDto.getFileList())) {
sadsUpdate.setRequestData(ad.getRequestData());
}
sadsUpdate.updateById();
//最后一条数据
FlowChildren fc = CollUtil.getLast(listFlowChildren);
if (fc.getExecute() == "2") {
// 查询 SpmkApproveSummary 状态
aSummary = spmkApproveSummaryMapper.selectOne(new QueryWrapper<SpmkApproveSummary>().lambda()
.select(SpmkApproveSummary::getSts,SpmkApproveSummary::getAssoType)
.select(SpmkApproveSummary::getSts, SpmkApproveSummary::getAssoType)
.eq(SpmkApproveSummary::getId, asId));
if (aSummary.getSts() != ApproveSummarySts.REFUSE.ordinal()) {
SpmkApproveSummary.builder().id(asId).currentApprover(CommonEnum.NULL_STR.getDesc()).endTime(new Date()).sts(ApproveSummarySts.FINISH.ordinal()).build().updateById();
JSONObject jSONObject = jsonObject.parseObject(ad.getRequestData(),JSONObject.class);
JSONObject jSONObject = jsonObject.parseObject(ad.getRequestData(), JSONObject.class);
jSONObject.set("approveId", FromData.builder().value(String.valueOf(asId)).build());
jSONObject.set("orgCode", userBean.getOrgCode());
//审批完成后 业务
SpmkAssoBusiness sab = spmkAssoBusinessFactory.createSpmkService(ApproveEnum.getEnums(aSummary.getAssoType()));
if (sab != null)
Logoutput("1----------"+ sab);
Logoutput("2----------"+ jSONObject);
Logoutput("1----------" + sab);
Logoutput("2----------" + jSONObject);
sab.handleApprove(jSONObject);
}
}
}else {
redisUtil.set(asId.toString(),0,500);
} else {
redisUtil.set(asId.toString(), 0, 500);
return ResultUtil.error("该审批已结束!");
}
redisUtil.set(asId.toString(),0,500);
redisUtil.set(asId.toString(), 0, 500);
return ResultUtil.success();
}
@Autowired
private PunchRecordMapper punchrecordmapper;
//TODO 我发起的/我审批的/抄送我的
/**
* 查询列表-我发起的/我审批的/抄送我的-分页
*/
......@@ -856,17 +914,17 @@ public class SpmkController {
@ApiOperation(value = "21.查询列表-我发起的/我审批的/抄送我的-分页", httpMethod = "POST", notes = "查询列表-我审批的-关键字、审批状态、发起时间-分页")
@ApiOperationSupport(order = 21)
@Log(title = "审批-我发起的/我审批的/抄送我的", businessType = BusinessType.OTHER)
public Result<Object> selectMyAs(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mySummaryQueryDto) throws MethodArgumentNotValidException{
public Result<Object> selectMyAs(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mySummaryQueryDto) throws MethodArgumentNotValidException {
IPage<SpmkApproveSummary> page = new Page<SpmkApproveSummary>(
mySummaryQueryDto.getCurrentPage() == null ? 1 : mySummaryQueryDto.getCurrentPage(),
mySummaryQueryDto.getTotalPage() == null ? 10 : mySummaryQueryDto.getTotalPage());
mySummaryQueryDto.setOrgCode(userBean.getOrgCode());
mySummaryQueryDto.setEmpNum(userBean.getEmpNum());
if(mySummaryQueryDto.getSts() == null) {
if (mySummaryQueryDto.getSts() == null) {
mySummaryQueryDto.setSts(0);
}
//我发起的
if(mySummaryQueryDto.getType() == 0) {
if (mySummaryQueryDto.getType() == 0) {
// mySummaryQueryDto.setSts(null);
}
// 缺-部门id 搜索
......@@ -874,40 +932,52 @@ public class SpmkController {
List<SpmkApproveSummary> listAs = pageAs.getRecords();
for(SpmkApproveSummary sp : listAs) {
for (SpmkApproveSummary sp : listAs) {
String requerstr = "";
try {
SpmkApproveDetailSummary ad = spmkApproveDetailSummaryMapper.selectOne(new QueryWrapper<SpmkApproveDetailSummary>().lambda().eq(SpmkApproveDetailSummary::getApproveSummaryId, sp.getId()));
SpmkApproveDetailSummary ad = spmkApproveDetailSummaryMapper.selectOne(new QueryWrapper<SpmkApproveDetailSummary>().lambda().eq(SpmkApproveDetailSummary::getApproveSummaryId, sp.getId()).last("limit 1"));
JSONObject as =jsonObject.parseObject(ad.getRequestData().toString(),JSONObject.class);
JSONObject as = jsonObject.parseObject(ad.getRequestData().toString(), JSONObject.class);
// Logoutput(as);
// Logoutput(sp.getId()+"==========================================="+sp.getAssoType());
requerstr = "";
//assoType : 1转正 2离职 3调薪 4调岗 5加班 6请假 7出差 8外出 9补卡
switch (sp.getAssoType()) {
case 1:requerstr = "转正时间:"+as.getJSONObject("__newConfirmationTime").getStr("value");break;
case 2:requerstr = "离职时间:"+as.getJSONObject("__terminationDate").getStr("value");break;
case 1:
requerstr = "转正时间:" + as.getJSONObject("__newConfirmationTime").getStr("value");
break;
case 2:
requerstr = "离职时间:" + as.getJSONObject("__terminationDate").getStr("value");
break;
case 3:
String namepos = "";
PunchRecord pu = punchrecordmapper.organizationalStructure(Integer.valueOf(as.getJSONObject("__TransferInDepartment").getStr("value")));
if(pu != null) {
if (pu != null) {
namepos = pu.getPost();
}
requerstr = "调入岗位:"+namepos;
requerstr = "调入岗位:" + namepos;
break;
case 5:
requerstr = "加班时长:" + as.getJSONObject("__timeLong").getStr("value") + "(小时)";
break;
case 5:requerstr = "加班时长:"+as.getJSONObject("__timeLong").getStr("value")+"(小时)";break;
case 6:
String name = "";
KqglAssoLeaveRules rul = KqglAssoLeaveRules.builder().build().selectById(as.getJSONObject("__LeaveType").getStr("value"));
if(rul != null) {
if (rul != null) {
name = rul.getName();
}
requerstr = "请假类型:"+name;
requerstr = "请假类型:" + name;
break;
case 7:
requerstr = "出差时长:" + as.getJSONObject("__longTime").getStr("value") + "(小时)";
break;
case 8:
requerstr = "外出时长:" + as.getJSONObject("__longTime").getStr("value") + "(小时)";
break;
case 9:
requerstr = "补卡时间:" + as.getJSONObject("__PatchCardTime").getStr("value");
break;
case 7:requerstr = "出差时长:"+as.getJSONObject("__longTime").getStr("value")+"(小时)";break;
case 8:requerstr = "外出时长:"+as.getJSONObject("__longTime").getStr("value")+"(小时)";break;
case 9:requerstr = "补卡时间:"+as.getJSONObject("__PatchCardTime").getStr("value");break;
default:
break;
}
......@@ -915,13 +985,17 @@ public class SpmkController {
e.printStackTrace();
}
// Logoutput(requerstr);
sp.setDigest(requerstr);
/*if(!StringUtils.isEmpty(sp.getDigest())){
requerstr = requerstr+" "+sp.getDigest();
}
sp.setDigest(requerstr);*/
}
return ResultUtil.data(pageAs, listAs);
}
//TODO 撤销审批
/**
* 撤销审批
*/
......@@ -948,7 +1022,7 @@ public class SpmkController {
@ApiOperation(value = "23.删除-审批(发起的审批)-根据审批汇总id", httpMethod = "DELETE", notes = "删除-审批(发起的审批)-根据审批汇总id")
@ApiOperationSupport(order = 23)
@Log(title = "审批-删除审批", businessType = BusinessType.DELETE)
public Result<Object> deleteApprovalData(@PathVariable Integer id){
public Result<Object> deleteApprovalData(@PathVariable Integer id) {
/*
List<SpmkApproveExecuteRecord> listAer = spmkApproveExecuteRecordMapper.selectList(new QueryWrapper<SpmkApproveExecuteRecord>()
.lambda()
......@@ -977,7 +1051,7 @@ public class SpmkController {
@DeleteMapping(value = "/delete_approval_data")
@ApiOperation(value = "90.(开发使用)删除-审批数据", httpMethod = "DELETE", notes = "审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据")
@ApiOperationSupport(order = 90)
public Result<Object> deleteApprovalData(@CurrentUser UserBean userBean){
public Result<Object> deleteApprovalData(@CurrentUser UserBean userBean) {
spmkApprovalGMapper.delete(null);
spmkCustomApprovalMapper.delete(null);
spmkApproveSummaryMapper.delete(null);
......@@ -992,24 +1066,24 @@ public class SpmkController {
@GetMapping(value = "/icon")
@ApiOperation(value = "99.图标列表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 99)
public Result<List<SpmkIcon>> selectListIcon(@CurrentUser UserBean userBean){
public Result<List<SpmkIcon>> selectListIcon(@CurrentUser UserBean userBean) {
List<SpmkIcon> spmkIcons = SpmkIcon.builder().build().selectAll();
return ResultUtil.data(spmkIcons,"获取图标列表成功");
return ResultUtil.data(spmkIcons, "获取图标列表成功");
}
//TODO 测试-生成 审批组 和 自定义审批
@GetMapping(value = "/test")
@ApiOperation(value = "98.测试-生成 审批组 和 自定义审批", httpMethod = "GET", notes = "测试-生成 审批组 和 自定义审批")
@ApiOperationSupport(order = 98)
public Result<List<SpmkIcon>> createCustomApproval(@RequestParam Integer orgCode){
public Result<List<SpmkIcon>> createCustomApproval(@RequestParam Integer orgCode) {
spmkService.createCustomApproval(orgCode);
List<SpmkIcon> spmkIcons = SpmkIcon.builder().build().selectAll();
return ResultUtil.data(spmkIcons,"生成 审批组 和 自定义审批成功");
return ResultUtil.data(spmkIcons, "生成 审批组 和 自定义审批成功");
}
@GetMapping(value = "/verification_staff")
......@@ -1018,7 +1092,7 @@ public class SpmkController {
String msg = "";
YgglMainEmp ygem = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
.eq(YgglMainEmp::getEmpNum, userBean.getEmpNum()));
if(ygem.getJobStatus() == 1) {
if (ygem.getJobStatus() == 1) {
msg = "正式员工不能发起转正审批";
}
......@@ -1027,42 +1101,42 @@ public class SpmkController {
@PostMapping(value = "/approved_quantity")
@ApiOperation(value = "APP-我发起的/我审批的/抄送我的-数量", httpMethod = "POST", notes = "")
public Result<Object> ApprovedQuantity(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mysummaryquerydto){
public Result<Object> ApprovedQuantity(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mysummaryquerydto) {
ApprovedQuantityDto qna = ApprovedQuantityDto.builder().build();
ApprovedQuantityDto qna = ApprovedQuantityDto.builder().build();
mysummaryquerydto.setEndTime(null);
mysummaryquerydto.setStartTime(null);
mysummaryquerydto.setEndTime(null);
mysummaryquerydto.setStartTime(null);
mysummaryquerydto.setOrgCode(userBean.getOrgCode());
mysummaryquerydto.setEmpNum(userBean.getEmpNum());
mysummaryquerydto.setSts(5);//状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝 4:(2/3) 5:全部
mysummaryquerydto.setOrgCode(userBean.getOrgCode());
mysummaryquerydto.setEmpNum(userBean.getEmpNum());
mysummaryquerydto.setSts(5);//状态 0审批中 1审批撤销 2审批通过/审批完成 3审批拒绝 4:(2/3) 5:全部
int istartedit=0,ccme=0,iapprovedit=0;
mysummaryquerydto.setType(0);//我发起的
List<SpmkApproveSummary> istartedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(istartedit_.size() > 0) {
istartedit = istartedit_.size();
}
int istartedit = 0, ccme = 0, iapprovedit = 0;
mysummaryquerydto.setType(0);//我发起的
List<SpmkApproveSummary> istartedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if (istartedit_.size() > 0) {
istartedit = istartedit_.size();
}
mysummaryquerydto.setType(1);//抄送我的
List<SpmkApproveSummary> ccme_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(ccme_.size() > 0) {
ccme = ccme_.size();
}
mysummaryquerydto.setType(1);//抄送我的
List<SpmkApproveSummary> ccme_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if (ccme_.size() > 0) {
ccme = ccme_.size();
}
mysummaryquerydto.setType(2);//我审批的
List<SpmkApproveSummary> iapprovedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if(iapprovedit_.size() > 0) {
iapprovedit = iapprovedit_.size();
}
mysummaryquerydto.setType(2);//我审批的
List<SpmkApproveSummary> iapprovedit_ = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(mysummaryquerydto);
if (iapprovedit_.size() > 0) {
iapprovedit = iapprovedit_.size();
}
qna.setIstartedit(istartedit);
qna.setCcme(ccme);
qna.setIapprovedit(iapprovedit);
qna.setIstartedit(istartedit);
qna.setCcme(ccme);
qna.setIapprovedit(iapprovedit);
return ResultUtil.data(qna);
return ResultUtil.data(qna);
}
@Value("${config-8timer.environmental-science}")
......@@ -1070,10 +1144,10 @@ public class SpmkController {
public void Logoutput(String science) {
if(!("pro").equals(environmental_science)) {
if (!("pro").equals(environmental_science)) {
System.out.println(science);
}else {
} else {
System.out.println("");
}
......@@ -1084,7 +1158,626 @@ public class SpmkController {
*/
@PostMapping(value = "/approved_addDetail")
@ApiOperation(value = "A审核详情数据转换", httpMethod = "POST", notes = "")
public String addApproveDetail(){
public String addApproveDetail() {
return spmkService.addApproveDetail();
}
/**
* 判断人员是否一致
*
* @param olist
* @param list
* @return
*/
private boolean isTrue(List<Router> olist, List<Router> list) {
if (olist.size() == 0 && list.size() == 0) {
return false;
} else if (olist.size() != list.size()) {
return true;
}
if (list.get(0).getClassName().equals("audit") && list.get(0).getName().equals("审批人")) {
if (list.get(0).getRelation().get(0).getType().equals("executive") && list.get(0).getRelation().get(0).getName().equals("主管")) {
return isTrue(olist.get(0).getChildren(), list.get(0).getChildren());
}
if (list.get(0).getRelation().get(0).getUsers().size() != olist.get(0).getRelation().get(0).getUsers().size()) {
return true;
} else {
return isTrue(olist.get(0).getChildren(), list.get(0).getChildren());
}
} else if (list.get(0).getClassName().equals("copy") && list.get(0).getName().equals("抄送人")) {
return false;
}
return false;
}
/**
* 更新审批流程通过节点
*
* @param userBean
* @param spmkApproveDetailDto
* @return
*/
@PostMapping(value = "/updateFlowChildren")
@ApiOperation(value = "更新审批流程通过节点", httpMethod = "POST", notes = "")
public Result<Object> updateFlowChildren(@CurrentUser UserBean userBean, @Validated @RequestBody SpmkApproveDetailDto spmkApproveDetailDto) {
try {
SpmkApproveDetailSummary spmkApproveDetailSummary = SpmkApproveDetailSummary.builder().id(spmkApproveDetailDto.getId()).build().selectById();
List<FlowChildren> listFlowChildren = spmkApproveDetailDto.getFlowChildren();
//只有添加审批人才会有值
if (spmkApproveDetailDto.getIndex() != null && spmkApproveDetailDto.getUserIndex() != null) {
//如果当前索引下的都要变更为0未执行
int currentIndex = spmkApproveDetailDto.getIndex();
for (int i = currentIndex + 1; i < listFlowChildren.size(); i++) {
if (i == currentIndex + 1) {
if (!listFlowChildren.get(currentIndex).getExecute().equals("1") && !listFlowChildren.get(currentIndex).getExecute().equals("0")) {
//如果当前索引下的都要变更为0未执行
FlowChildren flowChildren = listFlowChildren.get(spmkApproveDetailDto.getIndex());
User user = flowChildren.getRelation().get(0).getUsers().get(spmkApproveDetailDto.getUserIndex());
SpmkApproveExecuteRecord spmkApproveExecuteRecord = spmkApproveExecuteRecordMapper.selectExecuteRecordById(Integer.parseInt(user.getId()), spmkApproveDetailSummary.getApproveSummaryId());
//删除审批过的人记录
if (spmkApproveExecuteRecord != null) {
spmkApproveExecuteRecordMapper.delExecuteRecord(spmkApproveExecuteRecord.getId(), spmkApproveDetailSummary.getApproveSummaryId());
}
listFlowChildren.get(i).setExecute("1");
listFlowChildren.get(i).getRelation().forEach(v -> {
v.getUsers().forEach(u -> {
u.setExecute("1");
//添加审批记录
SpmkApproveExecuteRecord spmkApproveExecuteRecord1 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(spmkApproveDetailSummary.getApproveSummaryId())
.name(SpmkEnumInterface.ParticipatorType.APPROVER.getName())
.type(SpmkEnumInterface.ParticipatorType.APPROVER.ordinal())
.sts(SpmkEnumInterface.ExecuteRecordSts.IN_EXECUTION.ordinal())
.build();
spmkApproveExecuteRecord1.insert();
SpmkExecutor.builder()
.approveExecuteRecordId(spmkApproveExecuteRecord1.getId())
.empNum(Integer.parseInt(u.getId()))
.operatorHeaderUrl(u.getHeadUrl())
.executorName(u.getName())
.sts(1)
.build().insert();
SpmkApproveSummary.builder().currentApprover(u.getName()).id(spmkApproveDetailSummary.getApproveSummaryId()).build().updateById();
});
});
continue;
}
}
listFlowChildren.get(i).setExecute("0");
listFlowChildren.get(i).getRelation().forEach(v -> {
v.getUsers().forEach(u -> u.setExecute("0"));
});
}
SpmkApproveSummary.builder().sts(0).id(spmkApproveDetailSummary.getApproveSummaryId()).build().updateById();
}
// 更新 flowChildren
SpmkApproveDetailSummary.builder().id(spmkApproveDetailDto.getId())
.flowChildren(JSONArray.fromObject(listFlowChildren).toString()).build().updateById();
} catch (Exception e) {
return ResultUtil.error(e);
}
SpmkApproveDetailSummary detailSummary = SpmkApproveDetailSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailSummary>()
.lambda().eq(SpmkApproveDetailSummary::getId, spmkApproveDetailDto.getId()));
return ResultUtil.data(JSON.toJSONString(detailSummary));
}
//移除审批人 1.0
// @Transactional(rollbackFor = Exception.class)
// @PostMapping(value = "/delteApprove")
// @ApiOperation(value = "移除审批人", httpMethod = "POST", notes = "")
// public Result<Object> delteApprove(@CurrentUser UserBean userBean, @Validated @RequestBody SpmkApproveDetailDto spmkApproveDetailDto) {
//// try {
//
// SpmkApproveDetailSummary spmkApproveDetailSummary = SpmkApproveDetailSummary.builder().id(spmkApproveDetailDto.getId()).build().selectById();
// List<FlowChildren> listFlowChildren = spmkApproveDetailDto.getFlowChildren();
// //是否执行到下一个节点
// boolean onlyOne = false;//是否只有一条
// boolean isExecute = false;//是否执行中
// boolean isAbreas = false;//是否并序
// boolean isFinal = false;//是否最终审批人
// boolean isNext = false;//是否轮到下一个节点
// User u;
// //当前节点
// FlowChildren currentChildren = listFlowChildren.get(spmkApproveDetailDto.getIndex());
// List<User> userList = currentChildren.getRelation().get(0).getUsers();
// User currentUser = userList.get(spmkApproveDetailDto.getUserIndex());
// //只有添加审批人才会有值
// if (spmkApproveDetailDto.getIndex() != null && spmkApproveDetailDto.getUserIndex() != null) {
// if (currentChildren.getClassName().equals("audit")) {
// //如果是并序
// if ("1".equals(currentChildren.getRelation().get(0).getApprovalOrder())) {
// isAbreas = true;
// }
// //如果只有一个人
// if (userList.size() == 1) {
// onlyOne = true;
// isNext=true;
// }
// if (currentChildren.getExecute().equals("1")) {
// isExecute = true;
// if (userList.get(spmkApproveDetailDto.getUserIndex()).getExecute().equals("1")) {
// //如果是最后一个
// if (userList.size() - 1 == spmkApproveDetailDto.getUserIndex() && !isAbreas) {
// isNext = true;
// }
// //出了自己其他人都审批过了
// if (isAbreas) {
// int num = currentChildren.getRelation().get(0).getUsers().stream().filter(v -> v.getExecute().equals("1") && v.getId() != currentUser.getId()).collect(Collectors.toList()).size();
// if (num == 0) {
// isNext = true;
// }
// }
// } else {
// isExecute = false;
// }
// }
// //是否最终审批人
// if (spmkApproveDetailDto.getIndex() == listFlowChildren.size() - 1) {
// if (isNext || onlyOne) {
// isFinal = true;
// }
// } else if (!listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).getClassName().equals("audit")) {
// isFinal = true;
// }
//
// SpmkApproveExecuteRecord spmkApproveExecuteRecord = spmkApproveExecuteRecordMapper.selectExecuteRecordById(Integer.parseInt(currentUser.getId()), spmkApproveDetailSummary.getApproveSummaryId());
// //删除审批过的人记录
// if (spmkApproveExecuteRecord != null) {
// if (onlyOne) {
// spmkApproveExecuteRecordMapper.delExecuteRecordByRecordIds(spmkApproveExecuteRecord.getId(), Integer.parseInt(currentUser.getId()));
// } else {
// List<SpmkExecutor> spmkExecutorsList=SpmkExecutor.builder().build().selectList(new LambdaQueryWrapper<SpmkExecutor>()
// .eq(SpmkExecutor::getApproveExecuteRecordId,spmkApproveExecuteRecord.getId()));
// if(spmkExecutorsList.size()>0&&spmkExecutorsList.size()==1){
// spmkApproveExecuteRecordMapper.delExecuteRecordByRecordIds(spmkApproveExecuteRecord.getId(), Integer.parseInt(currentUser.getId()));
// }else{
// spmkExecutorsList.stream().filter(v->v.getEmpNum()==Integer.parseInt(currentUser.getId())).collect(Collectors.toList()).get(0).deleteById();
// }
// }
// }
// if (isExecute && !isFinal) {
// if (!isAbreas) {
// if (isNext) {
// listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).setExecute("1");
// listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).getRelation().get(0).getUsers().get(0).setExecute("1");
// //并序
// u = listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).getRelation().get(0).getUsers().get(0);
// } else {
// listFlowChildren.get(spmkApproveDetailDto.getIndex()).setExecute("1");
// listFlowChildren.get(spmkApproveDetailDto.getIndex()).getRelation().get(0).getUsers().get(spmkApproveDetailDto.getUserIndex() + 1).setExecute("1");
// u = listFlowChildren.get(spmkApproveDetailDto.getIndex()).getRelation().get(0).getUsers().get(spmkApproveDetailDto.getUserIndex() + 1);
// }
//
// if (onlyOne || isNext) {
// spmkApproveExecuteRecord = SpmkApproveExecuteRecord
// .builder()
// .approveSummaryId(spmkApproveDetailSummary.getApproveSummaryId())
// .name(SpmkEnumInterface.ParticipatorType.APPROVER.getName())
// .type(SpmkEnumInterface.ParticipatorType.APPROVER.ordinal())
// .sts(SpmkEnumInterface.ExecuteRecordSts.IN_EXECUTION.ordinal())
// .build();
// spmkApproveExecuteRecord.insert();
// }
// SpmkExecutor.builder()
// .approveExecuteRecordId(spmkApproveExecuteRecord.getId())
// .empNum(Integer.parseInt(u.getId()))
// .operatorHeaderUrl(u.getHeadUrl())
// .executorName(u.getName())
// .sts(1)
// .build().insert();
// SpmkApproveSummary.builder().currentApprover(u.getName()).id(spmkApproveDetailSummary.getApproveSummaryId()).build().updateById();
// } else {
// //并序
// if (isNext) {
// FlowChildren nextFlowChildren = listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1);
// if (nextFlowChildren.getRelation().get(0).getApprovalOrder().equals("1")) {
// listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).setExecute("1");
// listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).getRelation().get(0).getUsers().forEach(v -> {
// v.setExecute("1");
// SpmkApproveExecuteRecord spmkApproveExecuteRecord1 = SpmkApproveExecuteRecord
// .builder()
// .approveSummaryId(spmkApproveDetailSummary.getApproveSummaryId())
// .name(SpmkEnumInterface.ParticipatorType.APPROVER.getName())
// .type(SpmkEnumInterface.ParticipatorType.APPROVER.ordinal())
// .sts(SpmkEnumInterface.ExecuteRecordSts.IN_EXECUTION.ordinal())
// .build();
// spmkApproveExecuteRecord1.insert();
// SpmkExecutor.builder()
// .approveExecuteRecordId(spmkApproveExecuteRecord1.getId())
// .empNum(Integer.parseInt(v.getId()))
// .operatorHeaderUrl(v.getHeadUrl())
// .executorName(v.getName())
// .sts(1)
// .build().insert();
// });
// SpmkApproveSummary.builder().currentApprover(nextFlowChildren.getRelation().get(0).getUsers().get(0).getName()).id(spmkApproveDetailSummary.getApproveSummaryId()).build().updateById();
// }
// }
// }
// }
//
//
// if (isExecute && isFinal) {
// SpmkApproveSummary.builder().id(spmkApproveDetailSummary.getApproveSummaryId()).currentApprover(CommonEnum.NULL_STR.getDesc()).endTime(new Date()).sts(ApproveSummarySts.FINISH.ordinal()).build().updateById();
// }
//
// if (onlyOne) {
// listFlowChildren.removeIf(f -> f == currentChildren);
// } else {
// listFlowChildren.get(spmkApproveDetailDto.getIndex()).getRelation().get(0).getUsers().removeIf(user -> user == currentUser);
// }
// }
// }
// // 更新 flowChildren
// SpmkApproveDetailSummary.builder().id(spmkApproveDetailDto.getId())
// .flowChildren(JSONArray.fromObject(listFlowChildren).toString()).build().updateById();
//// } catch (Exception e) {
//// return ResultUtil.error(e);
//// }
//
// SpmkApproveDetailSummary detailSummary = SpmkApproveDetailSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailSummary>()
// .lambda().eq(SpmkApproveDetailSummary::getId, spmkApproveDetailDto.getId()));
//
// return ResultUtil.data(JSON.toJSONString(detailSummary));
// }
@Transactional(rollbackFor = Exception.class)
@PostMapping(value = "/delteApprove")
@ApiOperation(value = "移除审批人", httpMethod = "POST", notes = "")
public Result<Object> delteApprove(@CurrentUser UserBean userBean, @Validated @RequestBody SpmkApproveDetailDto spmkApproveDetailDto) {
SpmkApproveDetailSummary spmkApproveDetailSummary = SpmkApproveDetailSummary.builder().id(spmkApproveDetailDto.getId()).build().selectById();
List<FlowChildren> listFlowChildren = spmkApproveDetailDto.getFlowChildren();
FlowChildren currentFlowChildren = listFlowChildren.get(spmkApproveDetailDto.getIndex());
List<User> currentUserList = currentFlowChildren.getRelation().get(0).getUsers();
User currentUser = currentUserList.get(spmkApproveDetailDto.getUserIndex());
//是否执行到下一个节点
boolean onlyOne = false;//是否只有一条
boolean isExecute = false;//是否执行中
boolean isAbreas = false;//是否并序
boolean isFinal = false;//是否最终审批人
boolean isNext = false;//是否轮到下一个节点
StringBuffer buffer = new StringBuffer();//新当前审批人的名字
if ("1".equals(currentFlowChildren.getRelation().get(0).getApprovalOrder())) {
isAbreas = true;
}
//如果只有一个人
if (currentUserList.size() == 1) {
onlyOne = true;
isNext = true;
}
//大节点在执行中
if (currentFlowChildren.getExecute().equals("1")) {
//小节点也在执行中
isExecute = true;
if (currentUser.getExecute().equals("1")) {
if (isAbreas) {
if (currentUserList.stream().filter(u -> u.getId() != currentUser.getId() && u.getExecute().equals("1")).collect(Collectors.toList()).size() == 0) {
isNext = true;
}
} else {
if (currentUserList.size() - 1 == spmkApproveDetailDto.getUserIndex()) {
isNext = true;
}
}
} else {
isExecute = false;
}
}
//如果属于最后一个大节点
if (listFlowChildren.size() - 1 == spmkApproveDetailDto.getIndex()) {
if (isNext) {
isFinal = true;
} else {
isFinal = false;
}
} else if (listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).getClassName().equals("copy")) {
isFinal = true;
}
//执行中的人会存在操作记录
SpmkApproveExecuteRecord spmkApproveExecuteRecord = spmkApproveExecuteRecordMapper.selectExecuteRecordById(Integer.parseInt(currentUser.getId()), spmkApproveDetailSummary.getApproveSummaryId());
//删除操作人记录
if (spmkApproveExecuteRecord != null) {
SpmkExecutor spmkExecutor =SpmkExecutor.builder().build().selectOne(new LambdaQueryWrapper<SpmkExecutor>()
.eq(SpmkExecutor::getApproveExecuteRecordId,spmkApproveExecuteRecord.getId()).eq(SpmkExecutor::getEmpNum,currentUser.getId()));
if (onlyOne) {
if(spmkExecutor.getSts()!=4) {
spmkApproveExecuteRecordMapper.delExecuteRecordByRecordIds(spmkApproveExecuteRecord.getId(), Integer.parseInt(currentUser.getId()));
}
} else {
List<SpmkExecutor> spmkExecutorsList = SpmkExecutor.builder().build().selectList(new LambdaQueryWrapper<SpmkExecutor>()
.eq(SpmkExecutor::getApproveExecuteRecordId, spmkApproveExecuteRecord.getId()));
if (isAbreas) {
//正常的并序是一条对应一个id,转派的是同一个id
if (spmkExecutorsList.size() == 1) {
spmkApproveExecuteRecordMapper.delExecuteRecordByRecordIds(spmkApproveExecuteRecord.getId(), Integer.parseInt(currentUser.getId()));
}
}
spmkExecutor.deleteById();
}
}
//当前被移除的人在执行中
if (isExecute) {
//如果不是最终的就还存在下一个审批节点
if (!isFinal) {
if (isNext) {
FlowChildren nextFlowChildren = listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1);
//如果下一个节点是并序的
if (nextFlowChildren.getRelation().get(0).getApprovalOrder().equals("1")) {
listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).setExecute("1");
listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).getRelation().get(0).getUsers().forEach(v -> {
v.setExecute("1");
SpmkApproveExecuteRecord spmkApproveExecuteRecord1 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(spmkApproveDetailSummary.getApproveSummaryId())
.name(SpmkEnumInterface.ParticipatorType.APPROVER.getName())
.type(SpmkEnumInterface.ParticipatorType.APPROVER.ordinal())
.sts(SpmkEnumInterface.ExecuteRecordSts.IN_EXECUTION.ordinal())
.build();
spmkApproveExecuteRecord1.insert();
SpmkExecutor.builder()
.approveExecuteRecordId(spmkApproveExecuteRecord1.getId())
.empNum(Integer.parseInt(v.getId()))
.operatorHeaderUrl(v.getHeadUrl())
.executorName(v.getName())
.sts(1)
.build().insert();
buffer.append(v.getName() + ",");
});
buffer.deleteCharAt(buffer.lastIndexOf(","));
} else {
listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).setExecute("1");
listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).getRelation().get(0).getUsers().get(0).setExecute("1");
User u = listFlowChildren.get(spmkApproveDetailDto.getIndex() + 1).getRelation().get(0).getUsers().get(0);
SpmkApproveExecuteRecord spmkApproveExecuteRecord1 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(spmkApproveDetailSummary.getApproveSummaryId())
.name(SpmkEnumInterface.ParticipatorType.APPROVER.getName())
.type(SpmkEnumInterface.ParticipatorType.APPROVER.ordinal())
.sts(SpmkEnumInterface.ExecuteRecordSts.IN_EXECUTION.ordinal())
.build();
spmkApproveExecuteRecord1.insert();
SpmkExecutor.builder()
.approveExecuteRecordId(spmkApproveExecuteRecord1.getId())
.empNum(Integer.parseInt(u.getId()))
.operatorHeaderUrl(u.getHeadUrl())
.executorName(u.getName())
.sts(1)
.build().insert();
buffer.append(u.getName());
}
} else {
if (!isAbreas) {
//顺序有一个同一个user里面的
listFlowChildren.get(spmkApproveDetailDto.getIndex()).getRelation().get(0).getUsers().get(spmkApproveDetailDto.getUserIndex() + 1).setExecute("1");
User u = listFlowChildren.get(spmkApproveDetailDto.getIndex()).getRelation().get(0).getUsers().get(spmkApproveDetailDto.getUserIndex() + 1);
SpmkExecutor.builder()
.approveExecuteRecordId(spmkApproveExecuteRecord.getId())
.empNum(Integer.parseInt(u.getId()))
.operatorHeaderUrl(u.getHeadUrl())
.executorName(u.getName())
.sts(1)
.build().insert();
buffer.append(u.getName());
}
}
}
SpmkApproveSummary.builder().currentApprover(buffer.toString()).id(spmkApproveDetailSummary.getApproveSummaryId()).build().updateById();
}
//只有一条数据或者已经到下一个大节点
if (onlyOne && isNext) {
listFlowChildren.removeIf(f -> f == currentFlowChildren);
} else {
listFlowChildren.get(spmkApproveDetailDto.getIndex()).getRelation().get(0).getUsers().removeIf(u -> u == currentUser);
}
//如果是最终执行人
if (isFinal&&isNext&&isExecute) {
SpmkApproveSummary.builder().id(spmkApproveDetailSummary.getApproveSummaryId()).currentApprover(CommonEnum.NULL_STR.getDesc()).endTime(new Date()).sts(ApproveSummarySts.FINISH.ordinal()).build().updateById();
}
SpmkApproveDetailSummary.builder().id(spmkApproveDetailDto.getId())
.flowChildren(JSONArray.fromObject(listFlowChildren).toString()).build().updateById();
SpmkApproveDetailSummary detailSummary = SpmkApproveDetailSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailSummary>()
.lambda().eq(SpmkApproveDetailSummary::getId, spmkApproveDetailDto.getId()));
return ResultUtil.data(JSON.toJSONString(detailSummary));
}
@PostMapping(value = "/save_drafts")
@ApiOperation(value = "存入草稿箱", httpMethod = "POST", notes = "存入草稿箱")
@Transactional(rollbackFor = Exception.class)
@Log(title = "审批-存入草稿箱", businessType = BusinessType.INSERT)
public Result<Object> saveDrafts(@CurrentUser UserBean userBean, @Validated @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto) throws Exception {
try {
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>()
.lambda()
.select(YgglMainEmp::getHeadUrl, YgglMainEmp::getName)
.eq(YgglMainEmp::getEmpNum, userBean.getEmpNum())
.eq(YgglMainEmp::getOrgCode, userBean.getOrgCode())
);
if (ygglMainEmp == null)
return ResultUtil.error("发起人不存在!");
// List<SpmkApprovalG> saG = spmkService.selectListAg(userBean);
Router router = spmkApproveSummaryDto.getRouter();
// routers = RouterUtils.clearRouters(routers);
/*TODO 验证是否拥有添加审核人的权限 只用于华颐*/
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if (ent != null) {
/*超管和管理员不受权限控制*/
if (ent.getUserType() == 2) {
ZzglAuth zzglAuth = ZzglAuth.builder().build().selectOne(new QueryWrapper<ZzglAuth>().lambda().eq(ZzglAuth::getBmgwId, userBean.getUserInfo().getBmgwId())
.eq(ZzglAuth::getMenuId, "/Approvalspbutonspbuton020101"));
/*如果没有该权限*/
if (zzglAuth == null) {
SpmkCustomApproval ca = SpmkCustomApproval.builder().build().selectOne(new QueryWrapper<SpmkCustomApproval>().lambda()
.eq(SpmkCustomApproval::getName, spmkApproveSummaryDto.getApproveName()).eq(SpmkCustomApproval::getOrgCode, userBean.getOrgCode()));
Router oldRouter = ObjectUtil.deserialize(ca.getRouter());
if (isTrue(router.getChildren(), oldRouter.getChildren())) {
return ResultUtil.error("您没有新增审批人的权限");
}
}
}
}
List<Router> listRouter = new ArrayList<Router>();
listRouter.add(router);
JSONObject jSONObject = spmkApproveSummaryDto.getRequestData()
.set("orgCode", userBean.getOrgCode())
.set("initiator", ygglMainEmp.getName())
.set("headUrl", ygglMainEmp.getHeadUrl())
.set("id", userBean.getEmpNum());
RouterUtils.NextNode(listRouter, jSONObject, ISFIRST, true);
List<FlowChildren> listFlowChildren = new ArrayList<FlowChildren>();
RouterUtils.getIsFlowChildren(listRouter, listFlowChildren);
String currentApprover = jSONObject.getStr("current_approver");
SpmkApproveDrafts as = SpmkApproveDrafts
.builder()
.orgCode(userBean.getOrgCode())
.empNum(userBean.getEmpNum())
.title(spmkApproveSummaryDto.getTitle())
.initiator(spmkApproveSummaryDto.getInitiator())
.approveName(spmkApproveSummaryDto.getApproveName())
.assoType(spmkApproveSummaryDto.getAssoType())
.sts(ApproveSummarySts.IN.ordinal())
.digest(spmkApproveSummaryDto.getDigest())
.updateTime(new Date())
.currentApprover(currentApprover).isUrgent(spmkApproveSummaryDto.getIsUrgent())
.build();
if (spmkApproveSummaryDto.getId() != null) {
as.setId(spmkApproveSummaryDto.getId());
}
if (!as.insertOrUpdate()) {
throw new CustomException("审批草稿汇总-新增异常");
}
// 草稿不插入执审批流程
// RouterUtils.insertogExecuteRecord(listFlowChildren, as.getId());
// 封装 审批详情
SpmkApproveDetailDrafts adm = SpmkApproveDetailDrafts.builder().build();
adm.setApproveSummaryId(as.getId());
adm.setName(spmkApproveSummaryDto.getTitle());
adm.setRequestData(spmkApproveSummaryDto.getRequestData().toString());
adm.setFroms(spmkApproveSummaryDto.getFroms().toString());
adm.setRouter(listRouter.get(0).toJSONString());
adm.setFlowChildren(JSONArray.fromObject(listFlowChildren).toString());
if (spmkApproveSummaryDto.getId() != null) {
SpmkApproveDetailDrafts sp = SpmkApproveDetailDrafts.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailDrafts>().lambda().eq(SpmkApproveDetailDrafts::getApproveSummaryId, spmkApproveSummaryDto.getId()));
adm.setId(sp.getId());
spmkApproveDetailDraftsMapper.updateById(adm);
} else {
spmkApproveDetailDraftsMapper.insert(adm);
}
return ResultUtil.data(as.getId());
} catch (Exception e) {
// throw new CustomException("审批草稿详情-新增异常");
e.printStackTrace();
}
return ResultUtil.error("审批草稿详情-新增异常");
}
;
@PostMapping(value = "/my_drafts")
@ApiOperation(value = "我的草稿箱", httpMethod = "POST", notes = "我的草稿箱")
@Log(title = "审批-我的草稿箱", businessType = BusinessType.OTHER)
public Result<Object> myDrafts(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mySummaryQueryDto) {
IPage<SpmkApproveDrafts> page = new Page<SpmkApproveDrafts>(
mySummaryQueryDto.getCurrentPage() == null ? 1 : mySummaryQueryDto.getCurrentPage(),
mySummaryQueryDto.getTotalPage() == null ? 10 : mySummaryQueryDto.getTotalPage());
mySummaryQueryDto.setOrgCode(userBean.getOrgCode());
mySummaryQueryDto.setEmpNum(userBean.getEmpNum());
if (mySummaryQueryDto.getSts() == null) {
mySummaryQueryDto.setSts(0);
}
IPage<SpmkApproveDrafts> pageAs = spmkApproveDraftsMapper.selectPageByQueryForEmpNum(page, mySummaryQueryDto);
List<SpmkApproveDrafts> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs);
}
@PostMapping(value = "/del_drafts")
@ApiOperation(value = "删除草稿", httpMethod = "POST", notes = "删除草稿")
@Log(title = "审批-删除草稿", businessType = BusinessType.OTHER)
public Result<Object> myDrafts(@CurrentUser UserBean userBean, @RequestBody SpmkApproveDrafts spmkApproveDrafts) {
SpmkApproveDrafts drafts = SpmkApproveDrafts.builder().id(spmkApproveDrafts.getId()).build().selectById();
SpmkApproveDetailDrafts.builder().build().delete(new QueryWrapper<SpmkApproveDetailDrafts>().lambda().eq(SpmkApproveDetailDrafts::getApproveSummaryId, drafts.getId()));
drafts.deleteById();
return ResultUtil.data("删除成功");
}
@PostMapping(value = "/add_files")
@ApiOperation(value = "添加附件", httpMethod = "POST", notes = "添加附件")
@Log(title = "审批-添加附件", businessType = BusinessType.OTHER)
public Result<Object> addFiles(@CurrentUser UserBean userBean, @RequestBody ApprovingDto approvingDto) {
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if (ent != null) {
if (ent.getUserType() == 2) {
return ResultUtil.error("暂无权限");
}
}
SpmkApproveDetailSummary ad = SpmkApproveDetailSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailSummary>()
.lambda()
.select(SpmkApproveDetailSummary::getId,
SpmkApproveDetailSummary::getRequestData,
SpmkApproveDetailSummary::getFroms,
SpmkApproveDetailSummary::getFlowChildren)
.eq(SpmkApproveDetailSummary::getId, approvingDto.getAsId()));
// 审批详情 审批时添加 附件
try {
if (RequestDataUtils.addFileList(ad, approvingDto.getFileList())) {
ad.updateById();
}
} catch (Exception e) {
e.printStackTrace();
}
return ResultUtil.data("添加附件成功");
}
@PostMapping(value = "/del_file")
@ApiOperation(value = "添加附件", httpMethod = "POST", notes = "添加附件")
@Log(title = "审批-添加附件", businessType = BusinessType.OTHER)
public Result<Object> delFileList(@CurrentUser UserBean userBean, @RequestBody ApprovingDto approvingDto) {
QyzxEmpEntAsso ent = QyzxEmpEntAsso.builder().build().selectOne(new QueryWrapper<QyzxEmpEntAsso>().lambda().eq(QyzxEmpEntAsso::getOrgCode, userBean.getOrgCode()).eq(QyzxEmpEntAsso::getEmpNum, userBean.getEmpNum()));
if (ent != null) {
if (ent.getUserType() == 2) {
return ResultUtil.error("暂无权限");
}
}
SpmkApproveDetailSummary ad = SpmkApproveDetailSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveDetailSummary>()
.lambda()
.select(SpmkApproveDetailSummary::getId,
SpmkApproveDetailSummary::getRequestData,
SpmkApproveDetailSummary::getFroms,
SpmkApproveDetailSummary::getFlowChildren)
.eq(SpmkApproveDetailSummary::getId, approvingDto.getAsId()));
// 审批详情 审批时添加 附件
try {
if (RequestDataUtils.delFileList(ad, approvingDto.getFileList())) {
ad.updateById();
}
} catch (Exception e) {
e.printStackTrace();
}
return ResultUtil.data("删除附件成功");
}
}
......@@ -9,11 +9,13 @@ import cn.timer.api.dto.spmk.SpmkApproveDetailDto;
public interface SpmkService {
boolean createCustomApproval(Integer orgCode);
SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId);
SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId,Integer empNum);
List<SpmkApprovalG> selectListAg(UserBean userBean);
String addApproveDetail();
SpmkApproveDetailDto selectDraftsDetailByAsId(Integer asId);
}
......@@ -12,6 +12,7 @@ import cn.timer.api.dao.spmk.*;
import cn.timer.api.dto.spmk.FlowChildren;
import cn.timer.api.dto.spmk.Router;
import com.alibaba.fastjson.JSON;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -27,22 +28,28 @@ import cn.timer.api.dto.spmk.SpmkApproveDetailDto;
@Service
public class SpmkServiceImpl implements SpmkService{
@Autowired
private ZzglBmgwMService zzglBmgwMService;
@Autowired
private SpmkApproveDetailMapper spmkApproveDetailMapper;
@Autowired
private SpmkApprovalGMapper spmkApprovalGMapper;
@Autowired
private SpmkApproveExecuteRecordMapper spmkApproveExecuteRecordMapper;
@Autowired
private SpmkApproveDetailSummaryMapper spmkApproveDetailSummaryMapper;
@Autowired
private SpmkApproveDetailDraftsMapper spmkApproveDetailDraftsMapper;
@Autowired
private SpmkApproveDraftsMapper spmkApproveDraftsMapper;
private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
/**
......@@ -61,7 +68,7 @@ public class SpmkServiceImpl implements SpmkService{
saG.setOrgCode(orgCode);
listAG.add(saG);
}
Console.log(listAG);
SpmkCustomApproval sca = SpmkCustomApproval.builder().build();
List<SpmkApprovalTemplate> listAt = new ArrayList<SpmkApprovalTemplate>();
......@@ -76,20 +83,23 @@ public class SpmkServiceImpl implements SpmkService{
sca.setOrgCode(orgCode);
sca.setApprovalGId(listAG.get(i).getId());
sca.setIsAllvisible(1);
sca.insert();
}
}
}
return true;
}
/**
* 根据审批汇总id 获取 审批详情
* @param asId
* @param empNum
* @return
*/
@Override
public SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId) {
public SpmkApproveDetailDto selectApproveDetailByAsId(Integer asId,Integer empNum) {
// TODO Auto-generated method stub
//SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, asId));
//审批详情
......@@ -97,10 +107,10 @@ public class SpmkServiceImpl implements SpmkService{
//审批汇总
SpmkApproveSummary sum = null;
if(ad != null) {
sum = SpmkApproveSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveSummary>().lambda().select(SpmkApproveSummary::getId,SpmkApproveSummary::getEmpNum,SpmkApproveSummary::getSts,SpmkApproveSummary::getCreateTime)
sum = SpmkApproveSummary.builder().build().selectOne(new QueryWrapper<SpmkApproveSummary>().lambda().select(SpmkApproveSummary::getId,SpmkApproveSummary::getEmpNum,SpmkApproveSummary::getSts,SpmkApproveSummary::getCreateTime,SpmkApproveSummary::getDigest)
.eq(SpmkApproveSummary::getId, ad.getApproveSummaryId()));
}
SpmkApproveDetailDto adD = SpmkApproveDetailDto.builder().build();
if (ad == null) {
return null;
......@@ -113,7 +123,7 @@ public class SpmkServiceImpl implements SpmkService{
}
if(ad.getFroms()!=null) {
adD.setFroms(jsonObject.parseArray(ad.getFroms(), JSONObject.class));
}
}
if(ad.getFlowChildren() !=null) {
adD.setRouter(jsonObject.parseObject(ad.getRouter(), Router.class));
}
......@@ -121,19 +131,81 @@ public class SpmkServiceImpl implements SpmkService{
adD.setFlowChildren(jsonObject.parseArray(ad.getFlowChildren(), FlowChildren.class));
}
adD.setApproveExecuteRecord(listAer);
/*** 标记 执行人 阅读 ***/
if(!CollectionUtils.isEmpty(listAer)){
this.updateSpmkExecutorReadStatus(listAer,empNum);
}
/*** 标记执行人阅读 结束***/
if(sum != null) {
adD.setEmpNum(sum.getEmpNum());
adD.setSts(sum.getSts());
adD.setLaunchTime(sum.getCreateTime());
adD.setDigest(sum.getDigest());
SpmkExecutor exe= null;
SpmkApproveExecuteRecord exere = SpmkApproveExecuteRecord.builder().build()
.selectOne(new QueryWrapper<SpmkApproveExecuteRecord>().lambda().select(SpmkApproveExecuteRecord::getId).eq(SpmkApproveExecuteRecord::getApproveSummaryId , sum.getId())
.eq(SpmkApproveExecuteRecord::getSts, 1));
if(exere != null) {
exe = SpmkExecutor.builder().build().selectOne(new QueryWrapper<SpmkExecutor>().lambda().eq(SpmkExecutor::getApproveExecuteRecordId, exere.getId()).orderByDesc(SpmkExecutor::getId));
}
if(exe != null) {
adD.setExecuteEmpNum(exe.getEmpNum());
adD.setExecuteSts(exe.getSts());
adD.setExeid(exe.getId());
adD.setExereid(exere.getId());
}
}
return adD;
}
//草稿箱用
public SpmkApproveDetailDto selectDraftsDetailByAsId(Integer asId) {
// TODO Auto-generated method stub
//SpmkApproveDetail ad = spmkApproveDetailMapper.selectOne(new QueryWrapper<SpmkApproveDetail>().lambda().eq(SpmkApproveDetail::getApproveSummaryId, asId));
SpmkApproveDetailDrafts ad = spmkApproveDetailDraftsMapper.selectOne(new QueryWrapper<SpmkApproveDetailDrafts>().lambda().eq(SpmkApproveDetailDrafts::getApproveSummaryId, asId));
SpmkApproveDrafts sum = null;
if(ad != null) {
sum = SpmkApproveDrafts.builder().build().selectOne(new QueryWrapper<SpmkApproveDrafts>().lambda().select(SpmkApproveDrafts::getId,SpmkApproveDrafts::getEmpNum,SpmkApproveDrafts::getSts,SpmkApproveDrafts::getCreateTime,SpmkApproveDrafts::getDigest)
.eq(SpmkApproveDrafts::getId, ad.getApproveSummaryId()));
}
SpmkApproveDetailDto adD = SpmkApproveDetailDto.builder().build();
if (ad == null) {
return null;
}
//审批操作记录
// List<SpmkApproveExecuteRecord> listAer = spmkApproveExecuteRecordMapper.selectListByAsId(asId);
BeanUtil.copyProperties(ad, adD, "requestData","froms","router","flowChildren","spmkApproveExecuteRecord");
if(ad.getRequestData() !=null) {
adD.setRequestData(jsonObject.parseObject(ad.getRequestData(), JSONObject.class));
}
if(ad.getFroms()!=null) {
adD.setFroms(jsonObject.parseArray(ad.getFroms(), JSONObject.class));
}
if(ad.getFlowChildren() !=null) {
adD.setRouter(jsonObject.parseObject(ad.getRouter(), Router.class));
}
if(ad.getFlowChildren()!=null) {
adD.setFlowChildren(jsonObject.parseArray(ad.getFlowChildren(), FlowChildren.class));
}
// adD.setApproveExecuteRecord(listAer);
if(sum != null) {
adD.setEmpNum(sum.getEmpNum());
adD.setSts(sum.getSts());
adD.setLaunchTime(sum.getCreateTime());
adD.setDigest(sum.getDigest());
SpmkExecutor exe= null;
SpmkApproveExecuteRecord exere = SpmkApproveExecuteRecord.builder().build()
.selectOne(new QueryWrapper<SpmkApproveExecuteRecord>().lambda().select(SpmkApproveExecuteRecord::getId).eq(SpmkApproveExecuteRecord::getApproveSummaryId , sum.getId())
.eq(SpmkApproveExecuteRecord::getSts, 1));
if(exere != null) {
exe = SpmkExecutor.builder().build().selectOne(new QueryWrapper<SpmkExecutor>().lambda().eq(SpmkExecutor::getApproveExecuteRecordId, exere.getId()).orderByDesc(SpmkExecutor::getId));
}
if(exe != null) {
adD.setExecuteEmpNum(exe.getEmpNum());
adD.setExecuteSts(exe.getSts());
......@@ -141,7 +213,7 @@ public class SpmkServiceImpl implements SpmkService{
adD.setExereid(exere.getId());
}
}
return adD;
}
......@@ -161,50 +233,67 @@ public class SpmkServiceImpl implements SpmkService{
@Override
public String addApproveDetail() {
QueryWrapper queryWrapper = new QueryWrapper<SpmkApproveDetail>().select("id,approve_summary_id", "name", "department_name", "request_data", "froms", "router", "flow_children");
List<SpmkApproveDetail> spmkApproveDetails = spmkApproveDetailMapper.selectList(queryWrapper);
spmkApproveDetails.forEach(t -> {
SpmkApproveDetailSummary spmkApproveDetailSummary = new SpmkApproveDetailSummary();
spmkApproveDetailSummary.setApproveSummaryId(t.getApproveSummaryId());
spmkApproveDetailSummary.setDepartmentName(t.getDepartmentName());
spmkApproveDetailSummary.setName(t.getName());
QueryWrapper queryWrapper = new QueryWrapper<SpmkApproveDetail>().select("id,approve_summary_id", "name", "department_name", "request_data", "froms", "router", "flow_children");
List<SpmkApproveDetail> spmkApproveDetails = spmkApproveDetailMapper.selectList(queryWrapper);
spmkApproveDetails.forEach(t -> {
SpmkApproveDetailSummary spmkApproveDetailSummary = new SpmkApproveDetailSummary();
spmkApproveDetailSummary.setApproveSummaryId(t.getApproveSummaryId());
spmkApproveDetailSummary.setDepartmentName(t.getDepartmentName());
spmkApproveDetailSummary.setName(t.getName());
try {
Object deserialize2 = ObjectUtil.deserialize(t.getFlowChildren());
String flowChidren = JSON.toJSONString(deserialize2);
spmkApproveDetailSummary.setFlowChildren(flowChidren);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
Object deserialize2 = ObjectUtil.deserialize(t.getFlowChildren());
String flowChidren = JSON.toJSONString(deserialize2);
spmkApproveDetailSummary.setFlowChildren(flowChidren);
Object deserialize1 = ObjectUtil.deserialize(t.getFroms());
String froms = JSON.toJSONString(deserialize1);
spmkApproveDetailSummary.setFroms(froms);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
Object deserialize1 = ObjectUtil.deserialize(t.getFroms());
String froms = JSON.toJSONString(deserialize1);
spmkApproveDetailSummary.setFroms(froms);
Object deserialize = ObjectUtil.deserialize(t.getRequestData());
String s = JSON.toJSONString(deserialize);
spmkApproveDetailSummary.setRequestData(s);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
Object deserialize = ObjectUtil.deserialize(t.getRequestData());
String s = JSON.toJSONString(deserialize);
spmkApproveDetailSummary.setRequestData(s);
Router router = ObjectUtil.deserialize(t.getRouter());
String s = JSON.toJSONString(router);
spmkApproveDetailSummary.setRouter(s);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
Router router = ObjectUtil.deserialize(t.getRouter());
String s = JSON.toJSONString(router);
spmkApproveDetailSummary.setRouter(s);
} catch (Exception e) {
e.printStackTrace();
} finally {
spmkApproveDetailSummary.insertOrUpdate();
}
spmkApproveDetailSummary.insertOrUpdate();
}
}
}
});
}
});
return "成功";
}
return "成功";
/**
* 标记 执行人 阅读
* @param listAer
* @param empNum
*/
private void updateSpmkExecutorReadStatus(List<SpmkApproveExecuteRecord> listAer, Integer empNum){
for (SpmkApproveExecuteRecord entity:listAer ) {
if(!CollectionUtils.isEmpty(entity.getSpmkExecutors())){
for (SpmkExecutor se:entity.getSpmkExecutors()) {
if(empNum.equals(se.getEmpNum()) && 0 == se.getReadStatus()){
SpmkExecutor.builder().id(se.getId()).readStatus(1).build().updateById();
}
}
}
}
}
}
......@@ -2,6 +2,7 @@ package cn.timer.api.dao.kqmk;
import java.util.List;
import cn.timer.api.dto.kqmk.*;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -9,30 +10,28 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
import cn.timer.api.dto.kqmk.AdditionalDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto;
import cn.timer.api.dto.kqmk.JiaqibalanceDto;
/**
* 员工假期余额
*
*
* @author LAL 2020-05-09
*/
@Repository
public interface KqglAssoLeaveBalanceMapper extends BaseMapper<KqglAssoLeaveBalance> {
IPage<EmployeeLeaveBalanceDto> selectPageByQueryLeaveBalance(IPage<EmployeeLeaveBalanceDto> page,@Param("param") AttqueryCriteriaDto attquerycriteriadto);
AdditionalDto selectAdditional(int orgcode,int empnum);
List<AdditionalDto> selectAdditionalList(int orgcode);
// JiaqibalanceDto selectleavebalanceList(int leaverulesid,int userid);
Double Sumbalancedays(int userid,int orgcode,int leaverulesid);
List<AdditionalDto> RealTimeUpdate(int orgcode,int kqzid);
List<AdditionalDto> selectAdditionalByempnum(int orgcode,int empnum);
List<ExportEmployeeLeaveBalanceDto> selectLeaveBalance(@Param("param") AttqueryCriteriaDto attquerycriteriadto);
}
......@@ -3,12 +3,11 @@ package cn.timer.api.dao.qyxx;
import com.github.yulichang.base.MPJBaseMapper;
import org.springframework.stereotype.Repository;
import cn.timer.api.bean.qyxx.CmsContent;
/**
* OA消息内容表
*
*
* @author dsc 2019-12-10
*/
@Repository
......
package cn.timer.api.dao.qyxx;
import cn.timer.api.bean.qyxx.CmsContent;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -8,9 +9,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.qyxx.CmsIsRead;
import cn.timer.api.dto.qyxx.QyxxIsReadDto;
import java.util.List;
/**
* OA消息内容表
*
*
* @author dsc 2019-12-12
*/
@Repository
......@@ -18,11 +21,12 @@ public interface CmsIsReadMapper extends BaseMapper<CmsIsRead> {
/**
* 查询已读人
*
*
* @param mid
* @param orgCode
* @return
*/
QyxxIsReadDto queryIsReadEmp(@Param(value = "orgCode") Integer orgCode, @Param(value = "mid") Integer mid);
List<CmsContent> getUnreadList(@Param(value="userId")Integer userId);
}
package cn.timer.api.dao.spmk;
import cn.timer.api.bean.spmk.SpmkApproveDetailDrafts;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* 审批草稿详情
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-08-16 14:52:01
*/
@Repository
public interface SpmkApproveDetailDraftsMapper extends BaseMapper<SpmkApproveDetailDrafts> {
}
package cn.timer.api.dao.spmk;
import cn.timer.api.bean.spmk.SpmkApproveDrafts;
import cn.timer.api.dto.spmk.MySummaryQueryDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* 审批草稿箱
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-08-16 14:52:01
*/
@Repository
public interface SpmkApproveDraftsMapper extends BaseMapper<SpmkApproveDrafts> {
IPage<SpmkApproveDrafts> selectPageByQueryForEmpNum(IPage<SpmkApproveDrafts> page, @Param("param") MySummaryQueryDto mySummaryQueryDto);
}
package cn.timer.api.dao.spmk;
import cn.timer.api.bean.spmk.SpmkApproveExecuteRecordDrafts;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 审批执行记录 发起人、抄送人、审批人操作记录--草稿
*
* @author wgd
* @email 862422848@qq.com
* @date 2022-08-19 14:53:36
*/
public interface SpmkApproveExecuteRecordDraftsMapper extends BaseMapper<SpmkApproveExecuteRecordDrafts> {
}
......@@ -2,6 +2,7 @@ package cn.timer.api.dao.spmk;
import java.util.List;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -11,12 +12,16 @@ import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
/**
* 审批执行记录
*
*
* @author Tang 2020-04-17
*/
@Repository
public interface SpmkApproveExecuteRecordMapper extends BaseMapper<SpmkApproveExecuteRecord> {
List<SpmkApproveExecuteRecord> selectListByAsId(@Param("id") Integer id);
int delExecuteRecord(@Param("recordId") Integer recordId,@Param("approveSummaryId") Integer approveSummaryId);
SpmkApproveExecuteRecord selectExecuteRecordById(@Param("userId") Integer userId,@Param("approveSummaryId") Integer approveSummaryId);
int delExecuteRecordByRecordIds(@Param("id") Integer id, @Param("uid")Integer uid);
SpmkApproveExecuteRecord selectExecuteRecordReoId(@Param("reoId") Integer reoId,@Param("approveSummaryId") Integer approveSummaryId);
}
......@@ -13,14 +13,14 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
public class BalanceSheetDataDto implements Serializable{
/**
*
*
*/
private static final long serialVersionUID = -6994914131126332691L;
/**
*
*
*/
@ApiModelProperty(value = "id id", example = "101")
......@@ -29,6 +29,9 @@ public class BalanceSheetDataDto implements Serializable{
@ApiModelProperty(value = "假期规则id", example = "字段说明")
private Integer leaverulesid;
@ApiModelProperty(value = "假期name", example = "字段说明")
private String name;
@ApiModelProperty(value = "余额天数 ", example = "字段说明")
private double balancedays;
}
package cn.timer.api.dto.kqmk;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ExportEmployeeLeaveBalanceDto {
@ApiModelProperty(value = "员工工号 ", example = "字段说明")
private Integer empnum;
@ApiModelProperty(value = "员工名称 ", example = "字段说明")
private String empname;
@ApiModelProperty(value = "部门 ", example = "字段说明")
private String department;
@ApiModelProperty(value = "入职日期 ", example = "字段说明")
private String rztime;
@ApiModelProperty(value = "企业组织代码 ", example = "字段说明")
private Integer orgcode;
private Integer turnover_status;
@ApiModelProperty(value = "表数据", example = "字段说明")
List<BalanceSheetDataDto> balanceTo;
}
......@@ -5,9 +5,11 @@ import java.util.List;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Transient;
import cn.timer.api.bean.qyxx.CmsContentRead;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import cn.timer.api.utils.Page;
......@@ -33,110 +35,110 @@ public class CmsContentDto extends Page implements Serializable{
@ApiModelProperty(value = "内容类型ID", example = "101")
private String contenttypeid;// 内容类型ID
@ApiModelProperty(value = "标题", example = "101")
private String title;// 标题
@ApiModelProperty(value = "作者", example = "101")
private String author;// 作者
@ApiModelProperty(value = "内容", example = "101")
private String summary;// 内容
@ApiModelProperty(value = "摘要", example = "101")
private String introduction;// 摘要
@ApiModelProperty(value = "链接", example = "101")
private String linkaddress;// 链接
@ApiModelProperty(value = "录入日期", example = "101")
private Long addeddate;// 录入日期
@ApiModelProperty(value = "发布状态", example = "101")
private Integer releasestate;// 发布状态
@ApiModelProperty(value = "审核状态", example = "101")
private Integer status;// 审核状态
@ApiModelProperty(value = "添加人---责任编辑人姓名", example = "101")
private Integer userid;// 添加人---责任编辑人姓名
@ApiModelProperty(value = "org_code", example = "101")
private Integer organizationId;// 归属商户id
// @ApiModelProperty(value = "有效起始时间", example = "101")
// private String starttime;// 有效起始时间
//
// @ApiModelProperty(value = "有效结束时间", example = "101")
// private String endtime;// 有效结束时间
@ApiModelProperty(value = "状态 1:正常 2:删除", example = "101")
private Integer existencestatus;// 状态 1:正常 2:删除
@ApiModelProperty(value = "审核人姓名", example = "101")
private String auditor;// 审核人(用户ID)
@ApiModelProperty(value = "审核时间", example = "101")
private String audittime;// 审核时间
@ApiModelProperty(value = "上级审核意见", example = "101")
private String auditopinion;// 上级审核意见
@ApiModelProperty(value = "评论内容", example = "101")
private String reviewcontent;// 评论内容
@ApiModelProperty(value = "评论时间", example = "101")
private Long reviewtime;// 评论时间
// @ApiModelProperty(value = "评论人", example = "101")
// private String commentator;// 评论人
@ApiModelProperty(value = "发布人(用户ID)", example = "101")
private Integer publisher;// 发布人(用户ID)
@ApiModelProperty(value = "发布时间", example = "101")
private String releasetime;// 发布时间
// @ApiModelProperty(value = "归属人", example = "101")
// private Integer belonger;// 归属人
// @ApiModelProperty(value = "提醒时间", example = "101")
// private Long eventremindingtime;// 提醒时间
// @ApiModelProperty(value = "发送人-0:默认全部人员,1:批量人员", example = "101")
// private Integer sender;// 发送人-0:默认全部人员,1:批量人员
@ApiModelProperty(value = "所属模块ID", example = "101")
private Integer modularid;// 所属模块ID
@ApiModelProperty(value = "发布方式:1-编辑文本;2-文本识别", example = "101")
private Integer releasemode;// 发布方式:1-编辑文本;2-文本识别
// @ApiModelProperty(value = "别名-0:已过期;1:未到期", example = "101")
// private int termstate;// 别名-0:已过期;1:未到期
@ApiModelProperty(value = "别名-用户名", example = "101")
private String uname;// 别名-用户名
@ApiModelProperty(value = "封面文件路径", example = "101")
private String fmtpath;//
@ApiModelProperty(value = "附件文件路径", example = "101")
private String filepath;//
// private String[] filepath;//
@ApiModelProperty(value = "发布者姓名", example = "101")
private String publisherName;// 发布者姓名
@ApiModelProperty(value = "发布方式:1,审核通过后立即发布,2定时发布,3手动发布", example = "101")
private Integer releasetype;// 发布方式:1,审核通过后立即发布,2定时发布,3手动发布
@ApiModelProperty(value = "收回人(用户ID)", example = "101")
private Integer takeBack;// 收回人(用户ID)
@ApiModelProperty(value = "收回时间", example = "101")
private String takeBackTime;// 收回时间
@ApiModelProperty(value = "定时发布时间", example = "101")
private Long fixedTime;// 定时发布时间
......
......@@ -4,6 +4,7 @@ import cn.timer.api.utils.Page;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -53,4 +54,7 @@ public class CmsContentReadDto extends Page implements Serializable {
@ApiModelProperty(value = "更新时间", example = "")
private Date updateTime;
@ApiModelProperty(value = "附件索引", example = "")
private Integer fileIndex;
}
package cn.timer.api.dto.spmk;
import cn.timer.api.config.exception.ValidationMsg;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class AdminApprovingDto {
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "审批汇总id", example = "2", required = true)
private Integer asId;
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "审批执行记录id", example = "10", required = true)
private Integer executeRecordId;
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "执行人记录id", example = "10", required = true)
private Integer executorId;
@ApiModelProperty(value = "意见", example = "同意、拒绝")
private String opinion;
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "状态 2同意 3拒绝 4转派", example = "2", required = true)
private Integer sts;
@ApiModelProperty(value = "被转派人 ", example = "对象")
private User user;
@ApiModelProperty(value = "签字图片 ", example = "签字图片")
private String signatureImg;
@ApiModelProperty(value = "被转派人数组 ", example = "数组")
private List<User> userList;
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "申请数据 ", example = "申请数据", required = true)
private Integer execute;
@ApiModelProperty(value = "节点索引 ", example = "节点索引", required = true)
private Integer typeIndex;
@ApiModelProperty(value = "节点用户索引 ", example = "节点用户索引", required = true)
private Integer userIndex;
}
......@@ -3,12 +3,15 @@ package cn.timer.api.dto.spmk;
import javax.validation.constraints.NotNull;
import cn.timer.api.config.exception.ValidationMsg;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@Builder
@NoArgsConstructor
......@@ -40,4 +43,10 @@ public class ApprovingDto {
@ApiModelProperty(value = "签字图片 ", example = "签字图片")
private String signatureImg;
@ApiModelProperty(value = "被转派人数组 ", example = "数组")
private List<User> userList;
@ApiModelProperty(value = "申请数据 ", example = "申请数据", required = true)
private List<JSONObject> fileList;
}
package cn.timer.api.dto.spmk;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class FromsFileValueData implements Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String file;
private String name;
}
......@@ -26,6 +26,9 @@ public class SpmkApproveDetailDto {
@ApiModelProperty(value = "标题 ", example = "标题")
private String name;
@ApiModelProperty(value = "副标题 ", example = "副标题")
private String digest;
@ApiModelProperty(value = "所在部门名称 ", example = "所在部门名称")
private String departmentName;
......@@ -43,19 +46,23 @@ public class SpmkApproveDetailDto {
@ApiModelProperty(value = "审批执行记录 ", example = "审批执行记录")
private List<SpmkApproveExecuteRecord> approveExecuteRecord;
private Integer empNum;
private Integer sts;
private Integer executeEmpNum;//当前审批中 当前执行人的id
private Integer executeSts;
private Integer exeid;
private Integer exereid;
private Date launchTime; //审批发起时间
private Integer index;//插入审批人的索引
private Integer userIndex;//插入审批人的当前用户索引
}
......@@ -10,6 +10,7 @@ import javax.validation.constraints.NotNull;
import cn.hutool.json.JSONObject;
import cn.timer.api.config.exception.ValidationMsg;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -24,6 +25,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class SpmkApproveSummaryDto{
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value = "标题 ", example = "标题", required = true)
private String title;
......@@ -34,17 +36,17 @@ public class SpmkApproveSummaryDto{
@ApiModelProperty(value = "摘要", example = "摘要", required = true)
private String digest;
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value = "发起人名称 ", example = "发起人名称", required = true)
private String initiator;
@NotNull(message = ValidationMsg.NOTNULL)
@DecimalMax(value = "11",message = ValidationMsg.DECIMALMAX +" 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 10调薪 11录用 ")
@DecimalMin(value = "0",message = ValidationMsg.DECIMALMIN +" 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 10调薪 11录用")
@ApiModelProperty(value = "关联类型 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 10调薪 11录用", example = "1")
@DecimalMax(value = "9",message = ValidationMsg.DECIMALMAX +" 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 ")
@DecimalMin(value = "0",message = ValidationMsg.DECIMALMIN +" 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 ")
@ApiModelProperty(value = "关联类型 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡", example = "1")
private Integer assoType;
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "申请数据 ", example = "申请数据", required = true)
private JSONObject requestData;
......@@ -60,4 +62,7 @@ public class SpmkApproveSummaryDto{
@ApiModelProperty(value = "是否加急", example = "是否加急", required = true)
private Integer isUrgent;
@ApiModelProperty
private Integer id;
}
package cn.timer.api.utils.router;
import cn.timer.api.bean.spmk.SpmkApproveDetailSummary;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.List;
/**
* 申请数据工具类
*
* @author wuqingjun
* @email 284718418@qq.com
* @date 2022-07-13 10:05:49
*/
@Slf4j
public class RequestDataUtils {
/**
* 表单file类型
*/
private final static String FORMS_CLASS_NAME_KEY = "className";
private final static String FORMS_CLASS_NAME_VALUE = "file";
/**
* 表单label类型
*/
private final static String FORMS_DISPLAY_NAME_KEY = "displayName";
private final static String FORMS_DISPLAY_NAME_VALUE = "上传附件";
/**
* 表单inputId
*/
private final static String FORMS_INPUTID_KEY = "inputId";
/**
* 申请数据 file* value
*/
private final static String FORMS_INPUTID_KEY_VALUE = "value";
private static JSONObject jsonObject = new JSONObject();
/**
* 审批详情 审批时添加 附件
*
* @param spmkApproveDetailSummary 审批详情数据
* @param fileList 新增数据
* @throws Exception
*/
public static Boolean addFileList(SpmkApproveDetailSummary spmkApproveDetailSummary, List<JSONObject> fileList) throws Exception {
if (CollectionUtils.isEmpty(fileList)) {
return false;
}
log.info("fileList = {}", fileList);
List<JSONObject> forms = jsonObject.parseArray(spmkApproveDetailSummary.getFroms(), JSONObject.class);
if (CollectionUtils.isEmpty(forms)) {
return false;
}
String inputId = "";
// 找到审批表单对应的附件节点 inputId
for (JSONObject object : forms) {
if (FORMS_CLASS_NAME_VALUE.equals(object.get(FORMS_CLASS_NAME_KEY)) /*&& FORMS_DISPLAY_NAME_VALUE.equals(object.get(FORMS_DISPLAY_NAME_KEY))*/) {
inputId = object.get(FORMS_INPUTID_KEY).toString();
break;
}
}
if (StringUtils.isEmpty(inputId) || inputId.length() <= 0) {
log.info("审批详情 >审批时添加附件 forms not file point.");
return false;
}
log.info("forms = {}", forms);
JSONObject requestData = jsonObject.parseObject(spmkApproveDetailSummary.getRequestData(), JSONObject.class);
if (StringUtils.isEmpty(requestData)) {
return false;
}
// 找到 申请数据 对应节点 的数据
JSONObject value = (JSONObject) requestData.get(inputId);
JSONArray v = (JSONArray) value.get(FORMS_INPUTID_KEY_VALUE);
// 添加 申请数据 对应节点 的数据
v.addAll(fileList);
log.info("requestData = {}", requestData);
spmkApproveDetailSummary.setRequestData(requestData.toJSONString());
return true;
}
/**
* 审批详情 审批时添加 附件
*
* @param spmkApproveDetailSummary 审批详情数据
* @param fileList 新增数据
* @throws Exception
*/
public static Boolean delFileList(SpmkApproveDetailSummary spmkApproveDetailSummary, List<JSONObject> fileList) throws Exception {
log.info("fileList = {}", fileList);
List<JSONObject> forms = jsonObject.parseArray(spmkApproveDetailSummary.getFroms(), JSONObject.class);
if (CollectionUtils.isEmpty(forms)) {
return false;
}
String inputId = "";
// 找到审批表单对应的附件节点 inputId
for (JSONObject object : forms) {
if (FORMS_CLASS_NAME_VALUE.equals(object.get(FORMS_CLASS_NAME_KEY)) /*&& FORMS_DISPLAY_NAME_VALUE.equals(object.get(FORMS_DISPLAY_NAME_KEY))*/) {
inputId = object.get(FORMS_INPUTID_KEY).toString();
break;
}
}
if (StringUtils.isEmpty(inputId) || inputId.length() <= 0) {
log.info("审批详情 >审批时添加附件 forms not file point.");
return false;
}
log.info("forms = {}", forms);
JSONObject requestData = jsonObject.parseObject(spmkApproveDetailSummary.getRequestData(), JSONObject.class);
if (StringUtils.isEmpty(requestData)) {
return false;
}
// 找到 申请数据 对应节点 的数据
JSONObject value = (JSONObject) requestData.get(inputId);
JSONArray v = (JSONArray) value.get(FORMS_INPUTID_KEY_VALUE);
v.clear();
if(fileList.size()>=0) {
v.addAll(fileList);
}
spmkApproveDetailSummary.setRequestData(requestData.toJSONString());
return true;
}
}
......@@ -5,6 +5,11 @@ import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.lang.UUID;
import cn.hutool.core.util.IdUtil;
import cn.hutool.json.JSONObject;
import cn.timer.api.config.enuminterface.SpmkEnumInterface;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -18,7 +23,6 @@ import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.convert.ConvertException;
import cn.hutool.core.lang.Console;
import cn.hutool.json.JSONObject;
import cn.timer.api.bean.spmk.SpmkApproveExecuteRecord;
import cn.timer.api.bean.spmk.SpmkApproveSummary;
import cn.timer.api.bean.spmk.SpmkExecutor;
......@@ -37,7 +41,7 @@ import cn.timer.api.dto.spmk.User;
/**
* 流程节点工具类
*
*
* @author Administrator
*
*/
......@@ -79,13 +83,16 @@ public class RouterUtils {
*/
private final static String RELATION_TYPE_USERS = "users";
private static com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse) throws NumberFormatException, ConvertException, Exception {
return NextNode(listRouter, obj, isFirse, false);
}
// 执行下一个节点
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse, boolean isAuditNext) throws NumberFormatException, ConvertException, Exception {
public static List<Router> NextNode(List<Router> listRouter,JSONObject obj, boolean isFirse, boolean isAuditNext,boolean... isDrafts) throws NumberFormatException, ConvertException, Exception {
Router router;
if (CollectionUtil.isNotEmpty(listRouter)) {
// 非条件节点
......@@ -97,48 +104,48 @@ public class RouterUtils {
}
// 0未执行 1执行中 2已执行
switch (router.getExecute()) {
case UNEXECUTED:
switch (router.getClassName()) {
case CREATOR:
Console.log("发起人逻辑");
router.setExecute(EXECUTED);
router.setFlow(true);
List<User> users = new ArrayList<User>();
User userFirst = User.builder()
.name(obj.getStr("initiator"))
.id(obj.getStr("id"))
.headUrl(obj.getStr("headUrl"))
.execute(UNEXECUTED)
.build();
users.add(userFirst);
List<Relation> relations = new ArrayList<Relation>();
Relation relation = Relation.builder().type("user").users(users).build();
relations.add(relation);
router.setRelation(relations);
case UNEXECUTED:
switch (router.getClassName()) {
case CREATOR:
Console.log("发起人逻辑");
router.setExecute(EXECUTED);
router.setFlow(true);
List<User> users = new ArrayList<User>();
User userFirst = User.builder()
.name(obj.getStr("initiator"))
.id(obj.getStr("id"))
.headUrl(obj.getStr("headUrl"))
.execute(UNEXECUTED)
.build();
users.add(userFirst);
List<Relation> relations = new ArrayList<Relation>();
Relation relation = Relation.builder().type("user").users(users).build();
relations.add(relation);
router.setRelation(relations);
// router.getRelation().get(0).setName(obj.getStr("initiator"));
NextNode(router.getChildren(),obj, isFirse, isAuditNext);
break;
case AUDIT:
Console.log("审批人逻辑");
router.setFlow(true);
Relation r = CollectionUtil.isNotEmpty(router.getRelation()) ? router.getRelation().get(0) : null;
NextNode(router.getChildren(),obj, isFirse, isAuditNext);
break;
case AUDIT:
Console.log("审批人逻辑");
router.setFlow(true);
Relation r = CollectionUtil.isNotEmpty(router.getRelation()) ? router.getRelation().get(0) : null;
// if (r != null && RELATION_TYPE_EXECUTIVE.equals(r.getType())) {
// Integer leaderId = selectLeaderEmpNumById(
// obj.getInt("orgCode"),
// obj.getInt("id"),
// obj.getInt("orgCode"),
// obj.getInt("id"),
// r.getUpward());
//
//
// if (leaderId != null) {
// YgglMainEmp emp = YgglMainEmp.builder().build();
// emp = emp.selectOne(new QueryWrapper<YgglMainEmp>().lambda()
// .select(YgglMainEmp::getName, YgglMainEmp::getEmpNum, YgglMainEmp::getHeadUrl)
// .eq(YgglMainEmp::getEmpNum, leaderId)
// .eq(YgglMainEmp::getOrgCode, obj.getInt("orgCode")));
//
//
// if (emp != null) {
// User user = User.builder()
// .name(emp.getName())
......@@ -146,139 +153,142 @@ public class RouterUtils {
// .headUrl(emp.getHeadUrl())
// .execute(EXECUTING)
// .build();
//
//
// router.getRelation().get(0).setUsers(ListUtil.toList(user));
// }
// }
// }
if (!isAuditNext) {
router.setExecute(EXECUTING);
if(router.getRelation().size() > 0) {
// if (r != null && RELATION_TYPE_USERS.equals(r.getType())) {
if (!isAuditNext) {
//此处如果是草稿就不需要更改
if(isDrafts!=null) {
router.setExecute(EXECUTING);
}
if(router.getRelation().size() > 0) {
// if (r != null && RELATION_TYPE_USERS.equals(r.getType())) {
List<User> listUser = router.getRelation().get(0).getUsers();
if(listUser != null) {
user:
for (int i = 0; i < listUser.size(); i++) {
String execute = listUser.get(i).getExecute();
if(execute == null) {
execute = "0";
}
switch (execute) {
for (int i = 0; i < listUser.size(); i++) {
String execute = listUser.get(i).getExecute();
if(execute == null) {
execute = "0";
}
switch (execute) {
case UNEXECUTED:
listUser.get(i).setExecute(EXECUTING);
if(isDrafts!=null) {
listUser.get(i).setExecute(EXECUTING);
}
// 首次发起申请时,写入 审批人名称 至 obj 中
if (isFirse && obj.getStr("current_approver") == null ) {
obj.set("current_approver", listUser.get(i).getName());
}
isAuditNext = true;
break user;
}
}
}
}else {
throw new Exception("发起审批有误");
}
// }
}else {
throw new Exception("审批流程配置有误,请联系管理员");
}
}
NextNode(router.getChildren(), obj , isFirse, isAuditNext);
break;
case COPY:
if (!isAuditNext) {
router.setExecute(EXECUTED);
}
Console.log("抄送人逻辑");
router.setFlow(true);
List<Relation> listRelations = router.getRelation();
for (int i = 0; i < listRelations.size(); i++) {
// 装配 部门人员
if (RELATION_TYPE_DEPARTMENT.equals(listRelations.get(i).getType()) && listRelations.get(i).getDepartmentId() != null) {
String asd = listRelations.get(i).getDepartmentId();
asd = asd.replaceAll("\\[", "").replaceAll("\\]", "").replaceAll("\\\"", "");
// List<YgglMainEmp> listYgglMainEmp = selectOtherlistent(Integer.parseInt(obj.get("orgCode",FromData.class).getValue().trim()), Integer.valueOf(listRelations.get(i).getDepartmentId().trim()));
List<YgglMainEmp> listYgglMainEmp = selectOtherlistent(Integer.parseInt(obj.get("orgCode").toString()), Integer.valueOf(asd));
if (listYgglMainEmp != null && listYgglMainEmp.size() > 0) {
List<User> listUsers = new ArrayList<User>();
for (YgglMainEmp emp : listYgglMainEmp) {
User user = new User();
user.setName(emp.getName());
user.setId(String.valueOf(emp.getEmpNum()));
listUsers.add(user);
// }
}else {
throw new Exception("审批流程配置有误,请联系管理员");
}
listRelations.get(i).setUsers(listUsers);
}else {
listRelations.get(i).setUsers(null);
}
}else if (RELATION_TYPE_USERS.equals(listRelations.get(i).getType())) {
}
NextNode(router.getChildren(), obj , isFirse, isAuditNext);
break;
case COPY:
if (!isAuditNext) {
router.setExecute(EXECUTED);
}
Console.log("抄送人逻辑");
router.setFlow(true);
List<Relation> listRelations = router.getRelation();
for (int i = 0; i < listRelations.size(); i++) {
// 装配 部门人员
if (RELATION_TYPE_DEPARTMENT.equals(listRelations.get(i).getType()) && listRelations.get(i).getDepartmentId() != null) {
String asd = listRelations.get(i).getDepartmentId();
asd = asd.replaceAll("\\[", "").replaceAll("\\]", "").replaceAll("\\\"", "");
// List<YgglMainEmp> listYgglMainEmp = selectOtherlistent(Integer.parseInt(obj.get("orgCode",FromData.class).getValue().trim()), Integer.valueOf(listRelations.get(i).getDepartmentId().trim()));
List<YgglMainEmp> listYgglMainEmp = selectOtherlistent(Integer.parseInt(obj.get("orgCode").toString()), Integer.valueOf(asd));
if (listYgglMainEmp != null && listYgglMainEmp.size() > 0) {
List<User> listUsers = new ArrayList<User>();
for (YgglMainEmp emp : listYgglMainEmp) {
User user = new User();
user.setName(emp.getName());
user.setId(String.valueOf(emp.getEmpNum()));
listUsers.add(user);
}
listRelations.get(i).setUsers(listUsers);
}else {
listRelations.get(i).setUsers(null);
}
}else if (RELATION_TYPE_USERS.equals(listRelations.get(i).getType())) {
}
}
NextNode(router.getChildren(), obj , isFirse, isAuditNext);
break;
}
NextNode(router.getChildren(), obj , isFirse, isAuditNext);
break;
}
break;
case EXECUTING:
switch (router.getClassName()) {
case AUDIT:
router.setFlow(true);
if (!isFirse) {
Console.log("下一个审批人逻辑");
boolean executeFlog = true;
List<User> listUser = router.getRelation().get(0).getUsers();
user:
for (int i = 0; i < listUser.size(); i++) {
String execute = listUser.get(i).getExecute();
switch (execute) {
case UNEXECUTED:
listUser.get(i).setExecute(EXECUTING);
executeFlog = false;
break user;
case EXECUTING:
listUser.get(i).setExecute(EXECUTED);
break;
case EXECUTING:
switch (router.getClassName()) {
case AUDIT:
router.setFlow(true);
if (!isFirse) {
Console.log("下一个审批人逻辑");
boolean executeFlog = true;
List<User> listUser = router.getRelation().get(0).getUsers();
user:
for (int i = 0; i < listUser.size(); i++) {
String execute = listUser.get(i).getExecute();
switch (execute) {
case UNEXECUTED:
listUser.get(i).setExecute(EXECUTING);
executeFlog = false;
break user;
case EXECUTING:
listUser.get(i).setExecute(EXECUTED);
break;
}
}
if (executeFlog) {
router.setExecute(EXECUTED);
}
}
if (executeFlog) {
router.setExecute(EXECUTED);
}
NextNode(router.getChildren(),obj , isFirse, isAuditNext);
break;
}
break;
case EXECUTED:
Console.log("下一个节点");
NextNode(router.getChildren(),obj , isFirse, isAuditNext);
break;
}
break;
case EXECUTED:
Console.log("下一个节点");
NextNode(router.getChildren(),obj , isFirse, isAuditNext);
break;
}
} else {
// 条件节点
rulefor:
for (Router routerRule : listRouter) {
switch (routerRule.getExecute()) {
case UNEXECUTED:
boolean condition_b = true;
List<Condition> listCondition = routerRule.getCondition();
if (listCondition == null || listCondition.size() == 0) {
routerRule.setFlow(true);
}else {
Compare compare;
for (Condition condition : listCondition) {
case UNEXECUTED:
boolean condition_b = true;
List<Condition> listCondition = routerRule.getCondition();
if (listCondition == null || listCondition.size() == 0) {
routerRule.setFlow(true);
}else {
Compare compare;
for (Condition condition : listCondition) {
boolean condition_value = false;
for (String string : condition.getValues()) {
if(obj.get(condition.getKey(),FromData.class).getValue() != null) {
......@@ -296,25 +306,25 @@ public class RouterUtils {
}else {
condition_b = false;
}
}
}
}
routerRule.setFlow(condition_b);
routerRule.setExecute(EXECUTED);
if (routerRule.getFlow()) {
Console.log("条件逻辑");
NextNode(routerRule.getChildren(), obj , isFirse, isAuditNext);
}
break;
case EXECUTED:
if (routerRule.getFlow()) {
NextNode(routerRule.getChildren(), obj , isFirse, isAuditNext);
}
break rulefor;
routerRule.setFlow(condition_b);
routerRule.setExecute(EXECUTED);
if (routerRule.getFlow()) {
Console.log("条件逻辑");
NextNode(routerRule.getChildren(), obj , isFirse, isAuditNext);
}
break;
case EXECUTED:
if (routerRule.getFlow()) {
NextNode(routerRule.getChildren(), obj , isFirse, isAuditNext);
}
break rulefor;
}
}
Console.log("最后节点");
}
}
......@@ -322,24 +332,24 @@ public class RouterUtils {
return listRouter;
};
public static Integer selectLeaderEmpNumById(Integer orgCode, Integer id, Integer leave) {
YgglMainEmp mainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda()
.select(YgglMainEmp::getBmgwId)
.eq(YgglMainEmp::getEmpNum, id)
.eq(YgglMainEmp::getOrgCode, orgCode));
Integer gWId = mainEmp != null ? mainEmp.getBmgwId() : null;
// 企业所有部门岗位
List<ZzglBmgwM> listBM = ZzglBmgwM.builder().build()
.selectList(new QueryWrapper<ZzglBmgwM>().lambda().eq(ZzglBmgwM::getOrgCode, orgCode));
// 岗位
ZzglBmgwM gW = CollUtil.getFirst(listBM.stream().filter(bM -> bM.getId().equals(gWId)).collect(Collectors.toList()));
// 岗位id
Integer baseBmgwId = gW != null ? gW.getUpId() : null;
// 指定 主管id
Integer leaderId = null;
Integer bmgwLeaderId;
......@@ -350,16 +360,16 @@ public class RouterUtils {
leaderId = bmgwLeaderId;
}
}
return leaderId;
}
public static ZzglBmgwM getLeaderEmp(List<ZzglBmgwM> listBM, Integer baseBmgwId) {
ZzglBmgwM zzglBmgwM = baseBmgwId != null ?
ZzglBmgwM zzglBmgwM = baseBmgwId != null ?
CollUtil.getFirst(listBM.stream().filter(bM -> bM.getId().equals(baseBmgwId)).collect(Collectors.toList())) : null;
return zzglBmgwM;
}
public static List<YgglMainEmp> selectOtherlistent(Integer orgCode, Integer id){
ArrayList<Integer> list = new ArrayList<Integer>();
List<ZzglBmgwM> zzglBmgwMs = ZzglBmgwM.builder().build().selectList(new QueryWrapper<ZzglBmgwM>().lambda()
......@@ -380,13 +390,13 @@ public class RouterUtils {
}
}
public static void getIsFlowChildren(List<Router> listRouter, List<FlowChildren> listFlowChildren) {
// TODO Auto-generated method stub
Router router;
if (listRouter != null && listRouter.size() == 1) {
router = listRouter.get(0);
if(router.getRelation() != null) {
for (Relation relation : router.getRelation()) {
if (relation != null) {
......@@ -410,7 +420,7 @@ public class RouterUtils {
//未开发
}
}
}
}
}
}
// Relation relation = CollectionUtil.getFirst(router.getRelation());
......@@ -423,10 +433,10 @@ public class RouterUtils {
}
};
// 审批执行记录 持久化
public static void insertogExecuteRecord(List<FlowChildren> listFlowChildren,Integer asId) throws Exception{
......@@ -436,41 +446,69 @@ public class RouterUtils {
i++;
continue;
}
// ClassName 区分参与审批流程人的角色 CREATOR(发起人)、AUDIT(审核人)、COPY(抄送人)
// 各个角色的逻辑不同
switch (listFlowChildren.get(i).getClassName()) {
case CREATOR:
SpmkApproveExecuteRecord aer = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.INITIATOR.getName())
.type(ParticipatorType.INITIATOR.ordinal())
.sts(ExecuteRecordSts.AGREE.ordinal())
.build();
// 新增 审批执行记录
aer.insert();
// 新增 执行人
User user = listFlowChildren.get(i).getRelation().get(0).getUsers().get(0);
SpmkExecutor.builder()
.approveExecuteRecordId(aer.getId())
.empNum(Integer.parseInt(user.getId()))
.operatorHeaderUrl(user.getHeadUrl())
.executorName(user.getName())
.sts(ExecutorSts.AGREE.ordinal())
.build()
.insert();
break;
case AUDIT:
// 新增 执行人
List<User> listUser = listFlowChildren.get(i).getRelation().get(0).getUsers();
Relation relation1 =listFlowChildren.get(i).getRelation().get(0);
if("1".equals(relation1.getApprovalOrder())){
for (User user2 : listUser) {
case CREATOR:
SpmkApproveExecuteRecord aer = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.INITIATOR.getName())
.type(ParticipatorType.INITIATOR.ordinal())
.sts(ExecuteRecordSts.AGREE.ordinal())
.build();
// 新增 审批执行记录
aer.insert();
// 新增 执行人
User user = listFlowChildren.get(i).getRelation().get(0).getUsers().get(0);
SpmkExecutor.builder()
.approveExecuteRecordId(aer.getId())
.empNum(Integer.parseInt(user.getId()))
.operatorHeaderUrl(user.getHeadUrl())
.executorName(user.getName())
.sts(ExecutorSts.AGREE.ordinal())
.build()
.insert();
break;
case AUDIT:
// 新增 执行人
List<User> listUser = listFlowChildren.get(i).getRelation().get(0).getUsers();
Relation relation1 =listFlowChildren.get(i).getRelation().get(0);
if("1".equals(relation1.getApprovalOrder())){
for (User user2 : listUser) {
SpmkApproveExecuteRecord aer2 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.APPROVER.getName())
.type(ParticipatorType.APPROVER.ordinal())
.sts(ExecuteRecordSts.IN_EXECUTION.ordinal())
.build();
// 新增 审批执行记录
aer2.insert();
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
.empNum(Integer.parseInt(user2.getId()))
.operatorHeaderUrl(user2.getHeadUrl())
.executorName(user2.getName())
.build();
user2.setExecute("1");
switch (user2.getExecute()) {
case EXECUTING:
executor.setSts(ExecutorSts.IN_EXECUTION.ordinal());
executor.insert();
break;
case EXECUTED:
executor.setSts(ExecutorSts.AGREE.ordinal());
executor.insert();
break;
}
}
}else{
SpmkApproveExecuteRecord aer2 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
......@@ -480,114 +518,100 @@ public class RouterUtils {
.build();
// 新增 审批执行记录
aer2.insert();
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
.empNum(Integer.parseInt(user2.getId()))
.operatorHeaderUrl(user2.getHeadUrl())
.executorName(user2.getName())
.build();
user2.setExecute("1");
switch (user2.getExecute()) {
case EXECUTING:
executor.setSts(ExecutorSts.IN_EXECUTION.ordinal());
executor.insert();
break;
case EXECUTED:
executor.setSts(ExecutorSts.AGREE.ordinal());
executor.insert();
break;
for (User user2 : listUser) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
.empNum(Integer.parseInt(user2.getId()))
.operatorHeaderUrl(user2.getHeadUrl())
.executorName(user2.getName())
.build();
switch (user2.getExecute()) {
case EXECUTING:
executor.setSts(ExecutorSts.IN_EXECUTION.ordinal());
executor.insert();
break for_insert;
case EXECUTED:
executor.setSts(ExecutorSts.AGREE.ordinal());
executor.insert();
break;
}
}
}
}else{
SpmkApproveExecuteRecord aer2 = SpmkApproveExecuteRecord
break;
case COPY:
SpmkApproveExecuteRecord aer3 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.APPROVER.getName())
.type(ParticipatorType.APPROVER.ordinal())
.sts(ExecuteRecordSts.IN_EXECUTION.ordinal())
.name(ParticipatorType.COPY.getName())
.type(ParticipatorType.COPY.ordinal())
.sts(ExecuteRecordSts.AGREE.ordinal())
.build();
// 新增 审批执行记录
aer2.insert();
for (User user2 : listUser) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
.empNum(Integer.parseInt(user2.getId()))
.operatorHeaderUrl(user2.getHeadUrl())
.executorName(user2.getName())
.build();
switch (user2.getExecute()) {
case EXECUTING:
executor.setSts(ExecutorSts.IN_EXECUTION.ordinal());
executor.insert();
break for_insert;
case EXECUTED:
executor.setSts(ExecutorSts.AGREE.ordinal());
executor.insert();
break;
}
}
}
aer3.insert();
break;
case COPY:
SpmkApproveExecuteRecord aer3 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.COPY.getName())
.type(ParticipatorType.COPY.ordinal())
.sts(ExecuteRecordSts.AGREE.ordinal())
.build();
// 新增 审批执行记录
aer3.insert();
List<Relation> listRelation = listFlowChildren.get(i).getRelation();
for (Relation relation : listRelation) {
List<User> listUser2 = relation.getUsers();
// 新增 执行人
for (User user2 : listUser2) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer3.getId())
.empNum(Integer.parseInt(user2.getId()))
.executorName(user2.getName())
.operatorHeaderUrl(user2.getHeadUrl())
.sts(ExecutorSts.AGREE.ordinal())
.build();
executor.insert();
List<Relation> listRelation = listFlowChildren.get(i).getRelation();
for (Relation relation : listRelation) {
List<User> listUser2 = relation.getUsers();
// 新增 执行人
for (User user2 : listUser2) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer3.getId())
.empNum(Integer.parseInt(user2.getId()))
.executorName(user2.getName())
.operatorHeaderUrl(user2.getHeadUrl())
.sts(ExecutorSts.AGREE.ordinal())
.build();
executor.insert();
}
}
}
break;
break;
}
}
}
/**
* 审批持久化
* @param listFlowChildren 节点
* @param asId 审批汇总Id
* @param executorId 执行人记录Id
* @param opinion 意见
* @param sts 状态 1执行中 2通过 3拒绝
* @param sts 状态 1执行中 2通过 3拒绝 4转派
*/
public static void approving(List<FlowChildren> listFlowChildren,Integer asId,Integer executeRecordId, Integer executorId, String opinion,Integer sts,User redeployUser,String signatureImg,Integer empNum ) throws Exception {
boolean hasNextApprover = false;
public static void approving(List<FlowChildren> listFlowChildren,Integer asId,Integer executeRecordId, Integer executorId, String opinion,Integer sts,User redeployUser,String signatureImg,Integer empNum,List<User> redeployUserList) throws Exception {
//是否有下一个审批人
boolean hasNextApprover = false;
//统计并序审批 还有几个执行中的
int es=0;
for (int i = 0,n = listFlowChildren.size(); i < n; i++) {
//操作人是否在审批名单里
boolean isExist = false;
List<FlowChildren> flowChildrenList = new ArrayList<>();
int redeployIndex = -1;//当前转派人所在节点下标
//初始化转派人数据 用于转派
String flowChildrenJson = "{\"className\":\"audit\",\"execute\":\"0\",\"flow\":true,\"relation\":[{\"approvalOrder\":\"0\",\"departmentId\":\"\",\"down\":0,\"empty\":0,\"name\":\"\",\"signature\":0,\"type\":\"users\",\"upward\":0,\"users\":[{\"execute\":\"0\",\"headUrl\":\"\",\"id\":\"\",\"name\":\"\"}]}]}";
//FlowChildren flowChildren = jsonObject.parseObject(flowChildrenJson,FlowChildren.class);
for (int i = 0,n = listFlowChildren.size(); i < n; i++) {
// 新增 执行人
List<User> listUser = CollUtil.toList();
boolean aobl = false;
boolean aobl = false;//用于判断是 否并序审批
List<Relation> listR = listFlowChildren.get(i).getRelation();
if (CollectionUtil.isNotEmpty(listR)) {
listUser = listR.get(0).getUsers();
if("1".equals(listR.get(0).getApprovalOrder())){
aobl = true;
for (User user:listR.get(0).getUsers()
) {
for (User user:listR.get(0).getUsers()
) {
if(Integer.parseInt(user.getId()) == empNum && listFlowChildren.get(i).getClassName().equals(AUDIT)){
isExist = true;
}
//判断是顺序还是并序 0顺序 1并序
if("1".equals(listR.get(0).getApprovalOrder())){
aobl = true;
if ("1".equals(user.getExecute())){
es++;
}
......@@ -596,15 +620,23 @@ public class RouterUtils {
}
}
//判断大节点的执行状态 0 未执行 1 执行中 2 已执行
//执行中
if (EXECUTING.equals(listFlowChildren.get(i).getExecute())) {
String currentApprover = "";//存放当前审批人名称
int num = 0;
//遍历当前节点审批人
outloop: // 标识 (若内层满足条件直接跳到该层循环)
for (int i_user = 0, n_user = listUser.size(); i_user < n_user; i_user++) {
//判断用户执行状态 0 未执行 1 执行中 2 已执行
//已执行
if (EXECUTED.equals(listUser.get(i_user).getExecute())) {
}else if (EXECUTING.equals(listUser.get(i_user).getExecute())) {
if (Integer.parseInt(listUser.get(i_user).getId()) == empNum){
//执行中
}else if (EXECUTING.equals(listUser.get(i_user).getExecute())) {
//判断当前节点审批人id 等于 操作用户id 则更新执行人信息:审批意见、状态(0未执行 1执行中 2同意 3拒接 4转派)
if ((Integer.parseInt(listUser.get(i_user).getId()) == empNum && num == 0) || (!isExist && num == 0)){
num++;
SpmkExecutor.builder()
.id(executorId)
.opinion(opinion)
......@@ -640,93 +672,168 @@ public class RouterUtils {
listFlowChildren.get(i_user).setExecute(EXECUTED);
return;
//转派 处理
//在 原审批人 列表中 插入 一个被转派人(审批人)
//在 原审批人 列表中 插入 一个或多个被转派人(审批人)
}else if (sts == ExecutorSts.REDEPLOY.ordinal()) {
List<User> users1 = CollectionUtil.sub(listUser, 0, i_user+1);
redeployUser.setExecute(UNEXECUTED);
users1.add(redeployUser);
List<User> users2 = CollectionUtil.sub(listUser, i_user+1, listUser.size());
//新增转派多个人功能
//判断是走派多个人的 否则走旧逻辑
if(!CollectionUtils.isEmpty(redeployUserList)){
//List<User> users1 = CollectionUtil.sub(listUser, 0, i_user+1); 第一次修改
//redeployUserList.add(users1.get(users1.size() - 1)); 第二次修改
/*flowChildren.getRelation().get(0).setName(users1.get(users1.size() - 1).getName());
flowChildren.getRelation().get(0).getUsers().get(0).setName(users1.get(users1.size() - 1).getName());
flowChildren.getRelation().get(0).getUsers().get(0).setId(users1.get(users1.size() - 1).getId());*/
redeployIndex = i;
for (User ruser:redeployUserList
) {
ruser.setExecute(UNEXECUTED);
users1.add(ruser);
n_user = listUser.size();
}
// List<User> users2 = CollectionUtil.sub(listUser, i_user+1, listUser.size());
// listUser = ListUtils.union(users1, users2);//并集
//listR.get(0).setApprovalOrder("1");
listFlowChildren.get(i).getRelation().get(0).setApprovalOrder("1");
}else {
//List<User> users1 = CollectionUtil.sub(listUser, 0, i_user+1);
redeployUser.setExecute(UNEXECUTED);
users1.add(redeployUser);
//新加的 把转派人跟在后面说
User user = users1.get(users1.size() - 2);
// User us = new User();
// us.setExecute(UNEXECUTED);
// us.setName(user.getName());
// us.setId(user.getId());
// users1.add(us);
/*flowChildren.getRelation().get(0).setName(user.getName());
flowChildren.getRelation().get(0).getUsers().get(0).setName(user.getName());
flowChildren.getRelation().get(0).getUsers().get(0).setId(user.getId());*/
redeployIndex = i;
List<User> users2 = CollectionUtil.sub(listUser, i_user+1, listUser.size());
redeployUserList = users2;
//listUser = ListUtils.union(users1, users2);
n_user = listUser.size();
}
// System.out.println(users1);
// System.out.println(users2);
listUser = ListUtils.union(users1, users2);
n_user = listUser.size();
//
// System.out.println(listUser);
}
//break outloop;
}
//未执行
}else if (UNEXECUTED.equals(listUser.get(i_user).getExecute())) {
//新增执行人 执行状态为执行中
SpmkExecutor.builder()
.approveExecuteRecordId(executeRecordId)
.empNum(Integer.parseInt(listUser.get(i_user).getId()))
.executorName(listUser.get(i_user).getName())
.operatorHeaderUrl(listUser.get(i_user).getHeadUrl())
.sts(ExecutorSts.IN_EXECUTION.ordinal())
.build()
.insert();
hasNextApprover = true;
.approveExecuteRecordId(executeRecordId)
.empNum(Integer.parseInt(listUser.get(i_user).getId()))
.executorName(listUser.get(i_user).getName())
.operatorHeaderUrl(listUser.get(i_user).getHeadUrl())
.sts(ExecutorSts.IN_EXECUTION.ordinal())
.build()
.insert();
hasNextApprover = true;//标记为有下个审批人
listUser.get(i_user).setExecute(EXECUTING);
// 当前审批人
SpmkApproveSummary.builder().id(asId).currentApprover(listUser.get(i_user).getName()).build().updateById();
// 处理了 下一个审批人 则跳出循环
break;
if(CollectionUtils.isEmpty(redeployUserList)){
break outloop;
}
}
}
// 无下一个审批人 则更新 节点状态 为 EXECUTED(已执行)
if (!hasNextApprover) {
if (!hasNextApprover && es<=1) {
SpmkApproveExecuteRecord aer = SpmkApproveExecuteRecord
.builder()
.id(executeRecordId)
.sts(ExecutorSts.AGREE.ordinal())
.build();
// 更新 审批执行记录
aer.updateById();
// 更新 审批执行记录
aer.updateById();
if(es<=1){
listFlowChildren.get(i).setExecute(EXECUTED);
}
// if(es<=1){
// listFlowChildren.get(i).setExecute(EXECUTED);
// }
listFlowChildren.get(i).setExecute(EXECUTED);
}
//判断大节点为未执行
}else if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute())) {
//判断无下一个审批人 并且 执行中的小于等于1
if (!hasNextApprover && es<=1) {
switch (listFlowChildren.get(i).getClassName()) {
case CREATOR:
SpmkApproveExecuteRecord aer = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.INITIATOR.getName())
.type(ParticipatorType.INITIATOR.ordinal())
.sts(ExecuteRecordSts.AGREE.ordinal())
.build();
// 新增 审批执行记录
aer.insert();
// 新增 执行人
User user = listFlowChildren.get(i).getRelation().get(0).getUsers().get(0);
SpmkExecutor.builder()
.approveExecuteRecordId(aer.getId())
.empNum(Integer.parseInt(user.getId()))
.executorName(user.getName())
.operatorHeaderUrl(user.getHeadUrl())
.sts(ExecutorSts.AGREE.ordinal())
.build()
.insert();
listFlowChildren.get(i).setExecute(EXECUTED);
break;
case AUDIT:
if(aobl){
String currentApprover = "";
for (int i_user2 = 0,n_user2 = listUser.size(); i_user2 < n_user2; i_user2++) {
case CREATOR://发起审批人
SpmkApproveExecuteRecord aer = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.INITIATOR.getName())
.type(ParticipatorType.INITIATOR.ordinal())
.sts(ExecuteRecordSts.AGREE.ordinal())
.build();
// 新增 审批执行记录
aer.insert();
// 新增 执行人
User user = listFlowChildren.get(i).getRelation().get(0).getUsers().get(0);
SpmkExecutor.builder()
.approveExecuteRecordId(aer.getId())
.empNum(Integer.parseInt(user.getId()))
.executorName(user.getName())
.operatorHeaderUrl(user.getHeadUrl())
.sts(ExecutorSts.AGREE.ordinal())
.build()
.insert();
listFlowChildren.get(i).setExecute(EXECUTED);
break;
case AUDIT://审批中
//判断是否是并序
if(aobl){
String currentApprover = "";
//遍历当前节点审批人
for (int i_user2 = 0,n_user2 = listUser.size(); i_user2 < n_user2; i_user2++) {
SpmkApproveExecuteRecord aer2 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.APPROVER.getName())
.type(ParticipatorType.APPROVER.ordinal())
.sts(ExecuteRecordSts.IN_EXECUTION.ordinal())
.build();
// 新增 审批执行记录
aer2.insert();
//新增执行人 并设置状态为执行中
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
.empNum(Integer.parseInt(listUser.get(i_user2).getId()))
.executorName(listUser.get(i_user2).getName())
.operatorHeaderUrl(listUser.get(i_user2).getHeadUrl())
.sts(ExecutorSts.IN_EXECUTION.ordinal())
.build();
executor.insert();
listUser.get(i_user2).setExecute(EXECUTING);
hasNextApprover = true;
currentApprover=currentApprover!=""?currentApprover+","+listUser.get(i_user2).getName():listUser.get(i_user2).getName();
// 当前审批人
SpmkApproveSummary.builder().id(asId).currentApprover(currentApprover).build().updateById();
}
listFlowChildren.get(i).setExecute(EXECUTING);
}else{
SpmkApproveExecuteRecord aer2 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
......@@ -736,101 +843,451 @@ public class RouterUtils {
.build();
// 新增 审批执行记录
aer2.insert();
//遍历当前节点审批人
for (int i_user2 = 0,n_user2 = listUser.size(); i_user2 < n_user2; i_user2++) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
.empNum(Integer.parseInt(listUser.get(i_user2).getId()))
.executorName(listUser.get(i_user2).getName())
.operatorHeaderUrl(listUser.get(i_user2).getHeadUrl())
.sts(ExecutorSts.IN_EXECUTION.ordinal())
.build();
executor.insert();
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
.empNum(Integer.parseInt(listUser.get(i_user2).getId()))
.executorName(listUser.get(i_user2).getName())
.operatorHeaderUrl(listUser.get(i_user2).getHeadUrl())
.sts(ExecutorSts.IN_EXECUTION.ordinal())
.build();
executor.insert();
listUser.get(i_user2).setExecute(EXECUTING);
hasNextApprover = true;
currentApprover=currentApprover!=""?currentApprover+","+listUser.get(i_user2).getName():listUser.get(i_user2).getName();
// 当前审批人
SpmkApproveSummary.builder().id(asId).currentApprover(currentApprover).build().updateById();
listUser.get(i_user2).setExecute(EXECUTING);
hasNextApprover = true;
// 当前审批人
SpmkApproveSummary.builder().id(asId).currentApprover(listUser.get(i_user2).getName()).build().updateById();
// 处理了 下一个审批人 则跳出循环
break;
}
listFlowChildren.get(i).setExecute(EXECUTING);
}
listFlowChildren.get(i).setExecute(EXECUTING);
}else{
SpmkApproveExecuteRecord aer2 = SpmkApproveExecuteRecord
break;
case COPY://抄送人
SpmkApproveExecuteRecord aer3 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.APPROVER.getName())
.type(ParticipatorType.APPROVER.ordinal())
.sts(ExecuteRecordSts.IN_EXECUTION.ordinal())
.name(ParticipatorType.COPY.getName())
.type(ParticipatorType.COPY.ordinal())
.sts(ExecuteRecordSts.AGREE.ordinal())
.build();
// 新增 审批执行记录
aer2.insert();
aer3.insert();
for (int i_user2 = 0,n_user2 = listUser.size(); i_user2 < n_user2; i_user2++) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
.empNum(Integer.parseInt(listUser.get(i_user2).getId()))
.executorName(listUser.get(i_user2).getName())
.operatorHeaderUrl(listUser.get(i_user2).getHeadUrl())
.sts(ExecutorSts.IN_EXECUTION.ordinal())
.build();
executor.insert();
List<Relation> listRelation = listFlowChildren.get(i).getRelation();
listUser.get(i_user2).setExecute(EXECUTING);
hasNextApprover = true;
// 当前审批人
SpmkApproveSummary.builder().id(asId).currentApprover(listUser.get(i_user2).getName()).build().updateById();
// 处理了 下一个审批人 则跳出循环
break;
for (Relation relation : listRelation) {
List<User> listUser2 = relation.getUsers();
if (listUser2 != null) {
// 新增 执行人
for (User user2 : listUser2) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer3.getId())
.empNum(Integer.parseInt(user2.getId()))
.executorName(user2.getName())
.operatorHeaderUrl(user2.getHeadUrl())
.sts(ExecutorSts.AGREE.ordinal())
.build();
executor.insert();
}
}
}
listFlowChildren.get(i).setExecute(EXECUTING);
listFlowChildren.get(i).setExecute(EXECUTED);
break;
}
}
}
}
for (int i = 0; i < listFlowChildren.size(); i++) {
flowChildrenList.add(listFlowChildren.get(i));
/*** 转派添加审批人 ***/
/*if(i == redeployIndex){
flowChildrenList.add(flowChildren);
}*/
}
if (flowChildrenList.size() > 0){
listFlowChildren.clear();
listFlowChildren.addAll(flowChildrenList);
}
}
public static List<Router> clearRouters(List<Router> routers){
return routers;
}
/**
* 被拒审批 管理员修改为同意审批
* @param listFlowChildren 节点
* @param asId 审批汇总Id
* @param executorId 执行人记录Id
* @param opinion 意见
* @param sts 状态 1执行中 2通过 3拒绝 4转派
*/
public static void updateRefuseToAgree(List<FlowChildren> listFlowChildren,Integer asId,Integer executeRecordId, Integer executorId, String opinion,Integer sts,Integer currentSts,User redeployUser,String signatureImg,Integer empNum,List<User> redeployUserList,Integer typeIndex,Integer userIndex) throws Exception {
//拒绝单
SpmkApproveExecuteRecord spmkApproveExecuteRecord = SpmkApproveExecuteRecord.builder().id(executeRecordId).build().selectById();
if(currentSts==3){
SpmkExecutor.builder().id(executorId).sts(sts).opinion(opinion).build().updateById();
spmkApproveExecuteRecord.builder().id(executeRecordId).sts(sts).build().updateById();
// 更新 审批汇总 状态
SpmkApproveSummary.builder().id(asId).currentApprover(CommonEnum.NULL_STR.getDesc()).updateTime(new Date()).sts(SpmkEnumInterface.ApproveSummarySts.IN.ordinal()).build().updateById();
}else if(currentSts==2){
SpmkApproveSummary.builder().id(asId).currentApprover(listFlowChildren.get(typeIndex).getRelation().get(0).getUsers().get(userIndex).getName()).updateTime(new Date()).sts(SpmkEnumInterface.ApproveSummarySts.IN.ordinal()).build().updateById();
}
//是否有下一个审批人
boolean hasNextApprover = false;
//统计并序审批 还有几个执行中的
int es=0;
//操作人是否在审批名单里
boolean isExist = false;
List<FlowChildren> flowChildrenList = new ArrayList<>();
int redeployIndex = -1;//当前转派人所在节点下标
//初始化转派人数据 用于转派
String flowChildrenJson = "{\"className\":\"audit\",\"execute\":\"0\",\"flow\":true,\"relation\":[{\"approvalOrder\":\"0\",\"departmentId\":\"\",\"down\":0,\"empty\":0,\"name\":\"\",\"signature\":0,\"type\":\"users\",\"upward\":0,\"users\":[{\"execute\":\"0\",\"headUrl\":\"\",\"id\":\"\",\"name\":\"\"}]}]}";
//FlowChildren flowChildren = jsonObject.parseObject(flowChildrenJson,FlowChildren.class);
boolean isApprover = false;
for (int i = 0,n = listFlowChildren.size(); i < n; i++) {
//等于当前审批人
if(i==typeIndex){
listFlowChildren.get(i).setExecute(EXECUTING);
}
// 新增 执行人
List<User> listUser = CollUtil.toList();
boolean aobl = false;//用于判断是 否并序审批
List<Relation> listR = listFlowChildren.get(i).getRelation();
if (CollectionUtil.isNotEmpty(listR)) {
listUser = listR.get(0).getUsers();
for (User user:listR.get(0).getUsers()
) {
if(Integer.parseInt(user.getId()) == empNum && listFlowChildren.get(i).getClassName().equals(AUDIT)){
isExist = true;
}
//判断是顺序还是并序 0顺序 1并序
if("1".equals(listR.get(0).getApprovalOrder())){
aobl = true;
if ("1".equals(user.getExecute())){
es++;
}
}
break;
case COPY:
SpmkApproveExecuteRecord aer3 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.COPY.getName())
.type(ParticipatorType.COPY.ordinal())
.sts(ExecuteRecordSts.AGREE.ordinal())
.build();
// 新增 审批执行记录
aer3.insert();
List<Relation> listRelation = listFlowChildren.get(i).getRelation();
for (Relation relation : listRelation) {
List<User> listUser2 = relation.getUsers();
if (listUser2 != null) {
// 新增 执行人
for (User user2 : listUser2) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer3.getId())
.empNum(Integer.parseInt(user2.getId()))
.executorName(user2.getName())
.operatorHeaderUrl(user2.getHeadUrl())
.sts(ExecutorSts.AGREE.ordinal())
}
}
if(isApprover){
listFlowChildren.get(i).setExecute(UNEXECUTED);
listFlowChildren.get(i).getRelation().get(0).getUsers().forEach(v->v.setExecute(UNEXECUTED));
}
//判断大节点的执行状态 0 未执行 1 执行中 2 已执行
//执行中
if (EXECUTING.equals(listFlowChildren.get(i).getExecute())) {
String currentApprover = "";//存放当前审批人名称
int num = 0;
//遍历当前节点审批人
outloop: // 标识 (若内层满足条件直接跳到该层循环)
for (int i_user = 0, n_user = listUser.size(); i_user < n_user; i_user++) {
if(i_user==userIndex){
isApprover=true;
listUser.get(i_user).setExecute(EXECUTING);
}
//判断用户执行状态 0 未执行 1 执行中 2 已执行
//已执行
if (EXECUTED.equals(listUser.get(i_user).getExecute())) {
//执行中
}else if (EXECUTING.equals(listUser.get(i_user).getExecute())) {
//判断当前节点审批人id 等于 操作用户id 则更新执行人信息:审批意见、状态(0未执行 1执行中 2同意 3拒接 4转派)
if ((Integer.parseInt(redeployUser.getId()) == Integer.parseInt(listUser.get(i_user).getId()) && num == 0)){
num++;
SpmkExecutor.builder()
.id(executorId)
.opinion(opinion)
.empNum(Integer.parseInt(listUser.get(i_user).getId()))
.executorName(listUser.get(i_user).getName())
.operatorHeaderUrl(listUser.get(i_user).getHeadUrl())
.sts(sts)
.signatureImg(signatureImg)
.build().updateById();
listUser.get(i_user).setExecute(EXECUTED);
// 历史审批人
SpmkApproveSummary.builder()
.id(asId)
.historyApprover(listUser.get(i_user).getName())
.build()
.updateById();
//拒绝处理
// 0未执行 1执行中 2同意 3拒绝 4 转派
if(sts==ExecutorSts.AGREE.ordinal()){
}
if (sts == ExecutorSts.REFUSE.ordinal()) {
// 更新 审批汇总 状态
SpmkApproveSummary.builder().id(asId).currentApprover(CommonEnum.NULL_STR.getDesc()).endTime(new Date()).sts(sts).build().updateById();
SpmkApproveExecuteRecord
.builder()
.id(executeRecordId)
.sts(sts)
.build()
// 更新 审批执行记录
.updateById();
listFlowChildren.get(i_user).setExecute(EXECUTED);
return;
//转派 处理
//在 原审批人 列表中 插入 一个或多个被转派人(审批人)
}
else if (sts == ExecutorSts.REDEPLOY.ordinal()) {
List<User> users1 = CollectionUtil.sub(listUser, userIndex, userIndex+1);
//新增转派多个人功能
//判断是走派多个人的 否则走旧逻辑
if(!CollectionUtils.isEmpty(redeployUserList)){
//List<User> users1 = CollectionUtil.sub(listUser, 0, i_user+1); 第一次修改
//redeployUserList.add(users1.get(users1.size() - 1)); 第二次修改
/*flowChildren.getRelation().get(0).setName(users1.get(0).getName());
flowChildren.getRelation().get(0).getUsers().get(0).setName(users1.get(0).getName());
flowChildren.getRelation().get(0).getUsers().get(0).setId(users1.get(0).getId());*/
redeployIndex = i;
for (User ruser:redeployUserList
) {
ruser.setExecute(UNEXECUTED);
users1.add(ruser);
n_user = listUser.size();
}
// List<User> users2 = CollectionUtil.sub(listUser, i_user+1, listUser.size());
// listUser = ListUtils.union(users1, users2);//并集
//listR.get(0).setApprovalOrder("1");
listFlowChildren.get(i).getRelation().get(0).setApprovalOrder("1");
}else {
//List<User> users1 = CollectionUtil.sub(listUser, 0, i_user+1);
redeployUser.setExecute(UNEXECUTED);
users1.add(redeployUser);
//新加的 把转派人跟在后面说
User user = users1.get(users1.size() - 2);
// User us = new User();
// us.setExecute(UNEXECUTED);
// us.setName(user.getName());
// us.setId(user.getId());
// users1.add(us);
/*flowChildren.getRelation().get(0).setName(user.getName());
flowChildren.getRelation().get(0).getUsers().get(0).setName(user.getName());
flowChildren.getRelation().get(0).getUsers().get(0).setId(user.getId());*/
redeployIndex = i;
List<User> users2 = CollectionUtil.sub(listUser, i_user+1, listUser.size());
redeployUserList = users2;
//listUser = ListUtils.union(users1, users2);
n_user = listUser.size();
}
// System.out.println(users1);
// System.out.println(users2);
//
// System.out.println(listUser);
}
//break outloop;
}
//未执行
}
else if (UNEXECUTED.equals(listUser.get(i_user).getExecute())) {
//新增执行人 执行状态为执行中
SpmkExecutor.builder()
.approveExecuteRecordId(executeRecordId)
.empNum(Integer.parseInt(listUser.get(i_user).getId()))
.executorName(listUser.get(i_user).getName())
.operatorHeaderUrl(listUser.get(i_user).getHeadUrl())
.sts(ExecutorSts.IN_EXECUTION.ordinal())
.build()
.insert();
hasNextApprover = true;//标记为有下个审批人
listUser.get(i_user).setExecute(EXECUTING);
// 当前审批人
SpmkApproveSummary.builder().id(asId).currentApprover(listUser.get(i_user).getName()).build().updateById();
// 处理了 下一个审批人 则跳出循环
if(CollectionUtils.isEmpty(redeployUserList)){
break outloop;
}
}
}
// 无下一个审批人 则更新 节点状态 为 EXECUTED(已执行)
if (!hasNextApprover && es<=1) {
SpmkApproveExecuteRecord aer = SpmkApproveExecuteRecord
.builder()
.id(executeRecordId)
.sts(ExecutorSts.AGREE.ordinal())
.build();
// 更新 审批执行记录
aer.updateById();
// if(es<=1){
// listFlowChildren.get(i).setExecute(EXECUTED);
// }
listFlowChildren.get(i).setExecute(EXECUTED);
}
//判断大节点为未执行
}
else if (UNEXECUTED.equals(listFlowChildren.get(i).getExecute())) {
//判断无下一个审批人 并且 执行中的小于等于1
if (!hasNextApprover && es<=1) {
switch (listFlowChildren.get(i).getClassName()) {
case CREATOR://发起审批人
SpmkApproveExecuteRecord aer = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.INITIATOR.getName())
.type(ParticipatorType.INITIATOR.ordinal())
.sts(ExecuteRecordSts.AGREE.ordinal())
.build();
// 新增 审批执行记录
aer.insert();
// 新增 执行人
User user = listFlowChildren.get(i).getRelation().get(0).getUsers().get(0);
SpmkExecutor.builder()
.approveExecuteRecordId(aer.getId())
.empNum(Integer.parseInt(user.getId()))
.executorName(user.getName())
.operatorHeaderUrl(user.getHeadUrl())
.sts(ExecutorSts.AGREE.ordinal())
.build()
.insert();
listFlowChildren.get(i).setExecute(EXECUTED);
break;
case AUDIT://审批中
//判断是否是并序
if(aobl){
String currentApprover = "";
//遍历当前节点审批人
for (int i_user2 = 0,n_user2 = listUser.size(); i_user2 < n_user2; i_user2++) {
SpmkApproveExecuteRecord aer2 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.APPROVER.getName())
.type(ParticipatorType.APPROVER.ordinal())
.sts(ExecuteRecordSts.IN_EXECUTION.ordinal())
.build();
// 新增 审批执行记录
aer2.insert();
//新增执行人 并设置状态为执行中
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
.empNum(Integer.parseInt(listUser.get(i_user2).getId()))
.executorName(listUser.get(i_user2).getName())
.operatorHeaderUrl(listUser.get(i_user2).getHeadUrl())
.sts(ExecutorSts.IN_EXECUTION.ordinal())
.build();
executor.insert();
listUser.get(i_user2).setExecute(EXECUTING);
hasNextApprover = true;
currentApprover=currentApprover!=""?currentApprover+","+listUser.get(i_user2).getName():listUser.get(i_user2).getName();
// 当前审批人
SpmkApproveSummary.builder().id(asId).currentApprover(currentApprover).build().updateById();
}
listFlowChildren.get(i).setExecute(EXECUTING);
}else{
SpmkApproveExecuteRecord aer2 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.APPROVER.getName())
.type(ParticipatorType.APPROVER.ordinal())
.sts(ExecuteRecordSts.IN_EXECUTION.ordinal())
.build();
// 新增 审批执行记录
aer2.insert();
//遍历当前节点审批人
for (int i_user2 = 0,n_user2 = listUser.size(); i_user2 < n_user2; i_user2++) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer2.getId())
.empNum(Integer.parseInt(listUser.get(i_user2).getId()))
.executorName(listUser.get(i_user2).getName())
.operatorHeaderUrl(listUser.get(i_user2).getHeadUrl())
.sts(ExecutorSts.IN_EXECUTION.ordinal())
.build();
executor.insert();
listUser.get(i_user2).setExecute(EXECUTING);
hasNextApprover = true;
// 当前审批人
SpmkApproveSummary.builder().id(asId).currentApprover(listUser.get(i_user2).getName()).build().updateById();
// 处理了 下一个审批人 则跳出循环
break;
}
listFlowChildren.get(i).setExecute(EXECUTING);
}
}
listFlowChildren.get(i).setExecute(EXECUTED);
break;
break;
case COPY://抄送人
SpmkApproveExecuteRecord aer3 = SpmkApproveExecuteRecord
.builder()
.approveSummaryId(asId)
.name(ParticipatorType.COPY.getName())
.type(ParticipatorType.COPY.ordinal())
.sts(ExecuteRecordSts.AGREE.ordinal())
.build();
// 新增 审批执行记录
aer3.insert();
List<Relation> listRelation = listFlowChildren.get(i).getRelation();
for (Relation relation : listRelation) {
List<User> listUser2 = relation.getUsers();
if (listUser2 != null) {
// 新增 执行人
for (User user2 : listUser2) {
SpmkExecutor executor = SpmkExecutor.builder()
.approveExecuteRecordId(aer3.getId())
.empNum(Integer.parseInt(user2.getId()))
.executorName(user2.getName())
.operatorHeaderUrl(user2.getHeadUrl())
.sts(ExecutorSts.AGREE.ordinal())
.build();
executor.insert();
}
}
}
listFlowChildren.get(i).setExecute(EXECUTED);
break;
}
}
//重新新修改审批结果
}
}
}
public static List<Router> clearRouters(List<Router> routers){
}
return routers;
for (int i = 0; i < listFlowChildren.size(); i++) {
flowChildrenList.add(listFlowChildren.get(i));
/*** 转派添加审批人 ***/
/*if(i == redeployIndex){
flowChildrenList.add(flowChildren);
}*/
}
if (flowChildrenList.size() > 0){
listFlowChildren.clear();
listFlowChildren.addAll(flowChildrenList);
}
}
}
......@@ -244,8 +244,8 @@ config-8timer:
# 文件存储地址类型:aliyun-oss(阿里云OSS),physics-oss(物理机器OSS)
# 默认存储物理机器OSS
file-address:
type: physics-oss
#type: aliyun-oss
#type: physics-oss
type: aliyun-oss
#导出zip临时地址
zip:
......
......@@ -107,7 +107,7 @@ spring:
port: 465
class: javax.net.ssl.SSLSocketFactor
redis:
database: 4 # Redis数据库索引(默认为0),如果设置为1,那么存入的key-value都存放在select 1中
database: 2 # Redis数据库索引(默认为0),如果设置为1,那么存入的key-value都存放在select 1中
host: 120.78.162.177
port: 7788
password: (!0YouLingRcRedis0!)
......@@ -219,8 +219,8 @@ config-8timer:
# 文件存储地址类型:aliyun-oss(阿里云OSS),physics-oss(物理机器OSS)
# 默认存储物理机器OSS
file-address:
type: physics-oss
#type: aliyun-oss
#type: physics-oss
type: aliyun-oss
#导出zip临时地址
zip:
......
spring:
profiles:
active: dev
active: test
#active: '@environment@'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.kqmk.KqglAssoLeaveBalance" >
<id column="id" property="id" />
<result column="leave_rules_id" property="leaveRulesId" />
<result column="userid" property="userid" />
<result column="modify_action" property="modifyAction" />
<result column="balance_days" property="balanceDays" />
<result column="reason" property="reason" />
<result column="modify_userid" property="modifyUserid" />
<result column="modify_timer" property="modifyTimer" />
<result column="modify_number" property="modifyNumber" />
<result column="org_code" property="orgCode" />
<result column="is_automatic" property="isAutomatic" />
</resultMap>
<resultMap id="LeaveBalanceMap" type="cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto" >
<result column="empnum" property="empnum" />
<result column="empname" property="empname" />
<result column="department" property="department" />
<result column="rztime" property="rztime" />
<result column="orgcode" property="orgcode" />
<result column="turnover_status" property="turnover_status" />
<collection property="balanceTo" ofType="cn.timer.api.dto.kqmk.BalanceSheetDataDto">
<result column="leaverulesid" property="leaverulesid"/>
<result column="balancedays" property="balancedays"/>
</collection>
</resultMap>
<resultMap id="JiaqibalanceMap" type="cn.timer.api.dto.kqmk.JiaqibalanceDto" >
<result column="userid" property="userid" />
<result column="balancedays" property="balancedays" />
</resultMap>
<resultMap id="AdditionalMap" type="cn.timer.api.dto.kqmk.AdditionalDto" >
<result column="empnum" property="empnum" />
<result column="empname" property="empname" />
<result column="phone" property="phone" />
<result column="department" property="department" />
<result column="position" property="position" />
</resultMap>
<resultMap id="BaseResultMap" type="cn.timer.api.bean.kqmk.KqglAssoLeaveBalance" >
<id column="id" property="id" />
<result column="leave_rules_id" property="leaveRulesId" />
<result column="userid" property="userid" />
<result column="modify_action" property="modifyAction" />
<result column="balance_days" property="balanceDays" />
<result column="reason" property="reason" />
<result column="modify_userid" property="modifyUserid" />
<result column="modify_timer" property="modifyTimer" />
<result column="modify_number" property="modifyNumber" />
<result column="org_code" property="orgCode" />
<result column="is_automatic" property="isAutomatic" />
</resultMap>
<sql id="Base_Column_List">
<resultMap id="LeaveBalanceMap" type="cn.timer.api.dto.kqmk.EmployeeLeaveBalanceDto" >
<result column="empnum" property="empnum" />
<result column="empname" property="empname" />
<result column="department" property="department" />
<result column="rztime" property="rztime" />
<result column="orgcode" property="orgcode" />
<result column="turnover_status" property="turnover_status" />
<collection property="balanceTo" ofType="cn.timer.api.dto.kqmk.BalanceSheetDataDto">
<result column="leaverulesid" property="leaverulesid"/>
<result column="balancedays" property="balancedays"/>
</collection>
</resultMap>
<resultMap id="JiaqibalanceMap" type="cn.timer.api.dto.kqmk.JiaqibalanceDto" >
<result column="userid" property="userid" />
<result column="balancedays" property="balancedays" />
</resultMap>
<resultMap id="AdditionalMap" type="cn.timer.api.dto.kqmk.AdditionalDto" >
<result column="empnum" property="empnum" />
<result column="empname" property="empname" />
<result column="phone" property="phone" />
<result column="department" property="department" />
<result column="position" property="position" />
</resultMap>
<sql id="Base_Column_List">
id,
leave_rules_id,
userid,
......@@ -56,8 +56,8 @@
org_code,
is_automatic
</sql>
<sql id="Base_Column_List_Alias">
<sql id="Base_Column_List_Alias">
id KqglAssoLeaveBalance_id,
leave_rules_id KqglAssoLeaveBalance_leave_rules_id,
userid KqglAssoLeaveBalance_userid,
......@@ -70,61 +70,85 @@
org_code KqglAssoLeaveBalance_org_code,
is_automatic KqglAssoLeaveBalance_is_automatic
</sql>
<select id="selectPageByQueryLeaveBalance" resultMap="LeaveBalanceMap">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
emp.org_code as orgcode,
IFNULL(c.name,'') as department,
IFNULL(emp.rz_time,'') as rztime,
IFNULL((select em.job_status from yggl_main_lzb em where em.emp_num = emp.emp_num and em.org_code = emp.org_code),0) as turnover_status
from yggl_main_emp emp
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
where emp.org_code = #{param.orgCode}
<select id="selectPageByQueryLeaveBalance" resultMap="LeaveBalanceMap">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
emp.org_code as orgcode,
IFNULL(c.name,'') as department,
IFNULL(emp.rz_time,'') as rztime,
IFNULL((select em.job_status from yggl_main_lzb em where em.emp_num = emp.emp_num and em.org_code = emp.org_code),0) as turnover_status
from yggl_main_emp emp
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
where emp.org_code = #{param.orgCode}
<if test="param.query != null and param.query != ''">
and ( emp.`name` like CONCAT('%',#{param.query},'%') or
emp.emp_num like CONCAT('%',#{param.query},'%') or
c.name like CONCAT('%',#{param.query},'%'))
</if>
<if test="param.deptid != null and param.deptid != ''">
and c.id in (select m.id from zzgl_bmgw_m m where m.up_id = #{param.deptid}) or (c.id =#{param.deptid})
</if>
<if test="param.turnover_status == 0">
and emp.emp_num not in (select em.emp_num from yggl_main_lzb em where em.org_code = #{param.orgCode} and em.job_status = 3)
</if>
<if test="param.turnover_status == 1">
UNION
SELECT emp.emp_num AS empnum,
emp.`name` AS empname,
emp.org_code AS orgcode,
IFNULL(c. NAME, '') AS department,
IFNULL(emp.rz_time, '') AS rztime,
IFNULL(emp.job_status,0) as turnover_status
FROM yggl_main_lzb emp
LEFT JOIN zzgl_bmgw_m AS gw ON gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m AS c ON c.id = gw.up_id
WHERE emp.job_status = 3
<if test="param.query != null and param.query != ''">
and ( emp.`name` like CONCAT('%',#{param.query},'%') or
emp.emp_num like CONCAT('%',#{param.query},'%') or
c.name like CONCAT('%',#{param.query},'%'))
and ( emp.`name` like CONCAT('%',#{param.query},'%') or
emp.emp_num like CONCAT('%',#{param.query},'%') or
c.name like CONCAT('%',#{param.query},'%'))
</if>
<if test="param.deptid != null and param.deptid != ''">
and c.id in (select m.id from zzgl_bmgw_m m where m.up_id = #{param.deptid}) or (c.id =#{param.deptid})
</if>
<if test="param.turnover_status == 0">
and emp.emp_num not in (select em.emp_num from yggl_main_lzb em where em.org_code = #{param.orgCode} and em.job_status = 3)
</if>
<if test="param.turnover_status == 1">
UNION
SELECT emp.emp_num AS empnum,
emp.`name` AS empname,
emp.org_code AS orgcode,
IFNULL(c. NAME, '') AS department,
IFNULL(emp.rz_time, '') AS rztime,
IFNULL(emp.job_status,0) as turnover_status
FROM yggl_main_lzb emp
LEFT JOIN zzgl_bmgw_m AS gw ON gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m AS c ON c.id = gw.up_id
WHERE emp.job_status = 3
<if test="param.query != null and param.query != ''">
and ( emp.`name` like CONCAT('%',#{param.query},'%') or
emp.emp_num like CONCAT('%',#{param.query},'%') or
c.name like CONCAT('%',#{param.query},'%'))
</if>
<if test="param.deptid != null and param.deptid != ''">
and c.id in (select m.id from zzgl_bmgw_m m where m.up_id = #{param.deptid}) or (c.id =#{param.deptid})
</if>
and emp.org_code = #{param.orgCode}
</if>
<!--and c.id = #{param.deptid}
ORDER BY emp.emp_num DESC
LEFT JOIN kqgl_asso_leave_employee_balance as yz on yz.userid = emp.emp_num
yz.leave_rules_id as leaverulesid,
yz.balance_days as balancedays-->
</select>
<select id="selectAdditional" resultMap="AdditionalMap">
and emp.org_code = #{param.orgCode}
</if>
<!--and c.id = #{param.deptid}
ORDER BY emp.emp_num DESC
LEFT JOIN kqgl_asso_leave_employee_balance as yz on yz.userid = emp.emp_num
yz.leave_rules_id as leaverulesid,
yz.balance_days as balancedays-->
</select>
<select id="selectLeaveBalance" resultType="cn.timer.api.dto.kqmk.ExportEmployeeLeaveBalanceDto">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
emp.org_code as orgcode,
IFNULL(c.name,'') as department,
IFNULL(emp.rz_time,'') as rztime,
IFNULL((select em.job_status from yggl_main_lzb em where em.emp_num = emp.emp_num and em.org_code = emp.org_code),0) as turnover_status
from yggl_main_emp emp
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
where emp.org_code = #{param.orgCode}
<if test="param.query != null and param.query != ''">
and ( emp.`name` like CONCAT('%',#{param.query},'%') or
emp.emp_num like CONCAT('%',#{param.query},'%') or
c.name like CONCAT('%',#{param.query},'%'))
</if>
<if test="param.deptid != null and param.deptid != ''">
and c.id in (select m.id from zzgl_bmgw_m m where m.up_id = #{param.deptid}) or (c.id =#{param.deptid})
</if>
<if test="param.turnover_status == 0">
and emp.emp_num not in (select em.emp_num from yggl_main_lzb em where em.org_code = #{param.orgCode} and em.job_status = 3)
</if>
</select>
<select id="selectAdditional" resultMap="AdditionalMap">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
IFNULL(c.name,'') as department,
......@@ -135,22 +159,22 @@
where emp.org_code = #{orgcode}
and emp.emp_num = #{empnum}
</select>
<select id="selectAdditionalList" resultMap="AdditionalMap">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
emp.phone,
IFNULL(c.name,null) as department,
IFNULL(gw.`name`,null) as position
from yggl_main_emp emp
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
where emp.org_code = #{orgcode}
<!-- and emp.emp_num = 100083 -->
<!-- and emp.job_status != 3 -->
</select>
<select id="RealTimeUpdate" resultMap="AdditionalMap">
<select id="selectAdditionalList" resultMap="AdditionalMap">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
emp.phone,
IFNULL(c.name,null) as department,
IFNULL(gw.`name`,null) as position
from yggl_main_emp emp
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
where emp.org_code = #{orgcode}
<!-- and emp.emp_num = 100083 -->
<!-- and emp.job_status != 3 -->
</select>
<select id="RealTimeUpdate" resultMap="AdditionalMap">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
emp.phone,
......@@ -164,8 +188,8 @@
and yhkqz.kqzid = #{kqzid}
and emp.job_status != 3;
</select>
<select id="selectAdditionalByempnum" resultMap="AdditionalMap">
<select id="selectAdditionalByempnum" resultMap="AdditionalMap">
SELECT emp.emp_num as empnum,
emp.`name` as empname,
emp.phone,
......@@ -178,13 +202,13 @@
and emp.job_status != 3
and emp.emp_num = #{empnum}
</select>
<!-- <select id="selectleavebalanceList" resultMap="JiaqibalanceMap">
select bal.userid,SUM(bal.balance_days) as balancedays
from kqgl_asso_leave_balance bal
where bal.leave_rules_id = #{leaverulesid} and bal.userid = #{userid}
GROUP BY bal.userid
<!-- <select id="selectleavebalanceList" resultMap="JiaqibalanceMap">
select bal.userid,SUM(bal.balance_days) as balancedays
from kqgl_asso_leave_balance bal
where bal.leave_rules_id = #{leaverulesid} and bal.userid = #{userid}
GROUP BY bal.userid
</select> -->
<select id="Sumbalancedays" resultType="java.lang.Double">
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.qyxx.CmsIsReadMapper">
<resultMap id="BaseResultMap"
type="cn.timer.api.bean.qyxx.CmsIsRead">
type="cn.timer.api.bean.qyxx.CmsIsRead">
<id column="id" property="id" />
<result column="mid" property="mid" />
<result column="uid" property="uid" />
......@@ -24,7 +24,7 @@
<!-- 查询全部已读人 -->
<select id="queryIsReadEmp" parameterType="java.lang.Integer"
resultType="cn.timer.api.dto.qyxx.QyxxIsReadDto">
resultType="cn.timer.api.dto.qyxx.QyxxIsReadDto">
SELECT
a.mid mid,
a.uid uid,
......@@ -45,19 +45,27 @@
a.read_time ASC
</select>
<!-- <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.cmsI.CmsIsRead">
INSERT INTO cms_is_read <trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != mid'> mid, </if> <if test ='null != uid'> uid </if> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <if test ='null !=
mid'> #{mid}, </if> <if test ='null != uid'> #{uid} </if> </trim> </insert>
<delete id="delete" > DELETE FROM cms_is_read WHERE id = #{id} </delete>
<update id="update" parameterType="cn.timer.api.bean.cmsI.CmsIsRead"> UPDATE
cms_is_read <set> <if test ='null != mid'>mid = #{mid},</if> <if test ='null
!= uid'>uid = #{uid}</if> </set> WHERE id = #{id} </update> <select id="load"
resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM
cms_is_read WHERE id = #{id} </select> <select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> FROM cms_is_read LIMIT #{offset},
#{pageSize} </select> <select id="pageListCount" resultType="java.lang.Integer">
<select id="getUnreadList" resultType="cn.timer.api.bean.qyxx.CmsContent">
select cc.* from cms_content cc
left JOIN cms_content_read ccs on ccs.cms_content_id=cc.id
WHERE ccs.read_status = 0 and ccs.user_id=#{userId}
order by ccs.create_time desc
limit 10
</select>
<!-- <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.cmsI.CmsIsRead">
INSERT INTO cms_is_read <trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != mid'> mid, </if> <if test ='null != uid'> uid </if> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <if test ='null !=
mid'> #{mid}, </if> <if test ='null != uid'> #{uid} </if> </trim> </insert>
<delete id="delete" > DELETE FROM cms_is_read WHERE id = #{id} </delete>
<update id="update" parameterType="cn.timer.api.bean.cmsI.CmsIsRead"> UPDATE
cms_is_read <set> <if test ='null != mid'>mid = #{mid},</if> <if test ='null
!= uid'>uid = #{uid}</if> </set> WHERE id = #{id} </update> <select id="load"
resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM
cms_is_read WHERE id = #{id} </select> <select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" /> FROM cms_is_read LIMIT #{offset},
#{pageSize} </select> <select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1) FROM cms_is_read </select> -->
</mapper>
\ No newline at end of file
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.spmk.SpmkApproveDetailDraftsMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts" id="spmkApproveDetailDraftsMap">
<result property="id" column="id"/>
<result property="approveSummaryId" column="approve_summary_id"/>
<result property="name" column="name"/>
<result property="departmentName" column="department_name"/>
<result property="requestData" column="request_data"/>
<result property="froms" column="froms"/>
<result property="router" column="router"/>
<result property="flowChildren" column="flow_children"/>
</resultMap>
<select id="queryObject" resultType="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts">
select *
from spmk_approve_detail_drafts
where id = #{value}
</select>
<select id="queryList" resultType="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts">
select * from spmk_approve_detail_drafts
<where>
<if test="approveSummaryId != null and approveSummaryId != ''">AND `approve_summary_id` =
#{approveSummaryId}
</if>
<if test="name != null and name != ''">AND `name` = #{name}</if>
<if test="departmentName != null and departmentName != ''">AND `department_name` = #{departmentName}</if>
<if test="requestData != null and requestData != ''">AND `request_data` = #{requestData}</if>
<if test="froms != null and froms != ''">AND `froms` = #{froms}</if>
<if test="router != null and router != ''">AND `router` = #{router}</if>
<if test="flowChildren != null and flowChildren != ''">AND `flow_children` = #{flowChildren}</if>
</where>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from spmk_approve_detail_drafts
<where>
<if test="approveSummaryId != null and approveSummaryId != ''">AND `approve_summary_id` =
#{approveSummaryId}
</if>
<if test="name != null and name != ''">AND `name` = #{name}</if>
<if test="departmentName != null and departmentName != ''">AND `department_name` = #{departmentName}</if>
<if test="requestData != null and requestData != ''">AND `request_data` = #{requestData}</if>
<if test="froms != null and froms != ''">AND `froms` = #{froms}</if>
<if test="router != null and router != ''">AND `router` = #{router}</if>
<if test="flowChildren != null and flowChildren != ''">AND `flow_children` = #{flowChildren}</if>
</where>
</select>
<insert id="save" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts" useGeneratedKeys="true"
keyProperty="id">
insert into spmk_approve_detail_drafts
(`approve_summary_id`,
`name`,
`department_name`,
`request_data`,
`froms`,
`router`,
`flow_children`)
values (#{approveSummaryId},
#{name},
#{departmentName},
#{requestData},
#{froms},
#{router},
#{flowChildren})
</insert>
<insert id="saveSelective" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts" useGeneratedKeys="true"
keyProperty="id">
insert into spmk_approve_detail_drafts
(
<if test="approveSummaryId != null">,`approve_summary_id`</if>
<if test="name != null">,`name`</if>
<if test="departmentName != null">,`department_name`</if>
<if test="requestData != null">,`request_data`</if>
<if test="froms != null">,`froms`</if>
<if test="router != null">,`router`</if>
<if test="flowChildren != null">,`flow_children`</if>
)
values
(
<if test="approveSummaryId != null">,#{approveSummaryId}</if>
<if test="name != null">,#{name}</if>
<if test="departmentName != null">,#{departmentName}</if>
<if test="requestData != null">,#{requestData}</if>
<if test="froms != null">,#{froms}</if>
<if test="router != null">,#{router}</if>
<if test="flowChildren != null">,#{flowChildren}</if>
)
</insert>
<insert id="saveList" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts" useGeneratedKeys="true"
keyProperty="id">
insert into spmk_approve_detail_drafts
(
`approve_summary_id`,
`name`,
`department_name`,
`request_data`,
`froms`,
`router`,
`flow_children`
)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.approveSummaryId},
#{item.name},
#{item.departmentName},
#{item.requestData},
#{item.froms},
#{item.router},
#{item.flowChildren}
)
</foreach>
</insert>
<update id="update" parameterType="cn.timer.api.bean.spmk.SpmkApproveDetailDrafts">
update spmk_approve_detail_drafts
<set>
<if test="approveSummaryId != null">`approve_summary_id` = #{approveSummaryId},</if>
<if test="name != null">`name` = #{name},</if>
<if test="departmentName != null">`department_name` = #{departmentName},</if>
<if test="requestData != null">`request_data` = #{requestData},</if>
<if test="froms != null">`froms` = #{froms},</if>
<if test="router != null">`router` = #{router},</if>
<if test="flowChildren != null">`flow_children` = #{flowChildren}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete
from spmk_approve_detail_drafts
where id = #{value}
</delete>
<delete id="deleteBatch">
delete from spmk_approve_detail_drafts where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.spmk.SpmkApproveDraftsMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="cn.timer.api.bean.spmk.SpmkApproveDrafts" id="spmkApproveDraftsMap">
<result property="id" column="id"/>
<result property="orgCode" column="org_code"/>
<result property="empNum" column="emp_num"/>
<result property="title" column="title"/>
<result property="departmentName" column="department_name"/>
<result property="initiator" column="initiator"/>
<result property="createTime" column="create_time"/>
<result property="approveName" column="approve_name"/>
<result property="sts" column="sts"/>
<result property="currentApprover" column="current_approver"/>
<result property="historyApprover" column="history_approver"/>
<result property="assoType" column="asso_type"/>
<result property="updateTime" column="update_time"/>
<result property="endTime" column="end_time"/>
<result property="digest" column="digest"/>
<result property="isDelete" column="is_delete"/>
<result property="isUrgent" column="is_urgent"/>
</resultMap>
<select id="selectPageByQueryForEmpNum" resultMap="spmkApproveDraftsMap" >
SELECT
*
FROM spmk_approve_drafts a
WHERE a.org_code = #{param.orgCode} and a.is_delete=0 and a.emp_num=#{param.empNum}
ORDER BY a.id DESC
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.spmk.SpmkApproveExecuteRecordDraftsMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="cn.timer.api.bean.spmk.SpmkApproveExecuteRecordDrafts" id="spmkApproveExecuteRecordDraftsMap">
<result property="id" column="id"/>
<result property="approveSummaryId" column="approve_summary_id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="sts" column="sts"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="queryObject" resultType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecordDrafts">
select *
from spmk_approve_execute_record_drafts
where id = #{value}
</select>
<select id="queryList" resultType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecordDrafts">
select * from spmk_approve_execute_record_drafts
<where>
<if test="approveSummaryId != null and approveSummaryId != ''">AND `approve_summary_id` =
#{approveSummaryId}
</if>
<if test="name != null and name != ''">AND `name` = #{name}</if>
<if test="type != null and type != ''">AND `type` = #{type}</if>
<if test="sts != null and sts != ''">AND `sts` = #{sts}</if>
<if test="createTime != null and createTime != ''">AND `create_time` = #{createTime}</if>
<if test="updateTime != null and updateTime != ''">AND `update_time` = #{updateTime}</if>
</where>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from spmk_approve_execute_record_drafts
<where>
<if test="approveSummaryId != null and approveSummaryId != ''">AND `approve_summary_id` =
#{approveSummaryId}
</if>
<if test="name != null and name != ''">AND `name` = #{name}</if>
<if test="type != null and type != ''">AND `type` = #{type}</if>
<if test="sts != null and sts != ''">AND `sts` = #{sts}</if>
<if test="createTime != null and createTime != ''">AND `create_time` = #{createTime}</if>
<if test="updateTime != null and updateTime != ''">AND `update_time` = #{updateTime}</if>
</where>
</select>
<insert id="save" parameterType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecordDrafts" useGeneratedKeys="true"
keyProperty="id">
insert into spmk_approve_execute_record_drafts
(`approve_summary_id`,
`name`,
`type`,
`sts`,
`create_time`,
`update_time`)
values (#{approveSummaryId},
#{name},
#{type},
#{sts},
#{createTime},
#{updateTime})
</insert>
<insert id="saveSelective" parameterType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecordDrafts"
useGeneratedKeys="true" keyProperty="id">
insert into spmk_approve_execute_record_drafts
(
<if test="approveSummaryId != null">,`approve_summary_id`</if>
<if test="name != null">,`name`</if>
<if test="type != null">,`type`</if>
<if test="sts != null">,`sts`</if>
<if test="createTime != null">,`create_time`</if>
<if test="updateTime != null">,`update_time`</if>
)
values
(
<if test="approveSummaryId != null">,#{approveSummaryId}</if>
<if test="name != null">,#{name}</if>
<if test="type != null">,#{type}</if>
<if test="sts != null">,#{sts}</if>
<if test="createTime != null">,#{createTime}</if>
<if test="updateTime != null">,#{updateTime}</if>
)
</insert>
<insert id="saveList" parameterType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecordDrafts" useGeneratedKeys="true"
keyProperty="id">
insert into spmk_approve_execute_record_drafts
(
`approve_summary_id`,
`name`,
`type`,
`sts`,
`create_time`,
`update_time`
)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.approveSummaryId},
#{item.name},
#{item.type},
#{item.sts},
#{item.createTime},
#{item.updateTime}
)
</foreach>
</insert>
<update id="update" parameterType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecordDrafts">
update spmk_approve_execute_record_drafts
<set>
<if test="approveSummaryId != null">`approve_summary_id` = #{approveSummaryId},</if>
<if test="name != null">`name` = #{name},</if>
<if test="type != null">`type` = #{type},</if>
<if test="sts != null">`sts` = #{sts},</if>
<if test="createTime != null">`create_time` = #{createTime},</if>
<if test="updateTime != null">`update_time` = #{updateTime}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete
from spmk_approve_execute_record_drafts
where id = #{value}
</delete>
<delete id="deleteBatch">
delete from spmk_approve_execute_record_drafts where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
......@@ -4,26 +4,26 @@
<mapper namespace="cn.timer.api.dao.spmk.SpmkApproveExecuteRecordMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord" >
<id column="id" property="id" />
<result column="approve_summary_id" property="approveSummaryId" />
<result column="name" property="name" />
<result column="type" property="type" />
<result column="sts" property="sts" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<id column="id" property="id" />
<result column="approve_summary_id" property="approveSummaryId" />
<result column="name" property="name" />
<result column="type" property="type" />
<result column="sts" property="sts" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<resultMap id="BaseResultMapDto" type="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord" >
<id column="id" property="id" />
<result column="approve_summary_id" property="approveSummaryId" />
<result column="name" property="name" />
<result column="type" property="type" />
<result column="sts" property="sts" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<collection column="SpmkExecutor_id" property="spmkExecutors" ofType="cn.timer.api.bean.spmk.SpmkExecutor"
resultMap="cn.timer.api.dao.spmk.SpmkExecutorMapper.BaseResultMap" columnPrefix="SpmkExecutor_">
</collection>
<id column="id" property="id" />
<result column="approve_summary_id" property="approveSummaryId" />
<result column="name" property="name" />
<result column="type" property="type" />
<result column="sts" property="sts" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<collection column="SpmkExecutor_id" property="spmkExecutors" ofType="cn.timer.api.bean.spmk.SpmkExecutor"
resultMap="cn.timer.api.dao.spmk.SpmkExecutorMapper.BaseResultMap" columnPrefix="SpmkExecutor_">
</collection>
</resultMap>
<sql id="Base_Column_List">
......@@ -35,7 +35,7 @@
create_time,
update_time
</sql>
<sql id="Base_Column_List_a">
a.id,
a.approve_summary_id,
......@@ -45,7 +45,7 @@
a.create_time,
a.update_time
</sql>
<sql id="Base_Column_List_Alias_b">
b.id SpmkExecutor_id,
b.approve_execute_record_id SpmkExecutor_approve_execute_record_id,
......@@ -54,11 +54,12 @@
b.operator_header_url SpmkExecutor_operator_header_url,
b.opinion SpmkExecutor_opinion,
b.sts SpmkExecutor_sts,
b.read_status SpmkExecutor_read_status,
b.create_time SpmkExecutor_create_time,
b.update_time SpmkExecutor_update_time,
b.signature_img SpmkExecutor_signature_img
</sql>
<sql id="Base_Column_List_Alias">
id SpmkApproveExecuteRecord_id,
approve_summary_id SpmkApproveExecuteRecord_approve_summary_id,
......@@ -68,21 +69,21 @@
create_time SpmkApproveExecuteRecord_create_time,
update_time SpmkApproveExecuteRecord_update_time
</sql>
<select id="selectListByAsId" resultMap="BaseResultMapDto">
SELECT
<include refid="Base_Column_List_a" />,
<include refid="Base_Column_List_Alias_b" />
SELECT
<include refid="Base_Column_List_a" />,
<include refid="Base_Column_List_Alias_b" />
FROM spmk_approve_execute_record a
LEFT JOIN spmk_executor b ON a.id = b.approve_execute_record_id
WHERE a.approve_summary_id = #{id}
WHERE a.approve_summary_id = #{id}
ORDER BY a.id, b.id
</select>
<!--
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord">
INSERT INTO spmk_approve_execute_record
......@@ -164,6 +165,29 @@
FROM spmk_approve_execute_record
</select>
-->
-->
<select id="selectExecuteRecordById" resultType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord">
SELECT sr.id FROM spmk_approve_execute_record sr
LEFT JOIN spmk_executor se ON se.approve_execute_record_id=sr.id
WHERE sr.approve_summary_id = #{approveSummaryId} and se.emp_num = #{userId}
</select>
<select id="selectExecuteRecordReoId" resultType="cn.timer.api.bean.spmk.SpmkApproveExecuteRecord">
SELECT sr.id FROM spmk_approve_execute_record sr
LEFT JOIN spmk_executor se ON se.approve_execute_record_id=sr.id
WHERE sr.approve_summary_id = #{approveSummaryId} and se.uid = #{reoId}
</select>
<delete id="delExecuteRecord">
DELETE sr,se FROM spmk_approve_execute_record sr
LEFT JOIN spmk_executor se on sr.id=se.approve_execute_record_id
WHERE sr.approve_summary_id = #{approveSummaryId} and sr.id <![CDATA[ > ]]> #{recordId}
</delete>
<delete id="delExecuteRecordByRecordIds">
DELETE sr,se FROM spmk_approve_execute_record sr
LEFT JOIN spmk_executor se on sr.id=se.approve_execute_record_id
WHERE sr.id =#{id} and se.emp_num =#{uid}
</delete>
</mapper>
\ No newline at end of file
</mapper>
......@@ -4,45 +4,45 @@
<mapper namespace="cn.timer.api.dao.spmk.SpmkApproveSummaryMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkApproveSummary" >
<id column="id" property="id" />
<result column="org_code" property="orgCode" />
<result column="emp_num" property="empNum" />
<result column="title" property="title" />
<result column="department_name" property="departmentName" />
<result column="initiator" property="initiator" />
<result column="create_time" property="createTime" />
<result column="approve_name" property="approveName" />
<result column="sts" property="sts" />
<result column="current_approver" property="currentApprover" />
<result column="history_approver" property="historyApprover" />
<result column="asso_type" property="assoType" />
<result column="digest" property="digest" />
<result column="update_time" property="updateTime" />
<result column="end_time" property="endTime" />
<result column="digest" property="digest" />
<result column="is_delete" property="isDelete" />
<id column="id" property="id" />
<result column="org_code" property="orgCode" />
<result column="emp_num" property="empNum" />
<result column="title" property="title" />
<result column="department_name" property="departmentName" />
<result column="initiator" property="initiator" />
<result column="create_time" property="createTime" />
<result column="approve_name" property="approveName" />
<result column="sts" property="sts" />
<result column="current_approver" property="currentApprover" />
<result column="history_approver" property="historyApprover" />
<result column="asso_type" property="assoType" />
<result column="digest" property="digest" />
<result column="update_time" property="updateTime" />
<result column="end_time" property="endTime" />
<result column="digest" property="digest" />
<result column="is_delete" property="isDelete" />
</resultMap>
<resultMap id="BaseResultMap_As" type="cn.timer.api.bean.spmk.SpmkApproveSummary" >
<id column="id" property="id" />
<result column="org_code" property="orgCode" />
<result column="emp_num" property="empNum" />
<result column="title" property="title" />
<result column="department_name" property="departmentName" />
<result column="initiator" property="initiator" />
<result column="create_time" property="createTime" />
<result column="approve_name" property="approveName" />
<result column="sts" property="sts" />
<result column="current_approver" property="currentApprover" />
<result column="history_approver" property="historyApprover" />
<result column="asso_type" property="assoType" />
<result column="update_time" property="updateTime" />
<result column="end_time" property="endTime" />
<result column="digest" property="digest" />
<result column="is_delete" property="isDelete" />
<result column="gw_name" property="gwName" />
<result column="bm_id" property="bmId" />
<result column="bm_name" property="bmName" />
<id column="id" property="id" />
<result column="org_code" property="orgCode" />
<result column="emp_num" property="empNum" />
<result column="title" property="title" />
<result column="department_name" property="departmentName" />
<result column="initiator" property="initiator" />
<result column="create_time" property="createTime" />
<result column="approve_name" property="approveName" />
<result column="sts" property="sts" />
<result column="current_approver" property="currentApprover" />
<result column="history_approver" property="historyApprover" />
<result column="asso_type" property="assoType" />
<result column="update_time" property="updateTime" />
<result column="end_time" property="endTime" />
<result column="digest" property="digest" />
<result column="is_delete" property="isDelete" />
<result column="gw_name" property="gwName" />
<result column="bm_id" property="bmId" />
<result column="bm_name" property="bmName" />
</resultMap>
<sql id="Base_Column_List">
......@@ -63,7 +63,7 @@
digest,
is_delete
</sql>
<sql id="Base_Column_List_a">
a.id,
a.org_code,
......@@ -83,7 +83,7 @@
a.is_delete,
a.is_urgent
</sql>
<sql id="Base_Column_List_Alias">
id SpmkApproveSummary_id,
org_code SpmkApproveSummary_org_code,
......@@ -101,109 +101,109 @@
end_time SpmkApproveSummary_end_time,
digest SpmkApproveSummary_digest
</sql>
<select id="selectPageByQuery" resultMap="BaseResultMap_As" >
SELECT
<include refid="Base_Column_List_a" />,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num and a.org_code=org_code limit 1) limit 1) as gw_name,
(SELECT id FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num and a.org_code=org_code limit 1) limit 1) limit 1) as bm_id,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num and a.org_code=org_code limit 1) limit 1) limit 1) as bm_name
SELECT
<include refid="Base_Column_List_a" />,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num and a.org_code=org_code limit 1) limit 1) as gw_name,
(SELECT id FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num and a.org_code=org_code limit 1) limit 1) limit 1) as bm_id,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num and a.org_code=org_code limit 1) limit 1) limit 1) as bm_name
FROM spmk_approve_summary a
WHERE a.org_code = #{param.orgCode} and a.is_delete = 0
<if test="param.query != null and param.query != ''">
and (
a.title like CONCAT('%',#{param.query},'%') or
a.initiator like CONCAT('%',#{param.query},'%') or
a.id like CONCAT('%',#{param.query},'%')
)
</if>
<if test="param.sts != null">
and a.sts = #{param.sts}
</if>
<if test="param.startTime != null and param.startTime != ''">
and a.create_time <![CDATA[ >= ]]> #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
and a.create_time <![CDATA[ <= ]]> #{param.endTime}
</if>
<if test="param.empNums != null and param.empNums.size() > 0">
and a.emp_num IN
(
<foreach item="it" index="index" collection="param.empNums" separator="," close="" >
#{it}
</foreach>
)
</if>
<if test="param.query != null and param.query != ''">
and (
a.title like CONCAT('%',#{param.query},'%') or
a.initiator like CONCAT('%',#{param.query},'%') or
a.id like CONCAT('%',#{param.query},'%')
)
</if>
<if test="param.sts != null">
and a.sts = #{param.sts}
</if>
<if test="param.startTime != null and param.startTime != ''">
and a.create_time <![CDATA[ >= ]]> #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
and a.create_time <![CDATA[ <= ]]> #{param.endTime}
</if>
<if test="param.empNums != null and param.empNums.size() > 0">
and a.emp_num IN
(
<foreach item="it" index="index" collection="param.empNums" separator="," close="" >
#{it}
</foreach>
)
</if>
ORDER BY a.id DESC
</select>
<select id="selectPageByQueryForEmpNum" resultMap="BaseResultMap_As" >
SELECT
<include refid="Base_Column_List_a" />,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) as gw_name,
(SELECT id FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) limit 1) as bm_id,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) limit 1) as bm_name
SELECT
<include refid="Base_Column_List_a" />,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) as gw_name,
(SELECT id FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) limit 1) as bm_id,
(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = (SELECT bmgw_id FROM yggl_main_emp WHERE a.emp_num = emp_num limit 1) limit 1) limit 1) as bm_name
FROM spmk_approve_summary a
WHERE a.org_code = #{param.orgCode} and a.is_delete=0
<if test="param.type != null and param.type >= 1">
and a.id in
(SELECT approve_summary_id FROM spmk_approve_execute_record WHERE id IN
(SELECT
approve_execute_record_id
FROM
spmk_executor
WHERE
emp_num = #{param.empNum}
<if test="param.sts == 0">
and sts not in (2,3,4)
</if>
)
<if test="param.type == 3">
and type in (0,1,2)
</if>
<if test="param.type != 3">
and type = #{param.type}
</if>
)
</if>
<if test="param.type != null and param.type == 0">
and a.emp_num = #{param.empNum}
</if>
<if test="param.sts != null">
<if test="param.sts == 5">
and a.sts in (0,1,2,3)
</if>
<if test="param.sts == 4">
and a.sts in (2,3)
</if>
<if test="param.sts != 4 and param.sts != 5">
and a.sts = #{param.sts}
</if>
</if>
<if test="param.query != null and param.query != ''">
and (
a.title like CONCAT('%',#{param.query},'%') or
a.initiator like CONCAT('%',#{param.query},'%') or
a.id like CONCAT('%',#{param.query},'%')
)
</if>
<if test="param.startTime != null and param.startTime != ''">
and a.create_time <![CDATA[ >= ]]> #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
and a.create_time <![CDATA[ <= ]]> #{param.endTime}
</if>
<if test="param.type != null and param.type >= 1">
and a.id in
(SELECT approve_summary_id FROM spmk_approve_execute_record WHERE id IN
(SELECT
approve_execute_record_id
FROM
spmk_executor
WHERE
emp_num = #{param.empNum}
<if test="param.sts == 0">
and sts not in (2,3,4)
</if>
)
<if test="param.type == 3">
and type in (0,1,2)
</if>
<if test="param.type != 3">
and type = #{param.type}
</if>
)
</if>
<if test="param.type != null and param.type == 0">
and a.emp_num = #{param.empNum}
</if>
<if test="param.sts != null">
<if test="param.sts == 5">
and a.sts in (0,1,2,3)
</if>
<if test="param.sts == 4">
and a.sts in (2,3)
</if>
<if test="param.sts != 4 and param.sts != 5">
and a.sts = #{param.sts}
</if>
</if>
<if test="param.query != null and param.query != ''">
and (
a.title like CONCAT('%',#{param.query},'%') or
a.initiator like CONCAT('%',#{param.query},'%') or
a.id like CONCAT('%',#{param.query},'%')
)
</if>
<if test="param.startTime != null and param.startTime != ''">
and a.create_time <![CDATA[ >= ]]> #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
and a.create_time <![CDATA[ <= ]]> #{param.endTime}
</if>
ORDER BY a.id DESC
</select>
<!--
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.spmk.SpmkApproveSummary">
INSERT INTO spmk_approve_summary
......@@ -341,6 +341,6 @@
FROM spmk_approve_summary
</select>
-->
-->
</mapper>
\ No newline at end of file
</mapper>
......@@ -4,16 +4,17 @@
<mapper namespace="cn.timer.api.dao.spmk.SpmkExecutorMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.spmk.SpmkExecutor" >
<id column="id" property="id" />
<result column="approve_execute_record_id" property="approveExecuteRecordId" />
<result column="emp_num" property="empNum" />
<result column="executor_name" property="executorName" />
<result column="operator_header_url" property="operatorHeaderUrl" />
<result column="opinion" property="opinion" />
<result column="sts" property="sts" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="signature_img" property="signatureImg" />
<id column="id" property="id" />
<result column="approve_execute_record_id" property="approveExecuteRecordId" />
<result column="emp_num" property="empNum" />
<result column="executor_name" property="executorName" />
<result column="operator_header_url" property="operatorHeaderUrl" />
<result column="opinion" property="opinion" />
<result column="sts" property="sts" />
<result column="read_status" property="readStatus" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="signature_img" property="signatureImg" />
</resultMap>
<sql id="Base_Column_List">
......@@ -24,11 +25,12 @@
operator_header_url,
opinion,
sts,
read_status,
create_time,
update_time,
signature_img,
</sql>
<sql id="Base_Column_List_Alias">
id SpmkExecutor_id,
approve_execute_record_id SpmkExecutor_approve_execute_record_id,
......@@ -41,7 +43,7 @@
update_time SpmkExecutor_update_time
</sql>
<!--
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.spmk.SpmkExecutor">
INSERT INTO spmk_executor
......@@ -137,6 +139,10 @@
FROM spmk_executor
</select>
-->
-->
<select id="executor" resultMap="BaseResultMap">
select
</select>
</mapper>
\ No newline at end of file
</mapper>
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