Merge branch 'wcd-2411-update' of http://192.168.1.110:5678/r/pms-upgrade into wcd
# Conflicts:
# eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/attendance/service/impl/AttendanceLeaveServiceImpl.java
51 files added
28 files modified
| | |
| | | public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp?ip=%s&json=true"; |
| | | } |
| | | |
| | | public static class Constant { |
| | | // 审批模版删除判定:普通 |
| | | public static final String TEMPLATE_DEL_STATUS_NORMAL = "0"; |
| | | |
| | | // 审批模版删除判定:删除 |
| | | public static final String TEMPLATE_DEL_STATUS_DEL = "1"; |
| | | |
| | | // 审批模版语言:中文 |
| | | public static final String TEMPLATE_LANG_ZH = "zh_CN"; |
| | | |
| | | // 审批模版语言:英文 |
| | | public static final String TEMPLATE_LANG_EN = "en"; |
| | | |
| | | // 审批模版控件类型:文本 |
| | | public static final String TEMPLATE_CONTROL_TYPE_TEXT = "Text"; |
| | | |
| | | // 审批模版控件类型:多行文本 |
| | | public static final String TEMPLATE_CONTROL_TYPE_TEXTAREA = "Textarea"; |
| | | |
| | | // 审批模版控件类型:数字 |
| | | public static final String TEMPLATE_CONTROL_TYPE_NUMBER = "Number"; |
| | | |
| | | // 审批模版控件类型:金额 |
| | | public static final String TEMPLATE_CONTROL_TYPE_MONEY = "Money"; |
| | | |
| | | // 审批模版控件类型:日期/日期+时间 |
| | | public static final String TEMPLATE_CONTROL_TYPE_DATE = "Date"; |
| | | |
| | | // 审批模版控件类型:单选/多选 |
| | | public static final String TEMPLATE_CONTROL_TYPE_SELECTOR = "Selector"; |
| | | |
| | | // 审批模版控件类型:成员/部门 |
| | | public static final String TEMPLATE_CONTROL_TYPE_CONTACT = "Contact"; |
| | | |
| | | // 审批模版控件类型:说明文字 |
| | | public static final String TEMPLATE_CONTROL_TYPE_TIPS = "Tips"; |
| | | |
| | | // 审批模版控件类型:附件 |
| | | public static final String TEMPLATE_CONTROL_TYPE_FILE = "File"; |
| | | |
| | | // 审批模版控件类型:明细 |
| | | public static final String TEMPLATE_CONTROL_TYPE_TABLE = "Table"; |
| | | |
| | | // 审批模版控件类型:位置 |
| | | public static final String TEMPLATE_CONTROL_TYPE_LOCATION = "Location"; |
| | | |
| | | // 审批模版控件类型:关联审批单 |
| | | public static final String TEMPLATE_CONTROL_TYPE_RELATEDAPPROVAL = "RelatedApproval"; |
| | | |
| | | // 审批模版控件类型:公式 |
| | | public static final String TEMPLATE_CONTROL_TYPE_FORMULA = "Formula"; |
| | | |
| | | // 审批模版控件类型:时长 |
| | | public static final String TEMPLATE_CONTROL_TYPE_DATERANGE = "DateRange"; |
| | | |
| | | // 审批模版控件类型:假勤组件-请假组件 |
| | | public static final String TEMPLATE_CONTROL_TYPE_VACATION = "Vacation"; |
| | | |
| | | // 审批模版控件类型:假勤组件-出差/外出/加班组件 |
| | | public static final String TEMPLATE_CONTROL_TYPE_ATTENDANCE = "Attendance"; |
| | | |
| | | // 审批模版时长粒度:小时 |
| | | public static final String TEMPLATE_DATE_TYPE_HOUR = "hour"; |
| | | |
| | | // 审批模版时长粒度:天 |
| | | public static final String TEMPLATE_DATE_TYPE_HALFDAY = "halfday"; |
| | | } |
| | | |
| | | /** |
| | | * 常用枚举 |
| | | */ |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import javax.persistence.*; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Table; |
| | | |
| | | import me.zhengjie.base.BaseEntity; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="approve_event") |
| | | public class ApproveEvent extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`event_id`") |
| | | @ApiModelProperty(value = "事件ID") |
| | | private Long eventId; |
| | | |
| | | @Column(name = "`sp_no`") |
| | | @ApiModelProperty(value = "审批编号") |
| | | private String spNo; |
| | | |
| | | @Column(name = "`sp_name`") |
| | | @ApiModelProperty(value = "审批申请类型名称(审批模板名称)") |
| | | private String spName; |
| | | |
| | | @Column(name = "`sp_status`") |
| | | @ApiModelProperty(value = "申请单状态") |
| | | private String spStatus; |
| | | |
| | | @Column(name = "`template_id`") |
| | | @ApiModelProperty(value = "审批模板id") |
| | | private String templateId; |
| | | |
| | | @Column(name = "`apply_time`") |
| | | @ApiModelProperty(value = "审批申请提交时间") |
| | | private Timestamp applyTime; |
| | | |
| | | @Column(name = "`applyer_party`") |
| | | @ApiModelProperty(value = "申请人所在部门pid") |
| | | private String applyerParty; |
| | | |
| | | @Column(name = "`applyer_user_id`") |
| | | @ApiModelProperty(value = "申请人userid") |
| | | private String applyerUserId; |
| | | |
| | | @Column(name = "`sp_record`") |
| | | @ApiModelProperty(value = "审批流程信息") |
| | | private String spRecord; |
| | | |
| | | @Column(name = "`notifyer`") |
| | | @ApiModelProperty(value = "抄送信息") |
| | | private String notifyer; |
| | | |
| | | @Column(name = "`comments`") |
| | | @ApiModelProperty(value = "审批申请备注信息") |
| | | private String comments; |
| | | |
| | | @Column(name = "`process_list`") |
| | | @ApiModelProperty(value = "审批流程列表") |
| | | private String processList; |
| | | |
| | | @Column(name = "`status_change_event`") |
| | | @ApiModelProperty(value = "审批申请状态变化类型") |
| | | private String statusChangeEvent; |
| | | |
| | | public void copy(ApproveEvent source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import javax.persistence.*; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Table; |
| | | |
| | | import me.zhengjie.base.BaseEntity; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="template") |
| | | public class Template extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "主键ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`template_id`") |
| | | @ApiModelProperty(value = "模版ID(企微内)") |
| | | private String templateId; |
| | | |
| | | @Column(name = "`del_status`") |
| | | @ApiModelProperty(value = "删除判定") |
| | | private String delStatus; |
| | | |
| | | @Column(name = "`template_name_zh`") |
| | | @ApiModelProperty(value = "模板名称(中文)") |
| | | private String templateNameZh; |
| | | |
| | | @Column(name = "`template_name_en`") |
| | | @ApiModelProperty(value = "模板名称(英文)") |
| | | private String templateNameEn; |
| | | |
| | | public void copy(Template source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import javax.persistence.*; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Table; |
| | | |
| | | import me.zhengjie.base.BaseEntity; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="template_control") |
| | | public class TemplateControl extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "主键ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`template_id`") |
| | | @ApiModelProperty(value = "模版ID") |
| | | private Long templateId; |
| | | |
| | | @Column(name = "`control_type`") |
| | | @ApiModelProperty(value = "控件类型") |
| | | private String controlType; |
| | | |
| | | @Column(name = "`control_id`") |
| | | @ApiModelProperty(value = "控件ID") |
| | | private String controlId; |
| | | |
| | | @Column(name = "`control_param`") |
| | | @ApiModelProperty(value = "控件参数") |
| | | private String controlParam; |
| | | |
| | | @Column(name = "`control_param_name`") |
| | | @ApiModelProperty(value = "控件参数名称") |
| | | private String controlParamName; |
| | | |
| | | @Column(name = "`placeholder_text_zh`") |
| | | @ApiModelProperty(value = "占位符文本(中文)") |
| | | private String placeholderTextZh; |
| | | |
| | | @Column(name = "`placeholder_text_en`") |
| | | @ApiModelProperty(value = "占位符文本(英文)") |
| | | private String placeholderTextEn; |
| | | |
| | | @Column(name = "`content_require`") |
| | | @ApiModelProperty(value = "是否必填") |
| | | private Integer contentRequire; |
| | | |
| | | @Column(name = "`content_print`") |
| | | @ApiModelProperty(value = "是否参与打印") |
| | | private Integer contentPrint; |
| | | |
| | | @Column(name = "`content_config`") |
| | | @ApiModelProperty(value = "控件设定") |
| | | private String contentConfig; |
| | | |
| | | @Column(name = "`del_status`") |
| | | @ApiModelProperty(value = "删除判定") |
| | | private String delStatus; |
| | | |
| | | @Column(name = "`title_text_zh`") |
| | | @ApiModelProperty(value = "标题文本(中文)") |
| | | private String titleTextZh; |
| | | |
| | | @Column(name = "`title_text_en`") |
| | | @ApiModelProperty(value = "标题文本(英文)") |
| | | private String titleTextEn; |
| | | |
| | | public void copy(TemplateControl source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.domain; |
| | | |
| | | import lombok.Data; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | import javax.persistence.*; |
| | | import javax.persistence.Entity; |
| | | import javax.persistence.Table; |
| | | |
| | | import me.zhengjie.base.BaseEntity; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Entity |
| | | @Data |
| | | @Table(name="template_control_field") |
| | | public class TemplateControlField extends BaseEntity implements Serializable { |
| | | |
| | | @Id |
| | | @GeneratedValue(strategy = GenerationType.IDENTITY) |
| | | @Column(name = "`id`") |
| | | @ApiModelProperty(value = "主键ID") |
| | | private Long id; |
| | | |
| | | @Column(name = "`template_id`") |
| | | @ApiModelProperty(value = "模板ID") |
| | | private Long templateId; |
| | | |
| | | @Column(name = "`control_id`") |
| | | @ApiModelProperty(value = "控件ID") |
| | | private Long controlId; |
| | | |
| | | @Column(name = "`field_table`") |
| | | @ApiModelProperty(value = "字段表名") |
| | | private String fieldTable; |
| | | |
| | | @Column(name = "`field_name`") |
| | | @ApiModelProperty(value = "字段名称") |
| | | private String fieldName; |
| | | |
| | | @Column(name = "`del_status`") |
| | | @ApiModelProperty(value = "删除判定") |
| | | private String delStatus; |
| | | |
| | | public void copy(TemplateControlField source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.approval.listener; |
| | | |
| | | import com.google.gson.Gson; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.approval.domain.ApproveEvent; |
| | | import me.zhengjie.modules.approval.domain.Template; |
| | | import me.zhengjie.modules.approval.domain.TemplateControlField; |
| | | import me.zhengjie.modules.approval.repository.ApproveEventRepository; |
| | | import me.zhengjie.modules.approval.repository.TemplateControlFieldRepository; |
| | | import me.zhengjie.modules.approval.repository.TemplateRepository; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlFieldQueryCriteria; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateQueryCriteria; |
| | | import me.zhengjie.modules.attendance.domain.*; |
| | | import me.zhengjie.modules.attendance.repository.*; |
| | | import me.zhengjie.modules.attendance.service.*; |
| | | import me.zhengjie.modules.attendance.service.dto.*; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.temp.domain.WechatSendHistory; |
| | | import me.zhengjie.modules.temp.event.ChangeApprovalStatusEvent; |
| | | import me.zhengjie.modules.temp.repository.WechatSendHistoryRepository; |
| | | import me.zhengjie.modules.temp.service.dto.wecom.ApprovalSend; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import me.zhengjie.utils.StringUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.context.event.EventListener; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | @RequiredArgsConstructor |
| | | public class ChangeApprovalStatusEventListener { |
| | | |
| | | private final WechatSendHistoryRepository wechatSendHistoryRepository; |
| | | private final TemplateRepository templateRepository; |
| | | private final TemplateControlFieldRepository templateControlFieldRepository; |
| | | private final ApproveEventRepository approveEventRepository; |
| | | private final AttendanceLeaveService attendanceLeaveService; |
| | | private final AttendanceLeaveRepository attendanceLeaveRepository; |
| | | private final AttendanceGoOutService attendanceGoOutService; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | private final AttendanceBusinessTravelService attendanceBusinessTravelService; |
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository; |
| | | private final AttendanceOvertimeService attendanceOvertimeService; |
| | | private final AttendanceOvertimeRepository attendanceOvertimeRepository; |
| | | private final AttendanceCardreplacementService attendanceCardreplacementService; |
| | | private final AttendanceCardreplacementRepository attendanceCardreplacementRepository; |
| | | |
| | | @EventListener |
| | | @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) |
| | | public void handleChangeApprovalStatusEvent(ChangeApprovalStatusEvent event) { |
| | | WechatSendHistory history = wechatSendHistoryRepository.findById(event.getHistoryId()).orElse(new WechatSendHistory()); |
| | | |
| | | Gson gson = new Gson(); |
| | | ApprovalSend approvalSend = gson.fromJson(history.getContent(), ApprovalSend.class); |
| | | |
| | | if (approvalSend.getEvent().equals("sys_approval_change") && StringUtils.isNotBlank(approvalSend.getApprovalInfo().getTemplateId())) { |
| | | TemplateQueryCriteria templateCriteria = new TemplateQueryCriteria(); |
| | | templateCriteria.setTemplateId(approvalSend.getApprovalInfo().getTemplateId()); |
| | | List<Template> templateList = templateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,templateCriteria,criteriaBuilder), Sort.by(Sort.Direction.DESC, "id")); |
| | | if (templateList.size() > 0) { |
| | | TemplateControlFieldQueryCriteria fieldCriteria = new TemplateControlFieldQueryCriteria(); |
| | | fieldCriteria.setTemplateId(templateList.get(0).getId()); |
| | | List<TemplateControlField> fieldList = templateControlFieldRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,fieldCriteria,criteriaBuilder), Sort.by(Sort.Direction.DESC, "id")); |
| | | |
| | | if (fieldList.size() > 0) { |
| | | // 保存下发事件信息 |
| | | ApproveEvent approveEvent = new ApproveEvent(); |
| | | approveEvent.setSpNo(approvalSend.getApprovalInfo().getSpNo()); |
| | | approveEvent.setSpName(approvalSend.getApprovalInfo().getSpName()); |
| | | approveEvent.setSpStatus(approvalSend.getApprovalInfo().getSpStatus().toString()); |
| | | approveEvent.setTemplateId(approvalSend.getApprovalInfo().getTemplateId()); |
| | | approveEvent.setApplyTime(new Timestamp(Long.parseLong(approvalSend.getApprovalInfo().getApplyTime()) * 1000L)); |
| | | approveEvent.setApplyerParty(approvalSend.getApprovalInfo().getApplyer().getParty()); |
| | | approveEvent.setApplyerUserId(approvalSend.getApprovalInfo().getApplyer().getUserId()); |
| | | approveEvent.setSpRecord(ObjectUtils.isNotEmpty(approvalSend.getApprovalInfo().getSpRecord()) ? gson.toJson(approvalSend.getApprovalInfo().getSpRecord()) : null); |
| | | approveEvent.setNotifyer(ObjectUtils.isNotEmpty(approvalSend.getApprovalInfo().getNotifyer()) ? gson.toJson(approvalSend.getApprovalInfo().getNotifyer()) : null); |
| | | approveEvent.setComments(ObjectUtils.isNotEmpty(approvalSend.getApprovalInfo().getComments()) ? gson.toJson(approvalSend.getApprovalInfo().getComments()) : null); |
| | | approveEvent.setProcessList(ObjectUtils.isNotEmpty(approvalSend.getApprovalInfo().getProcessList()) ? gson.toJson(approvalSend.getApprovalInfo().getProcessList()) : null); |
| | | approveEvent.setStatusChangeEvent(approvalSend.getApprovalInfo().getStatuChangeEvent().toString()); |
| | | |
| | | ApproveEvent approveEventSaved = approveEventRepository.save(approveEvent); |
| | | if (fieldList.get(0).getFieldTable().equals("AttendanceLeave")) { |
| | | // 请假 |
| | | AttendanceLeaveQueryCriteria leaveCriteria = new AttendanceLeaveQueryCriteria(); |
| | | leaveCriteria.setWecomSpNo(approvalSend.getApprovalInfo().getSpNo()); |
| | | List<AttendanceLeave> leaveList = attendanceLeaveRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,leaveCriteria,criteriaBuilder), Sort.by(Sort.Direction.DESC, "id")); |
| | | if (leaveList.size() > 0) { |
| | | AttendanceLeave leave = leaveList.get(0); |
| | | leave.setApprovalStatus(switchSpStatusToSysStatus("请假", approvalSend.getApprovalInfo().getSpStatus())); |
| | | leave.setWecomEventId(approveEventSaved.getEventId()); |
| | | try { |
| | | attendanceLeaveService.updateApprove(leave); |
| | | } catch (Exception e) { |
| | | System.out.println("企微状态下发数据对应数据(请假)更新失败:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else { |
| | | System.out.println("企微状态下发数据对应数据(请假)未找到:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else if (fieldList.get(0).getFieldTable().equals("AttendanceGoOut")) { |
| | | // 外出 |
| | | AttendanceGoOutQueryCriteria goOutCriteria = new AttendanceGoOutQueryCriteria(); |
| | | goOutCriteria.setWecomSpNo(approvalSend.getApprovalInfo().getSpNo()); |
| | | List<AttendanceGoOut> goOutList = attendanceGoOutRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,goOutCriteria,criteriaBuilder), Sort.by(Sort.Direction.DESC, "id")); |
| | | if (goOutList.size() > 0) { |
| | | AttendanceGoOut goOut = goOutList.get(0); |
| | | goOut.setApprovalStatus(switchSpStatusToSysStatus("外出", approvalSend.getApprovalInfo().getSpStatus())); |
| | | goOut.setWecomEventId(approveEventSaved.getEventId()); |
| | | try { |
| | | attendanceGoOutService.updateApprove(goOut); |
| | | } catch (Exception e) { |
| | | System.out.println("企微状态下发数据对应数据(外出)更新失败:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else { |
| | | System.out.println("企微状态下发数据对应数据(外出)未找到:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else if (fieldList.get(0).getFieldTable().equals("AttendanceBusinessTravel")) { |
| | | // 出差 |
| | | AttendanceBusinessTravelQueryCriteria businessTravelCriteria = new AttendanceBusinessTravelQueryCriteria(); |
| | | businessTravelCriteria.setWecomSpNo(approvalSend.getApprovalInfo().getSpNo()); |
| | | List<AttendanceBusinessTravel> businessTravelList = attendanceBusinessTravelRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,businessTravelCriteria,criteriaBuilder), Sort.by(Sort.Direction.DESC, "id")); |
| | | if (businessTravelList.size() > 0) { |
| | | AttendanceBusinessTravel businessTravel = businessTravelList.get(0); |
| | | businessTravel.setApprovalStatus(switchSpStatusToSysStatus("出差", approvalSend.getApprovalInfo().getSpStatus())); |
| | | businessTravel.setWecomEventId(approveEventSaved.getEventId()); |
| | | try { |
| | | attendanceBusinessTravelService.updateApprove(businessTravel); |
| | | } catch (Exception e) { |
| | | System.out.println("企微状态下发数据对应数据(出差)更新失败:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else { |
| | | System.out.println("企微状态下发数据对应数据(出差)未找到:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else if (fieldList.get(0).getFieldTable().equals("AttendanceOvertime")) { |
| | | // 换休 |
| | | AttendanceOvertimeQueryCriteria overtimeCriteria = new AttendanceOvertimeQueryCriteria(); |
| | | overtimeCriteria.setWecomSpNo(approvalSend.getApprovalInfo().getSpNo()); |
| | | List<AttendanceOvertime> overtimeList = attendanceOvertimeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,overtimeCriteria,criteriaBuilder), Sort.by(Sort.Direction.DESC, "id")); |
| | | if (overtimeList.size() > 0) { |
| | | AttendanceOvertime overtime = overtimeList.get(0); |
| | | overtime.setApprovalStatus(switchSpStatusToSysStatus("换休", approvalSend.getApprovalInfo().getSpStatus())); |
| | | overtime.setWecomEventId(approveEventSaved.getEventId()); |
| | | try { |
| | | attendanceOvertimeService.updateApprove(overtime); |
| | | } catch (Exception e) { |
| | | System.out.println("企微状态下发数据对应数据(换休)更新失败:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else { |
| | | System.out.println("企微状态下发数据对应数据(换休)未找到:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else if (fieldList.get(0).getFieldTable().equals("AttendanceCardreplacement")) { |
| | | // 补卡 |
| | | AttendanceCardreplacementQueryCriteria cardreplacementCriteria = new AttendanceCardreplacementQueryCriteria(); |
| | | cardreplacementCriteria.setWecomSpNo(approvalSend.getApprovalInfo().getSpNo()); |
| | | List<AttendanceCardreplacement> cardreplacementList = attendanceCardreplacementRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,cardreplacementCriteria,criteriaBuilder), Sort.by(Sort.Direction.DESC, "id")); |
| | | if (cardreplacementList.size() > 0) { |
| | | AttendanceCardreplacement cardreplacement = cardreplacementList.get(0); |
| | | cardreplacement.setApprovalStatus(switchSpStatusToSysStatus("补卡", approvalSend.getApprovalInfo().getSpStatus())); |
| | | cardreplacement.setWecomEventId(approveEventSaved.getEventId()); |
| | | try { |
| | | attendanceCardreplacementService.updateApprove(cardreplacement); |
| | | } catch (Exception e) { |
| | | System.out.println("企微状态下发数据对应数据(补卡)更新失败:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else { |
| | | System.out.println("企微状态下发数据对应数据(补卡)未找到:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else { |
| | | System.out.println("企微状态下发数据对应模板绑定表名未找到:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else { |
| | | System.out.println("企微状态下发数据对应模板绑定数据未找到:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else { |
| | | System.out.println("企微状态下发数据对应模板未找到:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } else { |
| | | System.out.println("企微状态下发数据错误:下发数据ID为" + event.getHistoryId()); |
| | | } |
| | | } |
| | | |
| | | private static String switchSpStatusToSysStatus(String type, Integer spStatus) { |
| | | String finalStatus; |
| | | switch (type + "-" + spStatus) { |
| | | // 审批中 |
| | | case "请假-1": finalStatus = Constant.APPROVAL_STATUS_UNDER_APPROVAL; break; |
| | | // 已通过 |
| | | case "请假-2": finalStatus = Constant.APPROVAL_STATUS_PASSED; break; |
| | | // 已驳回 |
| | | case "请假-3": finalStatus = Constant.APPROVAL_STATUS_RETURNED; break; |
| | | // 已撤销 |
| | | case "请假-4": finalStatus = Constant.APPROVAL_STATUS_RETURNED; break; |
| | | // 通过后撤销 |
| | | case "请假-6": finalStatus = Constant.APPROVAL_STATUS_RETURNED; break; |
| | | // 已删除 |
| | | case "请假-7": finalStatus = Constant.APPROVAL_STATUS_RETURNED; break; |
| | | // 已支付 |
| | | case "请假-10": finalStatus = Constant.APPROVAL_STATUS_UNDER_APPROVAL; break; |
| | | |
| | | // 审批中 |
| | | case "外出-1": finalStatus = Constant.GOOUT_APPROVE_STATUS_REVIEWED; break; |
| | | // 已通过 |
| | | case "外出-2": finalStatus = Constant.GOOUT_APPROVE_STATUS_AGREE; break; |
| | | // 已驳回 |
| | | case "外出-3": finalStatus = Constant.GOOUT_APPROVE_STATUS_REFUSE; break; |
| | | // 已撤销 |
| | | case "外出-4": finalStatus = Constant.GOOUT_APPROVE_STATUS_REFUSE; break; |
| | | // 通过后撤销 |
| | | case "外出-6": finalStatus = Constant.GOOUT_APPROVE_STATUS_REFUSE; break; |
| | | // 已删除 |
| | | case "外出-7": finalStatus = Constant.GOOUT_APPROVE_STATUS_REFUSE; break; |
| | | // 已支付 |
| | | case "外出-10": finalStatus = Constant.GOOUT_APPROVE_STATUS_REVIEWED; break; |
| | | |
| | | // 审批中 |
| | | case "出差-1": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_REVIEWED; break; |
| | | // 已通过 |
| | | case "出差-2": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_AGREE; break; |
| | | // 已驳回 |
| | | case "出差-3": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_REFUSE; break; |
| | | // 已撤销 |
| | | case "出差-4": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_REFUSE; break; |
| | | // 通过后撤销 |
| | | case "出差-6": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_REFUSE; break; |
| | | // 已删除 |
| | | case "出差-7": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_REFUSE; break; |
| | | // 已支付 |
| | | case "出差-10": finalStatus = Constant.BUSSINESS_APPROVE_STATUS_REVIEWED; break; |
| | | |
| | | // 审批中 |
| | | case "换休-1": finalStatus = Constant.OVERTIME_APPROVAL; break; |
| | | // 已通过 |
| | | case "换休-2": finalStatus = Constant.OVERTIME_PASS; break; |
| | | // 已驳回 |
| | | case "换休-3": finalStatus = Constant.OVERTIME_RETURN; break; |
| | | // 已撤销 |
| | | case "换休-4": finalStatus = Constant.OVERTIME_RETURN; break; |
| | | // 通过后撤销 |
| | | case "换休-6": finalStatus = Constant.OVERTIME_RETURN; break; |
| | | // 已删除 |
| | | case "换休-7": finalStatus = Constant.OVERTIME_RETURN; break; |
| | | // 已支付 |
| | | case "换休-10": finalStatus = Constant.OVERTIME_APPROVAL; break; |
| | | |
| | | // 审批中 |
| | | case "补卡-1": finalStatus = Constant.CARD_APPROVE_STATUS_REVIEWED; break; |
| | | // 已通过 |
| | | case "补卡-2": finalStatus = Constant.CARD_APPROVE_STATUS_AGREE; break; |
| | | // 已驳回 |
| | | case "补卡-3": finalStatus = Constant.CARD_APPROVE_STATUS_REFUSE; break; |
| | | // 已撤销 |
| | | case "补卡-4": finalStatus = Constant.CARD_APPROVE_STATUS_REFUSE; break; |
| | | // 通过后撤销 |
| | | case "补卡-6": finalStatus = Constant.CARD_APPROVE_STATUS_REFUSE; break; |
| | | // 已删除 |
| | | case "补卡-7": finalStatus = Constant.CARD_APPROVE_STATUS_REFUSE; break; |
| | | // 已支付 |
| | | case "补卡-10": finalStatus = Constant.CARD_APPROVE_STATUS_REVIEWED; break; |
| | | |
| | | // 默认 |
| | | default: finalStatus = Constant.APPROVAL_STATUS_UNDER_APPROVAL; break; |
| | | } |
| | | return finalStatus; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.repository; |
| | | |
| | | import me.zhengjie.modules.approval.domain.ApproveEvent; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | public interface ApproveEventRepository extends JpaRepository<ApproveEvent, Long>, JpaSpecificationExecutor<ApproveEvent> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.repository; |
| | | |
| | | import me.zhengjie.modules.approval.domain.TemplateControlField; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | public interface TemplateControlFieldRepository extends JpaRepository<TemplateControlField, Long>, JpaSpecificationExecutor<TemplateControlField> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.repository; |
| | | |
| | | import me.zhengjie.modules.approval.domain.TemplateControl; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | public interface TemplateControlRepository extends JpaRepository<TemplateControl, Long>, JpaSpecificationExecutor<TemplateControl> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.repository; |
| | | |
| | | import me.zhengjie.modules.approval.domain.Template; |
| | | import org.springframework.data.jpa.repository.JpaRepository; |
| | | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | public interface TemplateRepository extends JpaRepository<Template, Long>, JpaSpecificationExecutor<Template> { |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.rest; |
| | | |
| | | import me.zhengjie.annotation.AnonymousAccess; |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.approval.domain.ApproveEvent; |
| | | import me.zhengjie.modules.approval.service.ApproveEventService; |
| | | import me.zhengjie.modules.approval.service.dto.ApproveEventQueryCriteria; |
| | | import me.zhengjie.modules.temp.event.ChangeApprovalStatusEvent; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "审批变化记录管理") |
| | | @RequestMapping("/api/approveEvent") |
| | | public class ApproveEventController { |
| | | |
| | | private final ApproveEventService approveEventService; |
| | | private final ApplicationEventPublisher applicationEventPublisher; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('approveEvent:list')") |
| | | public void exportApproveEvent(HttpServletResponse response, ApproveEventQueryCriteria criteria) throws IOException { |
| | | approveEventService.download(approveEventService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询审批变化记录") |
| | | @ApiOperation("查询审批变化记录") |
| | | @PreAuthorize("@el.check('approveEvent:list')") |
| | | public ResponseEntity<Object> queryApproveEvent(ApproveEventQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(approveEventService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增审批变化记录") |
| | | @ApiOperation("新增审批变化记录") |
| | | @PreAuthorize("@el.check('approveEvent:add')") |
| | | public ResponseEntity<Object> createApproveEvent(@Validated @RequestBody ApproveEvent resources){ |
| | | return new ResponseEntity<>(approveEventService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改审批变化记录") |
| | | @ApiOperation("修改审批变化记录") |
| | | @PreAuthorize("@el.check('approveEvent:edit')") |
| | | public ResponseEntity<Object> updateApproveEvent(@Validated @RequestBody ApproveEvent resources){ |
| | | approveEventService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除审批变化记录") |
| | | @ApiOperation("删除审批变化记录") |
| | | @PreAuthorize("@el.check('approveEvent:del')") |
| | | public ResponseEntity<Object> deleteApproveEvent(@RequestBody Long[] ids) { |
| | | approveEventService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @AnonymousAccess |
| | | @GetMapping(value = "/test/{id}") |
| | | public ResponseEntity<Object> test(@PathVariable Long id) { |
| | | ChangeApprovalStatusEvent event = new ChangeApprovalStatusEvent(new Object(), id); |
| | | applicationEventPublisher.publishEvent(event); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.approval.domain.TemplateControl; |
| | | import me.zhengjie.modules.approval.service.TemplateControlService; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "审批模版控件管理") |
| | | @RequestMapping("/api/templateControl") |
| | | public class TemplateControlController { |
| | | |
| | | private final TemplateControlService templateControlService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('templateControl:list')") |
| | | public void exportTemplateControl(HttpServletResponse response, TemplateControlQueryCriteria criteria) throws IOException { |
| | | templateControlService.download(templateControlService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询审批模版控件") |
| | | @ApiOperation("查询审批模版控件") |
| | | @PreAuthorize("@el.check('templateControl:list')") |
| | | public ResponseEntity<Object> queryTemplateControl(TemplateControlQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(templateControlService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增审批模版控件") |
| | | @ApiOperation("新增审批模版控件") |
| | | @PreAuthorize("@el.check('templateControl:add')") |
| | | public ResponseEntity<Object> createTemplateControl(@Validated @RequestBody TemplateControl resources){ |
| | | return new ResponseEntity<>(templateControlService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改审批模版控件") |
| | | @ApiOperation("修改审批模版控件") |
| | | @PreAuthorize("@el.check('templateControl:edit')") |
| | | public ResponseEntity<Object> updateTemplateControl(@Validated @RequestBody TemplateControl resources){ |
| | | templateControlService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除审批模版控件") |
| | | @ApiOperation("删除审批模版控件") |
| | | @PreAuthorize("@el.check('templateControl:del')") |
| | | public ResponseEntity<Object> deleteTemplateControl(@RequestBody Long[] ids) { |
| | | templateControlService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.approval.domain.TemplateControlField; |
| | | import me.zhengjie.modules.approval.service.TemplateControlFieldService; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlFieldQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "审批控件字段绑定管理") |
| | | @RequestMapping("/api/templateControlField") |
| | | public class TemplateControlFieldController { |
| | | |
| | | private final TemplateControlFieldService templateControlFieldService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('templateControlField:list')") |
| | | public void exportTemplateControlField(HttpServletResponse response, TemplateControlFieldQueryCriteria criteria) throws IOException { |
| | | templateControlFieldService.download(templateControlFieldService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询审批控件字段绑定") |
| | | @ApiOperation("查询审批控件字段绑定") |
| | | @PreAuthorize("@el.check('templateControlField:list')") |
| | | public ResponseEntity<Object> queryTemplateControlField(TemplateControlFieldQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(templateControlFieldService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增审批控件字段绑定") |
| | | @ApiOperation("新增审批控件字段绑定") |
| | | @PreAuthorize("@el.check('templateControlField:add')") |
| | | public ResponseEntity<Object> createTemplateControlField(@Validated @RequestBody TemplateControlField resources){ |
| | | return new ResponseEntity<>(templateControlFieldService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改审批控件字段绑定") |
| | | @ApiOperation("修改审批控件字段绑定") |
| | | @PreAuthorize("@el.check('templateControlField:edit')") |
| | | public ResponseEntity<Object> updateTemplateControlField(@Validated @RequestBody TemplateControlField resources){ |
| | | templateControlFieldService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除审批控件字段绑定") |
| | | @ApiOperation("删除审批控件字段绑定") |
| | | @PreAuthorize("@el.check('templateControlField:del')") |
| | | public ResponseEntity<Object> deleteTemplateControlField(@RequestBody Long[] ids) { |
| | | templateControlFieldService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/queryByTable") |
| | | @Log("查询与表单绑定的审批控件字段及相关信息") |
| | | @ApiOperation("查询与表单绑定的审批控件字段及相关信息") |
| | | @PreAuthorize("@el.check('templateControlField:list')") |
| | | public ResponseEntity<Object> queryByTable(TemplateControlFieldQueryCriteria criteria){ |
| | | return new ResponseEntity<>(templateControlFieldService.queryByTable(criteria), HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping(value = "/bind") |
| | | @Log("审批控件与数据表字段绑定") |
| | | @ApiOperation("审批控件与数据表字段绑定") |
| | | @PreAuthorize("@el.check('templateControlField:add')") |
| | | public ResponseEntity<Object> bindTemplateControlField(@Validated @RequestBody List<TemplateControlField> resources){ |
| | | templateControlFieldService.bind(resources); |
| | | return new ResponseEntity<>(HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PostMapping(value = "/editWecomVacationType") |
| | | @Log("更新企微请假类型") |
| | | @ApiOperation("更新企微请假类型") |
| | | @PreAuthorize("@el.check('templateControlField:add')") |
| | | public ResponseEntity<Object> updateWecomVacationType() { |
| | | templateControlFieldService.updateWecomVacationType(); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @GetMapping(value = "/editApprovalSite") |
| | | @Log("更新申请审核站点") |
| | | @ApiOperation("更新申请审核站点") |
| | | public ResponseEntity<Object> updateApprovalSite(@RequestParam String approvalSite) { |
| | | templateControlFieldService.updateApprovalSite(approvalSite); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.rest; |
| | | |
| | | import me.zhengjie.annotation.Log; |
| | | import me.zhengjie.modules.approval.domain.Template; |
| | | import me.zhengjie.modules.approval.service.TemplateService; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import io.swagger.annotations.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @RestController |
| | | @RequiredArgsConstructor |
| | | @Api(tags = "审批模版管理") |
| | | @RequestMapping("/api/template") |
| | | public class TemplateController { |
| | | |
| | | private final TemplateService templateService; |
| | | |
| | | @Log("导出数据") |
| | | @ApiOperation("导出数据") |
| | | @GetMapping(value = "/download") |
| | | @PreAuthorize("@el.check('template:list')") |
| | | public void exportTemplate(HttpServletResponse response, TemplateQueryCriteria criteria) throws IOException { |
| | | templateService.download(templateService.queryAll(criteria), response); |
| | | } |
| | | |
| | | @GetMapping |
| | | @Log("查询审批模版") |
| | | @ApiOperation("查询审批模版") |
| | | @PreAuthorize("@el.check('template:list')") |
| | | public ResponseEntity<Object> queryTemplate(TemplateQueryCriteria criteria, Pageable pageable){ |
| | | return new ResponseEntity<>(templateService.queryAll(criteria,pageable),HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping |
| | | @Log("新增审批模版") |
| | | @ApiOperation("新增审批模版") |
| | | @PreAuthorize("@el.check('template:add')") |
| | | public ResponseEntity<Object> createTemplate(@Validated @RequestBody Template resources){ |
| | | return new ResponseEntity<>(templateService.create(resources),HttpStatus.CREATED); |
| | | } |
| | | |
| | | @PutMapping |
| | | @Log("修改审批模版") |
| | | @ApiOperation("修改审批模版") |
| | | @PreAuthorize("@el.check('template:edit')") |
| | | public ResponseEntity<Object> updateTemplate(@Validated @RequestBody Template resources){ |
| | | templateService.update(resources); |
| | | return new ResponseEntity<>(HttpStatus.NO_CONTENT); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | @Log("删除审批模版") |
| | | @ApiOperation("删除审批模版") |
| | | @PreAuthorize("@el.check('template:del')") |
| | | public ResponseEntity<Object> deleteTemplate(@RequestBody Long[] ids) { |
| | | templateService.deleteAll(ids); |
| | | return new ResponseEntity<>(HttpStatus.OK); |
| | | } |
| | | |
| | | @PostMapping(value = "/queryWeComTemplate") |
| | | @Log("获取企微审批模版信息") |
| | | @ApiOperation("获取企微审批模版信息") |
| | | @PreAuthorize("@el.check('template:add')") |
| | | public ResponseEntity<Object> queryWeComTemplate(@RequestBody TemplateQueryCriteria criteria) throws Exception { |
| | | return new ResponseEntity<>(templateService.queryWeComTemplate(criteria), HttpStatus.OK); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service; |
| | | |
| | | import me.zhengjie.modules.approval.domain.ApproveEvent; |
| | | import me.zhengjie.modules.approval.service.dto.ApproveEventDto; |
| | | import me.zhengjie.modules.approval.service.dto.ApproveEventQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | public interface ApproveEventService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(ApproveEventQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<ApproveEventDto> |
| | | */ |
| | | List<ApproveEventDto> queryAll(ApproveEventQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param eventId ID |
| | | * @return ApproveEventDto |
| | | */ |
| | | ApproveEventDto findById(Long eventId); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return ApproveEventDto |
| | | */ |
| | | ApproveEventDto create(ApproveEvent resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(ApproveEvent resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<ApproveEventDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service; |
| | | |
| | | import me.zhengjie.modules.approval.domain.TemplateControlField; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlFieldDto; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlFieldQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | public interface TemplateControlFieldService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(TemplateControlFieldQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<TemplateControlFieldDto> |
| | | */ |
| | | List<TemplateControlFieldDto> queryAll(TemplateControlFieldQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param controlId ID |
| | | * @return TemplateControlFieldDto |
| | | */ |
| | | TemplateControlFieldDto findById(Long controlId); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return TemplateControlFieldDto |
| | | */ |
| | | TemplateControlFieldDto create(TemplateControlField resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(TemplateControlField resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<TemplateControlFieldDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 查询与表单绑定的审批控件字段及相关信息 |
| | | * @param criteria 条件参数 |
| | | * @return Map<String, Object> |
| | | */ |
| | | Map<String, Object> queryByTable(TemplateControlFieldQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 审批控件与数据表字段绑定 |
| | | * @param all 待绑定的数据 |
| | | */ |
| | | void bind(List<TemplateControlField> all); |
| | | |
| | | /** |
| | | * 更新企微请假类型 |
| | | */ |
| | | void updateWecomVacationType(); |
| | | |
| | | /** |
| | | * 更新申请审核站点 |
| | | */ |
| | | void updateApprovalSite(String approvalSite); |
| | | |
| | | /** |
| | | * 提交微信审批 |
| | | */ |
| | | <R> Map<String, String> createWecomApproval(R data, String userWxId); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service; |
| | | |
| | | import me.zhengjie.modules.approval.domain.TemplateControl; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlDto; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | public interface TemplateControlService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(TemplateControlQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<TemplateControlDto> |
| | | */ |
| | | List<TemplateControlDto> queryAll(TemplateControlQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return TemplateControlDto |
| | | */ |
| | | TemplateControlDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return TemplateControlDto |
| | | */ |
| | | TemplateControlDto create(TemplateControl resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(TemplateControl resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<TemplateControlDto> all, HttpServletResponse response) throws IOException; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service; |
| | | |
| | | import me.zhengjie.modules.approval.domain.Template; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateDto; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateQueryCriteria; |
| | | import org.springframework.data.domain.Pageable; |
| | | import java.util.Map; |
| | | import java.util.List; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务接口 |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | public interface TemplateService { |
| | | |
| | | /** |
| | | * 查询数据分页 |
| | | * @param criteria 条件 |
| | | * @param pageable 分页参数 |
| | | * @return Map<String,Object> |
| | | */ |
| | | Map<String,Object> queryAll(TemplateQueryCriteria criteria, Pageable pageable); |
| | | |
| | | /** |
| | | * 查询所有数据不分页 |
| | | * @param criteria 条件参数 |
| | | * @return List<TemplateDto> |
| | | */ |
| | | List<TemplateDto> queryAll(TemplateQueryCriteria criteria); |
| | | |
| | | /** |
| | | * 根据ID查询 |
| | | * @param id ID |
| | | * @return TemplateDto |
| | | */ |
| | | TemplateDto findById(Long id); |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param resources / |
| | | * @return TemplateDto |
| | | */ |
| | | TemplateDto create(Template resources); |
| | | |
| | | /** |
| | | * 编辑 |
| | | * @param resources / |
| | | */ |
| | | void update(Template resources); |
| | | |
| | | /** |
| | | * 多选删除 |
| | | * @param ids / |
| | | */ |
| | | void deleteAll(Long[] ids); |
| | | |
| | | /** |
| | | * 导出数据 |
| | | * @param all 待导出的数据 |
| | | * @param response / |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<TemplateDto> all, HttpServletResponse response) throws IOException; |
| | | |
| | | /** |
| | | * 创建 |
| | | * @param criteria 条件 |
| | | * @return TemplateDto |
| | | */ |
| | | TemplateDto queryWeComTemplate(TemplateQueryCriteria criteria) throws Exception; |
| | | |
| | | /** |
| | | * 获取请假类型对应KEY |
| | | */ |
| | | String getVacationKey(String type); |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | import com.alibaba.fastjson.annotation.JSONField; |
| | | import com.alibaba.fastjson.serializer.ToStringSerializer; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Data |
| | | public class ApproveEventDto extends BaseDTO implements Serializable { |
| | | |
| | | /** 事件ID */ |
| | | /** 防止精度丢失 */ |
| | | @JSONField(serializeUsing = ToStringSerializer.class) |
| | | private Long eventId; |
| | | |
| | | /** 审批编号 */ |
| | | private String spNo; |
| | | |
| | | /** 审批申请类型名称(审批模板名称) */ |
| | | private String spName; |
| | | |
| | | /** 申请单状态 */ |
| | | private String spStatus; |
| | | |
| | | /** 审批模板id */ |
| | | private String templateId; |
| | | |
| | | /** 审批申请提交时间 */ |
| | | private Timestamp applyTime; |
| | | |
| | | /** 申请人所在部门pid */ |
| | | private String applyerParty; |
| | | |
| | | /** 申请人userid */ |
| | | private String applyerUserId; |
| | | |
| | | /** 审批流程信息 */ |
| | | private String spRecord; |
| | | |
| | | /** 抄送信息 */ |
| | | private String notifyer; |
| | | |
| | | /** 审批申请备注信息 */ |
| | | private String comments; |
| | | |
| | | /** 审批流程列表 */ |
| | | private String processList; |
| | | |
| | | /** 审批申请状态变化类型 */ |
| | | private String statusChangeEvent; |
| | | |
| | | /** 创建时间 */ |
| | | private Timestamp createTime; |
| | | |
| | | /** 创建人 */ |
| | | private String createBy; |
| | | |
| | | /** 更新时间 */ |
| | | private Timestamp updateTime; |
| | | |
| | | /** 更新人 */ |
| | | private String updateBy; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Data |
| | | public class ApproveEventQueryCriteria{ |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Data |
| | | public class TemplateControlDto extends BaseDTO implements Serializable { |
| | | |
| | | /** 主键ID */ |
| | | private Long id; |
| | | |
| | | /** 模版ID */ |
| | | private Long templateId; |
| | | |
| | | /** 控件类型 */ |
| | | private String controlType; |
| | | |
| | | /** 控件ID */ |
| | | private String controlId; |
| | | |
| | | /** 控件参数 */ |
| | | private String controlParam; |
| | | |
| | | /** 控件参数名称 */ |
| | | private String controlParamName; |
| | | |
| | | /** 占位符文本(中文) */ |
| | | private String placeholderTextZh; |
| | | |
| | | /** 占位符文本(英文) */ |
| | | private String placeholderTextEn; |
| | | |
| | | /** 是否必填 */ |
| | | private Integer contentRequire; |
| | | |
| | | /** 是否参与打印 */ |
| | | private Integer contentPrint; |
| | | |
| | | /** 控件设定 */ |
| | | private String contentConfig; |
| | | |
| | | /** 删除判定 */ |
| | | private String delStatus; |
| | | |
| | | /** 创建时间 */ |
| | | private Timestamp createTime; |
| | | |
| | | /** 创建人 */ |
| | | private String createBy; |
| | | |
| | | /** 更新时间 */ |
| | | private Timestamp updateTime; |
| | | |
| | | /** 更新人 */ |
| | | private String updateBy; |
| | | |
| | | /** 标题文本(中文) */ |
| | | private String titleTextZh; |
| | | |
| | | /** 标题文本(英文) */ |
| | | private String titleTextEn; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Data |
| | | public class TemplateControlFieldDto extends BaseDTO implements Serializable { |
| | | |
| | | /** 主键ID */ |
| | | private Long id; |
| | | |
| | | /** 模板ID */ |
| | | private Long templateId; |
| | | |
| | | /** 控件ID */ |
| | | private Long controlId; |
| | | |
| | | /** 字段表名 */ |
| | | private String fieldTable; |
| | | |
| | | /** 字段名称 */ |
| | | private String fieldName; |
| | | |
| | | /** 删除判定 */ |
| | | private String delStatus; |
| | | |
| | | /** 创建时间 */ |
| | | private Timestamp createTime; |
| | | |
| | | /** 创建人 */ |
| | | private String createBy; |
| | | |
| | | /** 更新时间 */ |
| | | private Timestamp updateTime; |
| | | |
| | | /** 更新人 */ |
| | | private String updateBy; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.annotation.Query; |
| | | import me.zhengjie.utils.ElAdminConstant; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Data |
| | | public class TemplateControlFieldQueryCriteria{ |
| | | |
| | | @Query(type = Query.Type.EQUAL) |
| | | private Long templateId; |
| | | |
| | | @Query(type = Query.Type.EQUAL) |
| | | private String fieldTable; |
| | | |
| | | @Query(type = Query.Type.EQUAL) |
| | | private String delStatus = ElAdminConstant.Constant.TEMPLATE_DEL_STATUS_NORMAL; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Data |
| | | public class TemplateControlQueryCriteria{ |
| | | |
| | | @Query(type = Query.Type.EQUAL) |
| | | private Long templateId; |
| | | |
| | | @Query(type = Query.Type.EQUAL) |
| | | private String delStatus; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | |
| | | import java.io.Serializable; |
| | | import java.sql.Timestamp; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description / |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Data |
| | | public class TemplateDto extends BaseDTO implements Serializable { |
| | | |
| | | /** 主键ID */ |
| | | private Long id; |
| | | |
| | | /** 模版ID(企微内) */ |
| | | private String templateId; |
| | | |
| | | /** 删除判定 */ |
| | | private String delStatus; |
| | | |
| | | /** 创建时间 */ |
| | | private Timestamp createTime; |
| | | |
| | | /** 创建人 */ |
| | | private String createBy; |
| | | |
| | | /** 更新时间 */ |
| | | private Timestamp updateTime; |
| | | |
| | | /** 更新人 */ |
| | | private String updateBy; |
| | | |
| | | /** 模板名称(中文) */ |
| | | private String templateNameZh; |
| | | |
| | | /** 模板名称(英文) */ |
| | | private String templateNameEn; |
| | | |
| | | /** 审批模版控件列表 */ |
| | | private List<TemplateControlDto> templateControls; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.dto; |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.annotation.Query; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Data |
| | | public class TemplateQueryCriteria{ |
| | | |
| | | /** 模版ID(企微内) */ |
| | | @Query |
| | | private String templateId; |
| | | |
| | | /** 删除判定 */ |
| | | @Query |
| | | private String delStatus; |
| | | |
| | | private Boolean queryNew = true; |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.impl; |
| | | |
| | | import me.zhengjie.modules.approval.domain.ApproveEvent; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.approval.repository.ApproveEventRepository; |
| | | import me.zhengjie.modules.approval.service.ApproveEventService; |
| | | import me.zhengjie.modules.approval.service.dto.ApproveEventDto; |
| | | import me.zhengjie.modules.approval.service.dto.ApproveEventQueryCriteria; |
| | | import me.zhengjie.modules.approval.service.mapstruct.ApproveEventMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import cn.hutool.core.lang.Snowflake; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ApproveEventServiceImpl implements ApproveEventService { |
| | | |
| | | private final ApproveEventRepository approveEventRepository; |
| | | private final ApproveEventMapper approveEventMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(ApproveEventQueryCriteria criteria, Pageable pageable){ |
| | | Page<ApproveEvent> page = approveEventRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(approveEventMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<ApproveEventDto> queryAll(ApproveEventQueryCriteria criteria){ |
| | | return approveEventMapper.toDto(approveEventRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public ApproveEventDto findById(Long eventId) { |
| | | ApproveEvent approveEvent = approveEventRepository.findById(eventId).orElseGet(ApproveEvent::new); |
| | | ValidationUtil.isNull(approveEvent.getEventId(),"ApproveEvent","eventId",eventId); |
| | | return approveEventMapper.toDto(approveEvent); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ApproveEventDto create(ApproveEvent resources) { |
| | | Snowflake snowflake = IdUtil.createSnowflake(1, 1); |
| | | resources.setEventId(snowflake.nextId()); |
| | | return approveEventMapper.toDto(approveEventRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(ApproveEvent resources) { |
| | | ApproveEvent approveEvent = approveEventRepository.findById(resources.getEventId()).orElseGet(ApproveEvent::new); |
| | | ValidationUtil.isNull( approveEvent.getEventId(),"ApproveEvent","id",resources.getEventId()); |
| | | approveEvent.copy(resources); |
| | | approveEventRepository.save(approveEvent); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long eventId : ids) { |
| | | approveEventRepository.deleteById(eventId); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<ApproveEventDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (ApproveEventDto approveEvent : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("审批编号", approveEvent.getSpNo()); |
| | | map.put("审批申请类型名称(审批模板名称)", approveEvent.getSpName()); |
| | | map.put("申请单状态", approveEvent.getSpStatus()); |
| | | map.put("审批模板id", approveEvent.getTemplateId()); |
| | | map.put("审批申请提交时间", approveEvent.getApplyTime()); |
| | | map.put("申请人所在部门pid", approveEvent.getApplyerParty()); |
| | | map.put("申请人userid", approveEvent.getApplyerUserId()); |
| | | map.put("审批流程信息", approveEvent.getSpRecord()); |
| | | map.put("抄送信息", approveEvent.getNotifyer()); |
| | | map.put("审批申请备注信息", approveEvent.getComments()); |
| | | map.put("审批流程列表", approveEvent.getProcessList()); |
| | | map.put("审批申请状态变化类型", approveEvent.getStatusChangeEvent()); |
| | | map.put("创建时间", approveEvent.getCreateTime()); |
| | | map.put("创建人", approveEvent.getCreateBy()); |
| | | map.put("更新时间", approveEvent.getUpdateTime()); |
| | | map.put("更新人", approveEvent.getUpdateBy()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import me.chanjar.weixin.common.error.WxErrorException; |
| | | import me.chanjar.weixin.cp.api.WxCpService; |
| | | import me.chanjar.weixin.cp.bean.oa.WxCpCorpConfInfo; |
| | | import me.chanjar.weixin.cp.bean.oa.WxCpOaApplyEventRequest; |
| | | import me.chanjar.weixin.cp.bean.oa.WxCpOaApprovalTemplateResult; |
| | | import me.chanjar.weixin.cp.bean.oa.applydata.ApplyDataContent; |
| | | import me.chanjar.weixin.cp.bean.oa.applydata.ContentValue; |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.approval.domain.Template; |
| | | import me.zhengjie.modules.approval.domain.TemplateControl; |
| | | import me.zhengjie.modules.approval.domain.TemplateControlField; |
| | | import me.zhengjie.modules.approval.repository.TemplateControlRepository; |
| | | import me.zhengjie.modules.approval.repository.TemplateRepository; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlQueryCriteria; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateDto; |
| | | import me.zhengjie.modules.approval.service.mapstruct.TemplateControlMapper; |
| | | import me.zhengjie.modules.approval.service.mapstruct.TemplateMapper; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.system.domain.Dict; |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import me.zhengjie.modules.system.repository.DictRepository; |
| | | import me.zhengjie.modules.system.service.DictDetailService; |
| | | import me.zhengjie.modules.system.service.DictService; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.approval.repository.TemplateControlFieldRepository; |
| | | import me.zhengjie.modules.approval.service.TemplateControlFieldService; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlFieldDto; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlFieldQueryCriteria; |
| | | import me.zhengjie.modules.approval.service.mapstruct.TemplateControlFieldMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | | import java.sql.Timestamp; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class TemplateControlFieldServiceImpl implements TemplateControlFieldService { |
| | | |
| | | private final TemplateControlFieldRepository templateControlFieldRepository; |
| | | private final TemplateRepository templateRepository; |
| | | private final TemplateControlRepository templateControlRepository; |
| | | private final TemplateControlFieldMapper templateControlFieldMapper; |
| | | private final TemplateMapper templateMapper; |
| | | private final TemplateControlMapper templateControlMapper; |
| | | private final WxCpService wxCpService; |
| | | private final DictService dictService; |
| | | private final DictRepository dictRepository; |
| | | private final DictDetailService dictDetailService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(TemplateControlFieldQueryCriteria criteria, Pageable pageable){ |
| | | Page<TemplateControlField> page = templateControlFieldRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(templateControlFieldMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<TemplateControlFieldDto> queryAll(TemplateControlFieldQueryCriteria criteria){ |
| | | return templateControlFieldMapper.toDto(templateControlFieldRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public TemplateControlFieldDto findById(Long id) { |
| | | TemplateControlField templateControlField = templateControlFieldRepository.findById(id).orElseGet(TemplateControlField::new); |
| | | ValidationUtil.isNull(templateControlField.getId(),"TemplateControlField","id", id); |
| | | return templateControlFieldMapper.toDto(templateControlField); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public TemplateControlFieldDto create(TemplateControlField resources) { |
| | | return templateControlFieldMapper.toDto(templateControlFieldRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(TemplateControlField resources) { |
| | | TemplateControlField templateControlField = templateControlFieldRepository.findById(resources.getId()).orElseGet(TemplateControlField::new); |
| | | ValidationUtil.isNull(templateControlField.getId(),"TemplateControlField","id", resources.getId()); |
| | | templateControlField.copy(resources); |
| | | templateControlFieldRepository.save(templateControlField); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | templateControlFieldRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<TemplateControlFieldDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (TemplateControlFieldDto templateControlField : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("控件ID", templateControlField.getControlId()); |
| | | map.put("字段表名", templateControlField.getFieldTable()); |
| | | map.put("字段名称", templateControlField.getFieldName()); |
| | | map.put("删除判定", templateControlField.getDelStatus()); |
| | | map.put("创建时间", templateControlField.getCreateTime()); |
| | | map.put("创建人", templateControlField.getCreateBy()); |
| | | map.put("更新时间", templateControlField.getUpdateTime()); |
| | | map.put("更新人", templateControlField.getUpdateBy()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> queryByTable(TemplateControlFieldQueryCriteria criteria) { |
| | | Map<String, Object> resultMap = new HashMap<>(2); |
| | | |
| | | if (StringUtils.isNotBlank(criteria.getFieldTable())) { |
| | | // 获取审批控件字段绑定信息 |
| | | List<TemplateControlField> templateControlFields = templateControlFieldRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); |
| | | |
| | | if (templateControlFields.size() > 0) { |
| | | // 已绑定 |
| | | // 获取审批模版信息 |
| | | Template template = templateRepository.findById(templateControlFields.get(0).getTemplateId()).orElseGet(Template::new); |
| | | if (template.getId() != null) { |
| | | // 获取审批模板控件信息 |
| | | TemplateControlQueryCriteria controlCriteria = new TemplateControlQueryCriteria(); |
| | | controlCriteria.setTemplateId(template.getId()); |
| | | List<TemplateControl> templateControls = templateControlRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,controlCriteria,criteriaBuilder)); |
| | | TemplateDto templateDto = templateMapper.toDto(template); |
| | | templateDto.setTemplateControls(templateControlMapper.toDto(templateControls)); |
| | | |
| | | resultMap.put("template", templateDto); |
| | | } |
| | | } |
| | | resultMap.put("templateControlField", templateControlFieldMapper.toDto(templateControlFields)); |
| | | } |
| | | |
| | | return resultMap; |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void bind(List<TemplateControlField> all) { |
| | | TemplateControlFieldQueryCriteria criteria = new TemplateControlFieldQueryCriteria(); |
| | | criteria.setFieldTable(all.get(0).getFieldTable()); |
| | | criteria.setDelStatus(ElAdminConstant.Constant.TEMPLATE_DEL_STATUS_NORMAL); |
| | | List<TemplateControlField> oldRecordList = templateControlFieldRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); |
| | | // 删除旧记录(根据表名区分) |
| | | for (TemplateControlField oldRecord : oldRecordList) { |
| | | oldRecord.setDelStatus(ElAdminConstant.Constant.TEMPLATE_DEL_STATUS_DEL); |
| | | } |
| | | templateControlFieldRepository.saveAll(oldRecordList); |
| | | |
| | | // 保存新记录 |
| | | for (TemplateControlField newRecord : all) { |
| | | newRecord.setId(null); |
| | | newRecord.setDelStatus(ElAdminConstant.Constant.TEMPLATE_DEL_STATUS_NORMAL); |
| | | } |
| | | templateControlFieldRepository.saveAll(all); |
| | | } |
| | | |
| | | @Override |
| | | public void updateWecomVacationType() { |
| | | try { |
| | | // 获取字典信息 |
| | | Dict dict = dictRepository.findByName(Constant.WECOM_LEAVE_TYPE); |
| | | |
| | | // 获取企业微信Token |
| | | wxCpService.getAccessToken(); |
| | | // 假勤组件需要获取假期相关配置 |
| | | WxCpCorpConfInfo corpConfInfo = wxCpService.getOaService().getCorpConf(); |
| | | List<DictDetail> newDictDetails = corpConfInfo.getLists().stream().map(m -> { |
| | | DictDetail dictDetail = new DictDetail(); |
| | | dictDetail.setLabel(m.getName()); |
| | | dictDetail.setValue(m.getId().toString()); |
| | | dictDetail.setDictSort(1); |
| | | return dictDetail; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | // 删除旧记录 |
| | | dictService.delete(Collections.singleton(dict.getId())); |
| | | Dict newDict = new Dict(); |
| | | newDict.setName(Constant.WECOM_LEAVE_TYPE); |
| | | newDict.setDescription(Constant.WECOM_LEAVE_TYPE_DESCRIPTION); |
| | | Dict savedDict = dictRepository.save(newDict); |
| | | |
| | | // 保存新纪录 |
| | | for (DictDetail dictDetail : newDictDetails) { |
| | | dictDetail.setDict(savedDict); |
| | | dictDetailService.create(dictDetail); |
| | | } |
| | | } catch (WxErrorException wxErrorException) { |
| | | wxErrorException.printStackTrace(); |
| | | throw new BadRequestException("数据更新异常"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateApprovalSite(String approvalSite) { |
| | | // 获取字典信息 |
| | | Dict dict = dictRepository.findByName(Constant.APPROVAL_SITE_TYPE); |
| | | |
| | | if (dict.getDictDetails().size() > 0) { |
| | | // 更新记录 |
| | | for (DictDetail dictDetail : dict.getDictDetails()) { |
| | | dictDetail.setValue(approvalSite); |
| | | dictDetailService.update(dictDetail); |
| | | } |
| | | } else { |
| | | // 新建记录 |
| | | DictDetail dictDetail = new DictDetail(); |
| | | dictDetail.setLabel("站点"); |
| | | dictDetail.setValue(approvalSite); |
| | | dictDetail.setDictSort(1); |
| | | dictDetail.setDict(dict); |
| | | dictDetailService.create(dictDetail); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public <R> Map<String, String> createWecomApproval(R data, String userWxId) { |
| | | TemplateControlFieldQueryCriteria criteria = new TemplateControlFieldQueryCriteria(); |
| | | criteria.setFieldTable(data.getClass().getSimpleName()); |
| | | criteria.setDelStatus(ElAdminConstant.Constant.TEMPLATE_DEL_STATUS_NORMAL); |
| | | List<TemplateControlField> templateControlFields = templateControlFieldRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)); |
| | | return this.sendApplyevent(data, templateControlFields, userWxId); |
| | | } |
| | | |
| | | private <R> Map<String, String> sendApplyevent(R data, List<TemplateControlField> bindData, String userWxId) { |
| | | Map<String, String> resultMap = new HashMap<>(2); |
| | | |
| | | try { |
| | | // 校验申请人企微ID |
| | | if (StringUtils.isBlank(userWxId)) { |
| | | resultMap.put("error", "申请人企微ID不能为空"); |
| | | return resultMap; |
| | | } |
| | | // 验证绑定数据 |
| | | if (bindData.size() <= 0) { |
| | | resultMap.put("error", "数据模版未绑定"); |
| | | return resultMap; |
| | | } |
| | | // 验证Class名称 |
| | | if (!data.getClass().getSimpleName().equals(bindData.get(0).getFieldTable())) { |
| | | resultMap.put("error", "数据源名称不符:" + bindData.get(0).getFieldTable()); |
| | | return resultMap; |
| | | } |
| | | // 验证Class字段 |
| | | List<Field> fields = QueryHelp.getAllFields(data.getClass(), new ArrayList<>()); |
| | | List<String> fieldNames = fields.stream().map(i -> i.getName()).collect(Collectors.toList()); |
| | | List<TemplateControlField> nonExistList = bindData.stream().filter(i -> StringUtils.isNotBlank(i.getFieldName()) && !fieldNames.contains(i.getFieldName())).collect(Collectors.toList()); |
| | | if (nonExistList.size() > 0) { |
| | | resultMap.put("error", "数据源字段名称不存在:" + nonExistList.stream().map(i -> i.getFieldTable().concat("(").concat(i.getFieldName()).concat(")")).collect(Collectors.joining(","))); |
| | | return resultMap; |
| | | } |
| | | |
| | | // 获取模版信息 |
| | | Template template = templateRepository.findById(bindData.get(0).getTemplateId()).orElseGet(Template::new); |
| | | if (template.getId().equals(null)) { |
| | | resultMap.put("error", "模版数据不存在"); |
| | | return resultMap; |
| | | } |
| | | // 获取模版控件信息 |
| | | TemplateControlQueryCriteria controlCriteria = new TemplateControlQueryCriteria(); |
| | | controlCriteria.setTemplateId(template.getId()); |
| | | List<TemplateControl> templateControls = templateControlRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,controlCriteria,criteriaBuilder)); |
| | | // 制作控件Map |
| | | Map<Long, TemplateControl> templateControlsMap = templateControls.stream().collect(Collectors.toMap(TemplateControl::getId, i -> i)); |
| | | // 制作源数据成员Map |
| | | Map<String, Field> fieldMap = fields.stream().collect(Collectors.toMap(Field::getName, i -> i)); |
| | | |
| | | WxCpOaApplyEventRequest.ApplyData applyData = new WxCpOaApplyEventRequest.ApplyData(); |
| | | |
| | | for (TemplateControlField controlField : bindData) { |
| | | TemplateControl control = templateControlsMap.get(controlField.getControlId()); |
| | | if (StringUtils.isNotBlank(controlField.getFieldName()) || control.getContentRequire().equals(1)) { |
| | | // 获取申请结构信息 |
| | | ApplyDataContent applyDataContent = Optional.ofNullable(applyData.getContents()).flatMap(i -> i.stream().filter(f -> f.getControl().equals(control.getControlType()) && f.getId().equals(control.getControlId())).findFirst()).orElse(new ApplyDataContent()); |
| | | applyDataContent.setControl(control.getControlType()); |
| | | applyDataContent.setId(control.getControlId()); |
| | | ContentValue value = Optional.ofNullable(applyDataContent.getValue()).orElse(new ContentValue()); |
| | | // 获取数据值 |
| | | Field field = fieldMap.get(controlField.getFieldName()); |
| | | boolean accessible = field.isAccessible(); |
| | | // 设置对象的访问权限,保证对private的属性的访 |
| | | field.setAccessible(true); |
| | | Object object = Optional.ofNullable(field.get(data)).orElse("未填写"); |
| | | |
| | | if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_TEXT)) { |
| | | // 文本 |
| | | if (field.getType().equals(String.class) || field.getType().equals(Integer.class) || field.getType().equals(Long.class)) { |
| | | value.setText(String.valueOf(object)); |
| | | } else if (field.getType().equals(Timestamp.class)) { |
| | | value.setText(String.valueOf(object)); |
| | | } |
| | | value.setText(String.valueOf(object)); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_TEXTAREA)) { |
| | | // 多行文本 |
| | | if (field.getType().equals(String.class) || field.getType().equals(Integer.class) || field.getType().equals(Long.class)) { |
| | | value.setText(String.valueOf(object)); |
| | | } else if (field.getType().equals(Timestamp.class)) { |
| | | value.setText(String.valueOf(object)); |
| | | } |
| | | value.setText(String.valueOf(object)); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_NUMBER)) { |
| | | // 数字 |
| | | if (field.getType().equals(String.class) || field.getType().equals(Integer.class) || field.getType().equals(Long.class)) { |
| | | value.setNewNumber(String.valueOf(object)); |
| | | } else if (field.getType().equals(Timestamp.class)) { |
| | | value.setNewNumber(String.valueOf(object)); |
| | | } |
| | | value.setNewNumber(String.valueOf(object)); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_MONEY)) { |
| | | // 金额 |
| | | value.setNewMoney(String.valueOf(object)); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_DATE)) { |
| | | // 日期/日期+时间 |
| | | ContentValue.Date date = Optional.ofNullable(value.getDate()).orElse(new ContentValue.Date()); |
| | | |
| | | if (control.getControlParam().equals("date.type")) { |
| | | date.setType(String.valueOf(object)); |
| | | } else if (control.getControlParam().equals("date.s_timestamp")) { |
| | | if (field.getType().equals(String.class) || field.getType().equals(Integer.class) || field.getType().equals(Long.class)) { |
| | | date.setTimestamp(String.valueOf(object)); |
| | | } else if (field.getType().equals(Timestamp.class)) { |
| | | Timestamp time = (Timestamp) object; |
| | | date.setTimestamp(String.valueOf(time.getTime() / 1000)); |
| | | } |
| | | } |
| | | value.setDate(date); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_SELECTOR)) { |
| | | // 单选/多选 TODO:暂时设定只支持单选 |
| | | ContentValue.Selector selector = Optional.ofNullable(value.getSelector()).orElse(new ContentValue.Selector()); |
| | | |
| | | if (control.getControlParam().equals("selector.options[].key")) { |
| | | if (StringUtils.isNotBlank(control.getContentConfig())) { |
| | | // 根据config设定填写key值 |
| | | WxCpOaApprovalTemplateResult.TemplateConfig config = JSONObject.parseObject(control.getContentConfig(), WxCpOaApprovalTemplateResult.TemplateConfig.class); |
| | | Map<String, String> optionMap = config.getSelector().getOptions().stream() |
| | | .flatMap(opt -> opt.getValue().stream().map(val -> new AbstractMap.SimpleEntry<>(val.getText(), opt.getKey()))) |
| | | .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (existing, replacement) -> existing)); |
| | | |
| | | selector.setType("single"); |
| | | ContentValue.Selector.Option option = new ContentValue.Selector.Option(); |
| | | option.setKey(optionMap.containsKey(String.valueOf(object)) ? optionMap.get(String.valueOf(object)) : String.valueOf(object)); |
| | | selector.setOptions(Arrays.asList(option)); |
| | | } else { |
| | | selector.setType("single"); |
| | | ContentValue.Selector.Option option = new ContentValue.Selector.Option(); |
| | | option.setKey(String.valueOf(object)); |
| | | selector.setOptions(Arrays.asList(option)); |
| | | } |
| | | } |
| | | value.setSelector(selector); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_CONTACT)) { |
| | | // 成员控件 TODO:1、与部门控件类型相同,如何区分待验证。2、暂时设定只支持一条。 |
| | | ContentValue.Member member = Optional.ofNullable(value.getMembers()).map(i -> i.get(0)).orElse(new ContentValue.Member()); |
| | | |
| | | if (control.getControlParam().equals("members[].userid")) { |
| | | member.setUserId(String.valueOf(object)); |
| | | } else if (control.getControlParam().equals("members[].name")) { |
| | | member.setName(String.valueOf(object)); |
| | | } |
| | | value.setMembers(Arrays.asList(member)); |
| | | |
| | | // 部门控件 TODO:1、与成员控件类型相同,如何区分待验证。2、暂时设定只支持一条。 |
| | | ContentValue.Department department = Optional.ofNullable(value.getDepartments()).map(i -> i.get(0)).orElse(new ContentValue.Department()); |
| | | |
| | | if (control.getControlParam().equals("departments[].openapi_id")) { |
| | | department.setOpenApiId(String.valueOf(object)); |
| | | } else if (control.getControlParam().equals("departments[].name")) { |
| | | department.setName(String.valueOf(object)); |
| | | } |
| | | value.setDepartments(Arrays.asList(department)); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_FILE)) { |
| | | // 附件 TODO:暂时设定只支持一条。 |
| | | ContentValue.File file = Optional.ofNullable(value.getFiles()).map(i -> i.get(0)).orElse(new ContentValue.File()); |
| | | |
| | | if (control.getControlParam().equals("files[].file_id")) { |
| | | file.setFileId(String.valueOf(object)); |
| | | } else if (control.getControlParam().equals("files[].file_name")) { |
| | | file.setFileName(String.valueOf(object)); |
| | | } else if (control.getControlParam().equals("files[].file_url")) { |
| | | file.setFileUrl(String.valueOf(object)); |
| | | } |
| | | value.setFiles(Arrays.asList(file)); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_TABLE)) { |
| | | // 明细 TODO:因结构复杂,暂时设定不提供支持 |
| | | value.setChildren(null); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_LOCATION)) { |
| | | // 位置 |
| | | ContentValue.Location location = Optional.ofNullable(value.getLocation()).orElse(new ContentValue.Location()); |
| | | |
| | | if (control.getControlParam().equals("location.latitude")) { |
| | | location.setLatitude(new BigDecimal(String.valueOf(object))); |
| | | } else if (control.getControlParam().equals("location.longitude")) { |
| | | location.setLongitude(new BigDecimal(String.valueOf(object))); |
| | | } else if (control.getControlParam().equals("location.title")) { |
| | | location.setTitle(String.valueOf(object)); |
| | | } else if (control.getControlParam().equals("location.address")) { |
| | | location.setAddress(String.valueOf(object)); |
| | | } else if (control.getControlParam().equals("location.time")) { |
| | | if (field.getType().equals(String.class) || field.getType().equals(Integer.class) || field.getType().equals(Long.class)) { |
| | | location.setTime(Long.valueOf(String.valueOf(object))); |
| | | } else if (field.getType().equals(Timestamp.class)) { |
| | | Timestamp time = (Timestamp) object; |
| | | location.setTime(time.getTime() / 1000); |
| | | } else { |
| | | location.setTime((Long.valueOf(String.valueOf(object)))); |
| | | } |
| | | } |
| | | value.setLocation(location); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_RELATEDAPPROVAL)) { |
| | | // 关联审批单 TODO:按照文档暂时仅支持审批单绑定,但RelatedApproval貌似不止仅支持该功能 |
| | | ContentValue.RelatedApproval relatedApproval = Optional.ofNullable(value.getRelatedApproval()).map(i -> i.get(0)).orElse(new ContentValue.RelatedApproval()); |
| | | |
| | | if (control.getControlParam().equals("related_approval[].sp_no")) { |
| | | relatedApproval.setSpNo(String.valueOf(object)); |
| | | } |
| | | value.setRelatedApproval(Arrays.asList(relatedApproval)); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_FORMULA)) { |
| | | // 公式 |
| | | ContentValue.Formula formula = new ContentValue.Formula(); |
| | | formula.setValue(String.valueOf(object)); |
| | | value.setFormula(formula); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_DATERANGE)) { |
| | | // 时长 |
| | | ContentValue.Attendance.DataRange dateRange = Optional.ofNullable(value.getDateRange()).orElse(new ContentValue.Attendance.DataRange()); |
| | | |
| | | if (control.getControlParam().equals("date_range.type")) { |
| | | dateRange.setType(String.valueOf(object)); |
| | | } else if (control.getControlParam().equals("date_range.new_begin")) { |
| | | if (field.getType().equals(String.class) || field.getType().equals(Integer.class) || field.getType().equals(Long.class)) { |
| | | dateRange.setBegin(Long.parseLong(String.valueOf(object))); |
| | | } else if (field.getType().equals(Timestamp.class)) { |
| | | Timestamp time = (Timestamp) object; |
| | | dateRange.setBegin(Long.valueOf(time.getTime() / 1000)); |
| | | } |
| | | } else if (control.getControlParam().equals("date_range.new_end")) { |
| | | if (field.getType().equals(String.class) || field.getType().equals(Integer.class) || field.getType().equals(Long.class)) { |
| | | dateRange.setBegin(Long.parseLong(String.valueOf(object))); |
| | | } else if (field.getType().equals(Timestamp.class)) { |
| | | Timestamp time = (Timestamp) object; |
| | | dateRange.setBegin(Long.valueOf(time.getTime() / 1000)); |
| | | } |
| | | } else if (control.getControlParam().equals("date_range.new_duration")) { |
| | | if (field.getType().equals(String.class) || field.getType().equals(Integer.class) || field.getType().equals(Long.class)) { |
| | | dateRange.setDuration(Long.parseLong(String.valueOf(object))); |
| | | } else { |
| | | dateRange.setDuration(Long.parseLong(String.valueOf(object))); |
| | | } |
| | | } |
| | | |
| | | value.setDateRange(dateRange); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_VACATION)) { |
| | | // 假勤组件-请假组件 |
| | | ContentValue.Vacation vacation = Optional.ofNullable(value.getVacation()).orElse(new ContentValue.Vacation()); |
| | | |
| | | if (control.getControlParam().equals("vacation.selector.options[].key")) { |
| | | ContentValue.Selector selector = Optional.ofNullable(vacation.getSelector()).orElse(new ContentValue.Selector()); |
| | | // 假勤组件固定单选 |
| | | selector.setType("single"); |
| | | ContentValue.Selector.Option option = new ContentValue.Selector.Option(); |
| | | option.setKey(String.valueOf(object)); |
| | | selector.setOptions(Arrays.asList(option)); |
| | | vacation.setSelector(selector); |
| | | } else if (control.getControlParam().equals("vacation.attendance.date_range.type")) { |
| | | ContentValue.Attendance attendance = Optional.ofNullable(vacation.getAttendance()).orElse(new ContentValue.Attendance()); |
| | | ContentValue.Attendance.DataRange dateRange = Optional.ofNullable(attendance.getDateRange()).orElse(new ContentValue.Attendance.DataRange()); |
| | | dateRange.setType(String.valueOf(object)); |
| | | attendance.setDateRange(dateRange); |
| | | vacation.setAttendance(attendance); |
| | | } else if (control.getControlParam().equals("vacation.attendance.date_range.new_begin")) { |
| | | ContentValue.Attendance attendance = Optional.ofNullable(vacation.getAttendance()).orElse(new ContentValue.Attendance()); |
| | | ContentValue.Attendance.DataRange dateRange = Optional.ofNullable(attendance.getDateRange()).orElse(new ContentValue.Attendance.DataRange()); |
| | | if (field.getType().equals(String.class) || field.getType().equals(Integer.class) || field.getType().equals(Long.class)) { |
| | | dateRange.setBegin(Long.parseLong(String.valueOf(object))); |
| | | } else if (field.getType().equals(Timestamp.class)) { |
| | | Timestamp time = (Timestamp) object; |
| | | dateRange.setBegin(Long.valueOf(time.getTime() / 1000)); |
| | | } |
| | | attendance.setDateRange(dateRange); |
| | | vacation.setAttendance(attendance); |
| | | } else if (control.getControlParam().equals("vacation.attendance.date_range.new_end")) { |
| | | ContentValue.Attendance attendance = Optional.ofNullable(vacation.getAttendance()).orElse(new ContentValue.Attendance()); |
| | | ContentValue.Attendance.DataRange dateRange = Optional.ofNullable(attendance.getDateRange()).orElse(new ContentValue.Attendance.DataRange()); |
| | | if (field.getType().equals(String.class) || field.getType().equals(Integer.class) || field.getType().equals(Long.class)) { |
| | | dateRange.setEnd(Long.parseLong(String.valueOf(object))); |
| | | } else if (field.getType().equals(Timestamp.class)) { |
| | | Timestamp time = (Timestamp) object; |
| | | dateRange.setEnd(Long.valueOf(time.getTime() / 1000)); |
| | | } |
| | | attendance.setDateRange(dateRange); |
| | | vacation.setAttendance(attendance); |
| | | } else if (control.getControlParam().equals("vacation.attendance.date_range.new_duration")) { |
| | | ContentValue.Attendance attendance = Optional.ofNullable(vacation.getAttendance()).orElse(new ContentValue.Attendance()); |
| | | ContentValue.Attendance.DataRange dateRange = Optional.ofNullable(attendance.getDateRange()).orElse(new ContentValue.Attendance.DataRange()); |
| | | dateRange.setDuration(Long.parseLong(String.valueOf(object))); |
| | | attendance.setDateRange(dateRange); |
| | | vacation.setAttendance(attendance); |
| | | } |
| | | |
| | | value.setVacation(vacation); |
| | | } else if (control.getControlType().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_ATTENDANCE)) { |
| | | ContentValue.Attendance attendance = Optional.ofNullable(value.getAttendance()).orElse(new ContentValue.Attendance()); |
| | | |
| | | if (control.getControlParam().equals("attendance.date_range.type")) { |
| | | ContentValue.Attendance.DataRange dateRange = Optional.ofNullable(attendance.getDateRange()).orElse(new ContentValue.Attendance.DataRange()); |
| | | dateRange.setType(String.valueOf(object)); |
| | | attendance.setDateRange(dateRange); |
| | | } else if (control.getControlParam().equals("attendance.date_range.new_begin")) { |
| | | ContentValue.Attendance.DataRange dateRange = Optional.ofNullable(attendance.getDateRange()).orElse(new ContentValue.Attendance.DataRange()); |
| | | if (field.getType().equals(String.class) || field.getType().equals(Integer.class) || field.getType().equals(Long.class)) { |
| | | dateRange.setBegin(Long.parseLong(String.valueOf(object))); |
| | | } else if (field.getType().equals(Timestamp.class)) { |
| | | Timestamp time = (Timestamp) object; |
| | | dateRange.setBegin(Long.valueOf(time.getTime() / 1000)); |
| | | } |
| | | attendance.setDateRange(dateRange); |
| | | } else if (control.getControlParam().equals("attendance.date_range.new_end")) { |
| | | ContentValue.Attendance.DataRange dateRange = Optional.ofNullable(attendance.getDateRange()).orElse(new ContentValue.Attendance.DataRange()); |
| | | if (field.getType().equals(String.class) || field.getType().equals(Integer.class) || field.getType().equals(Long.class)) { |
| | | dateRange.setEnd(Long.parseLong(String.valueOf(object))); |
| | | } else if (field.getType().equals(Timestamp.class)) { |
| | | Timestamp time = (Timestamp) object; |
| | | dateRange.setEnd(Long.valueOf(time.getTime() / 1000)); |
| | | } |
| | | attendance.setDateRange(dateRange); |
| | | } else if (control.getControlParam().equals("attendance.date_range.new_duration")) { |
| | | ContentValue.Attendance.DataRange dateRange = Optional.ofNullable(attendance.getDateRange()).orElse(new ContentValue.Attendance.DataRange()); |
| | | dateRange.setDuration(Long.parseLong(String.valueOf(object))); |
| | | attendance.setDateRange(dateRange); |
| | | } else if (control.getControlParam().equals("attendance.type")) { |
| | | attendance.setType(Integer.parseInt(String.valueOf(object))); |
| | | } |
| | | |
| | | value.setAttendance(attendance); |
| | | } |
| | | |
| | | field.setAccessible(accessible); |
| | | // 保存数据 |
| | | applyDataContent.setValue(value); |
| | | List<ApplyDataContent> applyDataContents = Optional.ofNullable(applyData.getContents()).orElse(new ArrayList<>()); |
| | | if (!applyDataContents.isEmpty() && applyDataContents.stream().anyMatch(m -> m.getControl().equals(control.getControlType()) && m.getId().equals(control.getControlId()))) { |
| | | applyDataContents = applyDataContents.stream().map(m -> m.getControl().equals(control.getControlType()) && m.getId().equals(control.getControlId()) ? applyDataContent : m).collect(Collectors.toList()); |
| | | } else { |
| | | applyDataContents.add(applyDataContent); |
| | | } |
| | | applyData.setContents(applyDataContents); |
| | | } |
| | | } |
| | | |
| | | // 获取企业微信Token |
| | | wxCpService.getAccessToken(); |
| | | // 初始化参数 |
| | | WxCpOaApplyEventRequest eventRequest = new WxCpOaApplyEventRequest(); |
| | | |
| | | // 申请人userid |
| | | eventRequest.setCreatorUserId(userWxId); |
| | | // 模板id |
| | | eventRequest.setTemplateId(template.getTemplateId()); |
| | | // 审批人模式 |
| | | eventRequest.setUseTemplateApprover(1); |
| | | // 提单者提单部门id,不填默认为主部门 |
| | | eventRequest.setChooseDepartment(null); |
| | | // 审批申请数据 |
| | | eventRequest.setApplyData(applyData); |
| | | // 摘要信息 |
| | | eventRequest.setSummaryList(new ArrayList<>(0)); |
| | | // 发送申请请求 |
| | | String spNo = wxCpService.getOaService().apply(eventRequest); |
| | | resultMap.put("spNo", spNo); |
| | | } catch (WxErrorException wxErrorException) { |
| | | // 通信失败 |
| | | wxErrorException.printStackTrace(); |
| | | resultMap.put("error", "通信失败"); |
| | | } catch (IllegalAccessException illegalAccessException) { |
| | | // 解析后数据获取失败 |
| | | illegalAccessException.printStackTrace(); |
| | | resultMap.put("error", "解析类成员数据获取失败"); |
| | | } catch (Exception e) { |
| | | // 处理异常 |
| | | e.printStackTrace(); |
| | | resultMap.put("error", "处理异常"); |
| | | } |
| | | |
| | | return resultMap; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.impl; |
| | | |
| | | import me.zhengjie.modules.approval.domain.TemplateControl; |
| | | import me.zhengjie.utils.ValidationUtil; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.approval.repository.TemplateControlRepository; |
| | | import me.zhengjie.modules.approval.service.TemplateControlService; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlDto; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlQueryCriteria; |
| | | import me.zhengjie.modules.approval.service.mapstruct.TemplateControlMapper; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | import me.zhengjie.utils.PageUtil; |
| | | import me.zhengjie.utils.QueryHelp; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class TemplateControlServiceImpl implements TemplateControlService { |
| | | |
| | | private final TemplateControlRepository templateControlRepository; |
| | | private final TemplateControlMapper templateControlMapper; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(TemplateControlQueryCriteria criteria, Pageable pageable){ |
| | | Page<TemplateControl> page = templateControlRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(templateControlMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<TemplateControlDto> queryAll(TemplateControlQueryCriteria criteria){ |
| | | return templateControlMapper.toDto(templateControlRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public TemplateControlDto findById(Long id) { |
| | | TemplateControl templateControl = templateControlRepository.findById(id).orElseGet(TemplateControl::new); |
| | | ValidationUtil.isNull(templateControl.getId(),"TemplateControl","id",id); |
| | | return templateControlMapper.toDto(templateControl); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public TemplateControlDto create(TemplateControl resources) { |
| | | return templateControlMapper.toDto(templateControlRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(TemplateControl resources) { |
| | | TemplateControl templateControl = templateControlRepository.findById(resources.getId()).orElseGet(TemplateControl::new); |
| | | ValidationUtil.isNull( templateControl.getId(),"TemplateControl","id",resources.getId()); |
| | | templateControl.copy(resources); |
| | | templateControlRepository.save(templateControl); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | templateControlRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<TemplateControlDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (TemplateControlDto templateControl : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put(" 模版ID", templateControl.getTemplateId()); |
| | | map.put("控件类型", templateControl.getControlType()); |
| | | map.put("控件ID", templateControl.getControlId()); |
| | | map.put("占位符文本(中文)", templateControl.getPlaceholderTextZh()); |
| | | map.put("占位符文本(英文)", templateControl.getPlaceholderTextEn()); |
| | | map.put("是否必填", templateControl.getContentRequire()); |
| | | map.put("是否参与打印", templateControl.getContentPrint()); |
| | | map.put("控件设定", templateControl.getContentConfig()); |
| | | map.put("删除判定", templateControl.getDelStatus()); |
| | | map.put("创建时间", templateControl.getCreateTime()); |
| | | map.put("创建人", templateControl.getCreateBy()); |
| | | map.put("更新时间", templateControl.getUpdateTime()); |
| | | map.put("更新人", templateControl.getUpdateBy()); |
| | | map.put("标题文本(中文)", templateControl.getTitleTextZh()); |
| | | map.put("标题文本(英文)", templateControl.getTitleTextEn()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import me.chanjar.weixin.common.error.WxErrorException; |
| | | import me.chanjar.weixin.cp.api.WxCpService; |
| | | import me.chanjar.weixin.cp.bean.oa.WxCpCorpConfInfo; |
| | | import me.chanjar.weixin.cp.bean.oa.WxCpOaApprovalTemplateResult; |
| | | import me.chanjar.weixin.cp.bean.oa.templatedata.TemplateTitle; |
| | | import me.zhengjie.modules.approval.domain.Template; |
| | | import me.zhengjie.modules.approval.domain.TemplateControl; |
| | | import me.zhengjie.modules.approval.repository.TemplateControlRepository; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlDto; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlQueryCriteria; |
| | | import me.zhengjie.modules.approval.service.mapstruct.TemplateControlMapper; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.system.service.DictDetailService; |
| | | import me.zhengjie.modules.system.service.dto.DictDetailDto; |
| | | import me.zhengjie.utils.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.approval.repository.TemplateRepository; |
| | | import me.zhengjie.modules.approval.service.TemplateService; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateDto; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateQueryCriteria; |
| | | import me.zhengjie.modules.approval.service.mapstruct.TemplateMapper; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.Pageable; |
| | | |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import java.util.stream.Collectors; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @description 服务实现 |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class TemplateServiceImpl implements TemplateService { |
| | | |
| | | private final TemplateRepository templateRepository; |
| | | private final TemplateControlRepository templateControlRepository; |
| | | private final TemplateMapper templateMapper; |
| | | private final TemplateControlMapper templateControlMapper; |
| | | private final WxCpService wxCpService; |
| | | private final DictDetailService dictDetailService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(TemplateQueryCriteria criteria, Pageable pageable){ |
| | | Page<Template> page = templateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(templateMapper::toDto)); |
| | | } |
| | | |
| | | @Override |
| | | public List<TemplateDto> queryAll(TemplateQueryCriteria criteria){ |
| | | return templateMapper.toDto(templateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public TemplateDto findById(Long id) { |
| | | Template template = templateRepository.findById(id).orElseGet(Template::new); |
| | | ValidationUtil.isNull(template.getId(),"Template","id",id); |
| | | return templateMapper.toDto(template); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public TemplateDto create(Template resources) { |
| | | return templateMapper.toDto(templateRepository.save(resources)); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(Template resources) { |
| | | Template template = templateRepository.findById(resources.getId()).orElseGet(Template::new); |
| | | ValidationUtil.isNull( template.getId(),"Template","id",resources.getId()); |
| | | template.copy(resources); |
| | | templateRepository.save(template); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteAll(Long[] ids) { |
| | | for (Long id : ids) { |
| | | templateRepository.deleteById(id); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void download(List<TemplateDto> all, HttpServletResponse response) throws IOException { |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | for (TemplateDto template : all) { |
| | | Map<String,Object> map = new LinkedHashMap<>(); |
| | | map.put("模版ID(企微内)", template.getTemplateId()); |
| | | map.put("删除判定", template.getDelStatus()); |
| | | map.put("创建时间", template.getCreateTime()); |
| | | map.put("创建人", template.getCreateBy()); |
| | | map.put("更新时间", template.getUpdateTime()); |
| | | map.put("更新人", template.getUpdateBy()); |
| | | map.put("模板名称(中文)", template.getTemplateNameZh()); |
| | | map.put("模板名称(英文)", template.getTemplateNameEn()); |
| | | list.add(map); |
| | | } |
| | | FileUtil.downloadExcel(list, response); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public TemplateDto queryWeComTemplate(TemplateQueryCriteria criteria) throws Exception { |
| | | if (StringUtils.isNotBlank(criteria.getTemplateId())) { |
| | | try { |
| | | if (criteria.getQueryNew()) { |
| | | // 获取企业微信Token |
| | | wxCpService.getAccessToken(); |
| | | |
| | | // 获取指定模版详细信息 |
| | | WxCpOaApprovalTemplateResult templateResult = wxCpService.getOaService().getTemplateDetail(criteria.getTemplateId()); |
| | | if (templateResult.getErrCode().equals(0)) { |
| | | // 保存模版信息 |
| | | Template template = new Template(); |
| | | // 模版唯一标识 |
| | | template.setTemplateId(criteria.getTemplateId()); |
| | | // 多语言标题 |
| | | for (TemplateTitle templateTitle : templateResult.getTemplateNames()) { |
| | | if (templateTitle.getLang().equals(ElAdminConstant.Constant.TEMPLATE_LANG_ZH)) { |
| | | template.setTemplateNameZh(templateTitle.getText()); |
| | | } else if (templateTitle.getLang().equals(ElAdminConstant.Constant.TEMPLATE_LANG_EN)) { |
| | | template.setTemplateNameEn(templateTitle.getText()); |
| | | } |
| | | } |
| | | template.setDelStatus(ElAdminConstant.Constant.TEMPLATE_DEL_STATUS_NORMAL); |
| | | TemplateDto savedTemplateDto = templateMapper.toDto(templateRepository.save(template)); |
| | | |
| | | List<TemplateControlDto> templateControlDtos = new ArrayList<>(); |
| | | // 保存控件信息 |
| | | for (WxCpOaApprovalTemplateResult.TemplateControls controls : templateResult.getTemplateContent().getControls()) { |
| | | if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_TEXT)) { |
| | | // 文本内容 |
| | | TemplateControl text = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | text.setControlParam("text"); |
| | | text.setControlParamName("文本内容"); |
| | | TemplateControlDto textSaved = templateControlMapper.toDto(templateControlRepository.save(text)); |
| | | templateControlDtos.add(textSaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_TEXTAREA)) { |
| | | // 文本内容 |
| | | TemplateControl text = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | text.setControlParam("text"); |
| | | text.setControlParamName("文本内容"); |
| | | TemplateControlDto textSaved = templateControlMapper.toDto(templateControlRepository.save(text)); |
| | | templateControlDtos.add(textSaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_NUMBER)) { |
| | | // 数字内容 |
| | | TemplateControl newNumber = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | newNumber.setControlParam("new_number"); |
| | | newNumber.setControlParamName("数字内容"); |
| | | TemplateControlDto newNumberSaved = templateControlMapper.toDto(templateControlRepository.save(newNumber)); |
| | | templateControlDtos.add(newNumberSaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_MONEY)) { |
| | | // 金额内容 |
| | | TemplateControl newMoney = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | newMoney.setControlParam("new_money"); |
| | | newMoney.setControlParamName("金额内容"); |
| | | TemplateControlDto newMoneySaved = templateControlMapper.toDto(templateControlRepository.save(newMoney)); |
| | | templateControlDtos.add(newMoneySaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_DATE)) { |
| | | // 时间展示类型:day-日期;hour-日期+时间 |
| | | TemplateControl dateType = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateType.setControlParam("date.type"); |
| | | dateType.setControlParamName("时间展示类型"); |
| | | TemplateControlDto dateTypeSaved = templateControlMapper.toDto(templateControlRepository.save(dateType)); |
| | | templateControlDtos.add(dateTypeSaved); |
| | | // 时间戳-字符串类型 |
| | | TemplateControl dateSTimestamp = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateSTimestamp.setControlParam("date.s_timestamp"); |
| | | dateSTimestamp.setControlParamName("时间戳"); |
| | | TemplateControlDto dateSTimestampSaved = templateControlMapper.toDto(templateControlRepository.save(dateSTimestamp)); |
| | | templateControlDtos.add(dateSTimestampSaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_SELECTOR)) { |
| | | // 选项key |
| | | TemplateControl selectorOptionsKey = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | selectorOptionsKey.setControlParam("selector.options[].key"); |
| | | selectorOptionsKey.setControlParamName("选项KEY"); |
| | | TemplateControlDto selectorOptionsKeySaved = templateControlMapper.toDto(templateControlRepository.save(selectorOptionsKey)); |
| | | templateControlDtos.add(selectorOptionsKeySaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_CONTACT)) { |
| | | // 所选成员的userid |
| | | TemplateControl membersUserid = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | membersUserid.setControlParam("members[].userid"); |
| | | membersUserid.setControlParamName("成员USERID"); |
| | | TemplateControlDto membersUseridSaved = templateControlMapper.toDto(templateControlRepository.save(membersUserid)); |
| | | templateControlDtos.add(membersUseridSaved); |
| | | // 成员名 |
| | | TemplateControl membersName = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | membersName.setControlParam("members[].name"); |
| | | membersName.setControlParamName("成员名"); |
| | | TemplateControlDto savedNameTemplateControlDto = templateControlMapper.toDto(templateControlRepository.save(membersName)); |
| | | templateControlDtos.add(savedNameTemplateControlDto); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_CONTACT)) { |
| | | // 所选部门id |
| | | TemplateControl departmentsOpenapiId = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | departmentsOpenapiId.setControlParam("departments[].openapi_id"); |
| | | departmentsOpenapiId.setControlParamName("部门ID"); |
| | | TemplateControlDto departmentsOpenapiIdSaved = templateControlMapper.toDto(templateControlRepository.save(departmentsOpenapiId)); |
| | | templateControlDtos.add(departmentsOpenapiIdSaved); |
| | | // 所选部门名 |
| | | TemplateControl departmentsName = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | departmentsName.setControlParam("departments[].name"); |
| | | departmentsName.setControlParamName("部门名"); |
| | | TemplateControlDto departmentsNameSaved = templateControlMapper.toDto(templateControlRepository.save(departmentsName)); |
| | | templateControlDtos.add(departmentsNameSaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_FILE)) { |
| | | // 文件id |
| | | TemplateControl filesFileId = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | filesFileId.setControlParam("files[].file_id"); |
| | | filesFileId.setControlParamName("文件ID"); |
| | | TemplateControlDto filesFileIdSaved = templateControlMapper.toDto(templateControlRepository.save(filesFileId)); |
| | | templateControlDtos.add(filesFileIdSaved); |
| | | // 文件名称 |
| | | TemplateControl filesFileName = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | filesFileName.setControlParam("files[].file_name"); |
| | | filesFileName.setControlParamName("文件名称"); |
| | | filesFileName.setContentRequire(0); |
| | | TemplateControlDto filesFileNameSaved = templateControlMapper.toDto(templateControlRepository.save(filesFileName)); |
| | | templateControlDtos.add(filesFileNameSaved); |
| | | // 文件大小 |
| | | TemplateControl filesFileSize = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | filesFileSize.setControlParam("files[].file_size"); |
| | | filesFileSize.setControlParamName("文件大小"); |
| | | filesFileSize.setContentRequire(0); |
| | | TemplateControlDto filesFileSizeSaved = templateControlMapper.toDto(templateControlRepository.save(filesFileSize)); |
| | | templateControlDtos.add(filesFileSizeSaved); |
| | | // 文件类型 |
| | | TemplateControl filesFileType = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | filesFileType.setControlParam("files[].file_type"); |
| | | filesFileType.setControlParamName("文件类型"); |
| | | filesFileType.setContentRequire(0); |
| | | TemplateControlDto filesFileTypeSaved = templateControlMapper.toDto(templateControlRepository.save(filesFileType)); |
| | | templateControlDtos.add(filesFileTypeSaved); |
| | | // 文件地址 |
| | | TemplateControl filesFileUrl = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | filesFileUrl.setControlParam("files[].file_url"); |
| | | filesFileUrl.setControlParamName("文件地址"); |
| | | filesFileUrl.setContentRequire(0); |
| | | TemplateControlDto filesFileUrlSaved = templateControlMapper.toDto(templateControlRepository.save(filesFileUrl)); |
| | | templateControlDtos.add(filesFileUrlSaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_TABLE)) { |
| | | // 明细内容 |
| | | TemplateControl children = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | children.setControlParam("children"); |
| | | children.setControlParamName("明细内容"); |
| | | TemplateControlDto childrenSaved = templateControlMapper.toDto(templateControlRepository.save(children)); |
| | | templateControlDtos.add(childrenSaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_LOCATION)) { |
| | | // 纬度 |
| | | TemplateControl locationLatitude = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | locationLatitude.setControlParam("location.latitude"); |
| | | locationLatitude.setControlParamName("纬度"); |
| | | TemplateControlDto locationLatitudeSaved = templateControlMapper.toDto(templateControlRepository.save(locationLatitude)); |
| | | templateControlDtos.add(locationLatitudeSaved); |
| | | // 经度 |
| | | TemplateControl locationLongitude = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | locationLongitude.setControlParam("location.longitude"); |
| | | locationLongitude.setControlParamName("经度"); |
| | | TemplateControlDto locationLongitudeSaved = templateControlMapper.toDto(templateControlRepository.save(locationLongitude)); |
| | | templateControlDtos.add(locationLongitudeSaved); |
| | | // 地点标题 |
| | | TemplateControl locationTitle = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | locationTitle.setControlParam("location.title"); |
| | | locationTitle.setControlParamName("地点标题"); |
| | | TemplateControlDto locationTitleSaved = templateControlMapper.toDto(templateControlRepository.save(locationTitle)); |
| | | templateControlDtos.add(locationTitleSaved); |
| | | // 地点详情地址 |
| | | TemplateControl locationAddress = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | locationAddress.setControlParam("location.address"); |
| | | locationAddress.setControlParamName("详情地址"); |
| | | TemplateControlDto locationAddressSaved = templateControlMapper.toDto(templateControlRepository.save(locationAddress)); |
| | | templateControlDtos.add(locationAddressSaved); |
| | | // 选择地点的时间 |
| | | TemplateControl locationTime = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | locationTime.setControlParam("location.time"); |
| | | locationTime.setControlParamName("选择时间"); |
| | | TemplateControlDto locationTimeSaved = templateControlMapper.toDto(templateControlRepository.save(locationTime)); |
| | | templateControlDtos.add(locationTimeSaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_RELATEDAPPROVAL)) { |
| | | // 关联审批单的审批单号 |
| | | TemplateControl relatedApprovalSpNo = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | relatedApprovalSpNo.setControlParam("related_approval[].sp_no"); |
| | | relatedApprovalSpNo.setControlParamName("审批单号"); |
| | | TemplateControlDto relatedApprovalSpNoSaved = templateControlMapper.toDto(templateControlRepository.save(relatedApprovalSpNo)); |
| | | templateControlDtos.add(relatedApprovalSpNoSaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_FORMULA)) { |
| | | // 公式的值 |
| | | TemplateControl formulaValue = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | formulaValue.setControlParam("formula.value"); |
| | | formulaValue.setControlParamName("公式值"); |
| | | TemplateControlDto formulaValueSaved = templateControlMapper.toDto(templateControlRepository.save(formulaValue)); |
| | | templateControlDtos.add(formulaValueSaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_DATERANGE)) { |
| | | // 时长粒度:halfday:按天 hour:按小时 |
| | | TemplateControl dateRangeType = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateRangeType.setControlParam("date_range.type"); |
| | | dateRangeType.setControlParamName("时长粒度"); |
| | | TemplateControlDto dateRangeTypeSaved = templateControlMapper.toDto(templateControlRepository.save(dateRangeType)); |
| | | templateControlDtos.add(dateRangeTypeSaved); |
| | | // 开始时间,unix时间戳 |
| | | TemplateControl dateRangeNewBegin = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateRangeNewBegin.setControlParam("date_range.new_begin"); |
| | | dateRangeNewBegin.setControlParamName("开始时间"); |
| | | TemplateControlDto dateRangeNewBeginSaved = templateControlMapper.toDto(templateControlRepository.save(dateRangeNewBegin)); |
| | | templateControlDtos.add(dateRangeNewBeginSaved); |
| | | // 结束时间,unix时间戳 |
| | | TemplateControl dateRangeNewEnd = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateRangeNewEnd.setControlParam("date_range.new_end"); |
| | | dateRangeNewEnd.setControlParamName("结束时间"); |
| | | TemplateControlDto dateRangeNewEndSaved = templateControlMapper.toDto(templateControlRepository.save(dateRangeNewEnd)); |
| | | templateControlDtos.add(dateRangeNewEndSaved); |
| | | // 时长范围, 单位秒 |
| | | TemplateControl dateRangeNewDuration = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateRangeNewDuration.setControlParam("date_range.new_duration"); |
| | | dateRangeNewDuration.setControlParamName("时长范围"); |
| | | TemplateControlDto dateRangeNewDurationSaved = templateControlMapper.toDto(templateControlRepository.save(dateRangeNewDuration)); |
| | | templateControlDtos.add(dateRangeNewDurationSaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_VACATION)) { |
| | | // 假勤组件需要获取假期相关配置 |
| | | WxCpCorpConfInfo corpConfInfo = wxCpService.getOaService().getCorpConf(); |
| | | // 选项key |
| | | TemplateControl key = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | key.setControlParam("vacation.selector.options[].key"); |
| | | key.setControlParamName("选项KEY"); |
| | | key.setContentConfig(corpConfInfo.getLists().toString()); |
| | | TemplateControlDto keySaved = templateControlMapper.toDto(templateControlRepository.save(key)); |
| | | templateControlDtos.add(keySaved); |
| | | // // 选项值 |
| | | // TemplateControl value = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | // value.setControlParam("vacation.selector.options[].value"); |
| | | // value.setControlParamName("选项值"); |
| | | // value.setContentConfig(corpConfInfo.getLists().toString()); |
| | | // TemplateControlDto valueSaved = templateControlMapper.toDto(templateControlRepository.save(value)); |
| | | // templateControlDtos.add(valueSaved); |
| | | // 时长粒度:halfday:按天 hour:按小时 |
| | | TemplateControl dateRangeType = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateRangeType.setControlParam("vacation.attendance.date_range.type"); |
| | | dateRangeType.setControlParamName("时长粒度"); |
| | | dateRangeType.setContentConfig(corpConfInfo.getLists().toString()); |
| | | TemplateControlDto dateRangeTypeSaved = templateControlMapper.toDto(templateControlRepository.save(dateRangeType)); |
| | | templateControlDtos.add(dateRangeTypeSaved); |
| | | // 开始时间戳 |
| | | TemplateControl dateRangeNewBegin = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateRangeNewBegin.setControlParam("vacation.attendance.date_range.new_begin"); |
| | | dateRangeNewBegin.setControlParamName("开始时间"); |
| | | dateRangeNewBegin.setContentConfig(corpConfInfo.getLists().toString()); |
| | | TemplateControlDto dateRangeNewBeginSaved = templateControlMapper.toDto(templateControlRepository.save(dateRangeNewBegin)); |
| | | templateControlDtos.add(dateRangeNewBeginSaved); |
| | | // 结束时间戳 |
| | | TemplateControl dateRangeNewEnd = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateRangeNewEnd.setControlParam("vacation.attendance.date_range.new_end"); |
| | | dateRangeNewEnd.setControlParamName("结束时间"); |
| | | dateRangeNewEnd.setContentConfig(corpConfInfo.getLists().toString()); |
| | | TemplateControlDto dateRangeNewEndSaved = templateControlMapper.toDto(templateControlRepository.save(dateRangeNewEnd)); |
| | | templateControlDtos.add(dateRangeNewEndSaved); |
| | | // 申请时长 |
| | | TemplateControl dateRangeNewDuration = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateRangeNewDuration.setControlParam("vacation.attendance.date_range.new_duration"); |
| | | dateRangeNewDuration.setControlParamName("申请时长"); |
| | | dateRangeNewDuration.setContentConfig(corpConfInfo.getLists().toString()); |
| | | TemplateControlDto dateRangeNewDurationSaved = templateControlMapper.toDto(templateControlRepository.save(dateRangeNewDuration)); |
| | | templateControlDtos.add(dateRangeNewDurationSaved); |
| | | } else if (controls.getProperty().getControl().equals(ElAdminConstant.Constant.TEMPLATE_CONTROL_TYPE_ATTENDANCE)) { |
| | | // 时长粒度:halfday:按天 hour:按小时 |
| | | TemplateControl dateRangeType = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateRangeType.setControlParam("attendance.date_range.type"); |
| | | dateRangeType.setControlParamName("时长粒度"); |
| | | TemplateControlDto dateRangeTypeSaved = templateControlMapper.toDto(templateControlRepository.save(dateRangeType)); |
| | | templateControlDtos.add(dateRangeTypeSaved); |
| | | // 开始时间戳 |
| | | TemplateControl dateRangeNewBegin = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateRangeNewBegin.setControlParam("attendance.date_range.new_begin"); |
| | | dateRangeNewBegin.setControlParamName("开始时间"); |
| | | TemplateControlDto dateRangeNewBeginSaved = templateControlMapper.toDto(templateControlRepository.save(dateRangeNewBegin)); |
| | | templateControlDtos.add(dateRangeNewBeginSaved); |
| | | // 结束时间戳 |
| | | TemplateControl dateRangeNewEnd = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateRangeNewEnd.setControlParam("attendance.date_range.new_end"); |
| | | dateRangeNewEnd.setControlParamName("结束时间"); |
| | | TemplateControlDto dateRangeNewEndSaved = templateControlMapper.toDto(templateControlRepository.save(dateRangeNewEnd)); |
| | | templateControlDtos.add(dateRangeNewEndSaved); |
| | | // 申请时长 |
| | | TemplateControl dateRangeNewDuration = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | dateRangeNewDuration.setControlParam("attendance.date_range.new_duration"); |
| | | dateRangeNewDuration.setControlParamName("申请时长"); |
| | | TemplateControlDto dateRangeNewDurationSaved = templateControlMapper.toDto(templateControlRepository.save(dateRangeNewDuration)); |
| | | templateControlDtos.add(dateRangeNewDurationSaved); |
| | | // 假勤组件类型:1-请假;3-出差;4-外出;5-加班 |
| | | TemplateControl attendanceType = makeDefaultTemplateControl(savedTemplateDto.getId(), controls); |
| | | attendanceType.setControlParam("attendance.type"); |
| | | attendanceType.setControlParamName("假勤类型"); |
| | | TemplateControlDto attendanceTypeSaved = templateControlMapper.toDto(templateControlRepository.save(attendanceType)); |
| | | templateControlDtos.add(attendanceTypeSaved); |
| | | } |
| | | } |
| | | // 控件信息放入模版 |
| | | savedTemplateDto.setTemplateControls(templateControlDtos); |
| | | |
| | | return savedTemplateDto; |
| | | } else { |
| | | throw new Exception("数据获取失败"); |
| | | } |
| | | } else { |
| | | criteria.setDelStatus(ElAdminConstant.Constant.TEMPLATE_DEL_STATUS_NORMAL); |
| | | List<Template> templateList = templateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder), Sort.by(Sort.Direction.DESC, "id")); |
| | | if (templateList.size() > 0) { |
| | | TemplateDto templateDto = templateMapper.toDto(templateList.get(0)); |
| | | TemplateControlQueryCriteria controlCriteria = new TemplateControlQueryCriteria(); |
| | | controlCriteria.setTemplateId(templateDto.getId()); |
| | | List<TemplateControl> templateControlList = templateControlRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,controlCriteria,criteriaBuilder)); |
| | | templateDto.setTemplateControls(templateControlMapper.toDto(templateControlList)); |
| | | |
| | | return templateDto; |
| | | } else { |
| | | throw new Exception("数据不存在"); |
| | | } |
| | | } |
| | | } catch (WxErrorException wxErrorException) { |
| | | wxErrorException.printStackTrace(); |
| | | throw new Exception("数据读取失败"); |
| | | } |
| | | } else { |
| | | throw new Exception("缺少必要参数"); |
| | | } |
| | | } |
| | | |
| | | private TemplateControl makeDefaultTemplateControl(Long pid, WxCpOaApprovalTemplateResult.TemplateControls controls) { |
| | | TemplateControl templateControl = new TemplateControl(); |
| | | templateControl.setTemplateId(pid); |
| | | templateControl.setControlType(controls.getProperty().getControl()); |
| | | templateControl.setControlId(controls.getProperty().getId()); |
| | | // 多语言标题 |
| | | for (TemplateTitle title : controls.getProperty().getTitle()) { |
| | | if (title.getLang().equals(ElAdminConstant.Constant.TEMPLATE_LANG_ZH)) { |
| | | templateControl.setTitleTextZh(title.getText()); |
| | | } else if (title.getLang().equals(ElAdminConstant.Constant.TEMPLATE_LANG_EN)) { |
| | | templateControl.setTitleTextEn(title.getText()); |
| | | } |
| | | } |
| | | // 多语言填写说明 |
| | | for (TemplateTitle placeholder : controls.getProperty().getPlaceholder()) { |
| | | if (placeholder.getLang().equals(ElAdminConstant.Constant.TEMPLATE_LANG_ZH)) { |
| | | templateControl.setPlaceholderTextZh(placeholder.getText()); |
| | | } else if (placeholder.getLang().equals(ElAdminConstant.Constant.TEMPLATE_LANG_EN)) { |
| | | templateControl.setPlaceholderTextEn(placeholder.getText()); |
| | | } |
| | | } |
| | | templateControl.setContentRequire(controls.getProperty().getRequire()); |
| | | templateControl.setContentPrint(controls.getProperty().getUnPrint()); |
| | | templateControl.setContentConfig(ObjectUtils.isNotEmpty(controls.getConfig()) ? JSONObject.toJSONString(controls.getConfig()) : null); |
| | | templateControl.setDelStatus(ElAdminConstant.Constant.TEMPLATE_DEL_STATUS_NORMAL); |
| | | |
| | | return templateControl; |
| | | } |
| | | |
| | | @Override |
| | | public String getVacationKey(String type) { |
| | | List<DictDetailDto> dictDetailDtos = dictDetailService.getDictByName(Constant.WECOM_LEAVE_TYPE); |
| | | List<String> ids = dictDetailDtos.stream().filter(i -> i.getLabel().equals(type)).map(m -> m.getValue()).collect(Collectors.toList()); |
| | | if (ids.size() > 0) { |
| | | return ids.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.approval.domain.ApproveEvent; |
| | | import me.zhengjie.modules.approval.service.dto.ApproveEventDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface ApproveEventMapper extends BaseMapper<ApproveEventDto, ApproveEvent> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.approval.domain.TemplateControlField; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlFieldDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface TemplateControlFieldMapper extends BaseMapper<TemplateControlFieldDto, TemplateControlField> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.approval.domain.TemplateControl; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateControlDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface TemplateControlMapper extends BaseMapper<TemplateControlDto, TemplateControl> { |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright 2019-2020 Zheng Jie |
| | | * |
| | | * Licensed under the Apache License, Version 2.0 (the "License"); |
| | | * you may not use this file except in compliance with the License. |
| | | * You may obtain a copy of the License at |
| | | * |
| | | * http://www.apache.org/licenses/LICENSE-2.0 |
| | | * |
| | | * Unless required by applicable law or agreed to in writing, software |
| | | * distributed under the License is distributed on an "AS IS" BASIS, |
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | * See the License for the specific language governing permissions and |
| | | * limitations under the License. |
| | | */ |
| | | package me.zhengjie.modules.approval.service.mapstruct; |
| | | |
| | | import me.zhengjie.base.BaseMapper; |
| | | import me.zhengjie.modules.approval.domain.Template; |
| | | import me.zhengjie.modules.approval.service.dto.TemplateDto; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.ReportingPolicy; |
| | | |
| | | /** |
| | | * @website https://eladmin.vip |
| | | * @author baolh |
| | | * @date 2025-03-17 |
| | | **/ |
| | | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) |
| | | public interface TemplateMapper extends BaseMapper<TemplateDto, Template> { |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "备注")
|
| | | private String remarks;
|
| | |
|
| | | @Column(name = "`wecom_sp_no`")
|
| | | @ApiModelProperty(value = "企微审批单号")
|
| | | private String wecomSpNo;
|
| | |
|
| | | @Column(name = "`wecom_event_id`")
|
| | | @ApiModelProperty(value = "企微最新审批变化记录ID")
|
| | | private Long wecomEventId;
|
| | |
|
| | | @Column(name = "`wecom_location`")
|
| | | @ApiModelProperty(value = "企微出差地点")
|
| | | private String wecomLocation;
|
| | |
|
| | | @Column(name = "`wecom_date_type`")
|
| | | @ApiModelProperty(value = "企微时长粒度")
|
| | | private String wecomDateType;
|
| | |
|
| | | @Column(name = "`wecom_duration`")
|
| | | @ApiModelProperty(value = "企微申请时长")
|
| | | private String wecomDuration;
|
| | |
|
| | | @Column(name = "`wecom_attendance_type`")
|
| | | @ApiModelProperty(value = "企微假勤类型(固定值)")
|
| | | private String wecomAttendanceType;
|
| | |
|
| | | public void copy(AttendanceBusinessTravel source){
|
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
| | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | @Column(name = "`wecom_sp_no`") |
| | | @ApiModelProperty(value = "企微审批单号") |
| | | private String wecomSpNo; |
| | | |
| | | @Column(name = "`wecom_event_id`") |
| | | @ApiModelProperty(value = "企微最新审批变化记录ID") |
| | | private Long wecomEventId; |
| | | |
| | | @Column(name = "`wecom_date_type`") |
| | | @ApiModelProperty(value = "企微时长粒度") |
| | | private String wecomDateType; |
| | | |
| | | @Column(name = "`wecom_type_option_val`") |
| | | @ApiModelProperty(value = "企微补卡类型选项值") |
| | | private String wecomTypeOptionVal; |
| | | |
| | | public void copy(AttendanceCardreplacement source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | @Column(name = "`wecom_sp_no`") |
| | | @ApiModelProperty(value = "企微审批单号") |
| | | private String wecomSpNo; |
| | | |
| | | @Column(name = "`wecom_event_id`") |
| | | @ApiModelProperty(value = "企微最新审批变化记录ID") |
| | | private Long wecomEventId; |
| | | |
| | | @Column(name = "`wecom_type`") |
| | | @ApiModelProperty(value = "企微外出类型") |
| | | private String wecomType; |
| | | |
| | | @Column(name = "`wecom_location`") |
| | | @ApiModelProperty(value = "企微外出地点") |
| | | private String wecomLocation; |
| | | |
| | | @Column(name = "`wecom_date_type`") |
| | | @ApiModelProperty(value = "企微时长粒度") |
| | | private String wecomDateType; |
| | | |
| | | @Column(name = "`wecom_duration`") |
| | | @ApiModelProperty(value = "企微申请时长") |
| | | private String wecomDuration; |
| | | |
| | | @Column(name = "`wecom_attendance_type`") |
| | | @ApiModelProperty(value = "企微假勤类型(固定值)") |
| | | private String wecomAttendanceType; |
| | | |
| | | public void copy(AttendanceGoOut source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | |
| | | @ApiModelProperty(value = "备注") |
| | | private String remarks; |
| | | |
| | | @Column(name = "`wecom_sp_no`") |
| | | @ApiModelProperty(value = "企微审批单号") |
| | | private String wecomSpNo; |
| | | |
| | | @Column(name = "`wecom_event_id`") |
| | | @ApiModelProperty(value = "企微最新审批变化记录ID") |
| | | private Long wecomEventId; |
| | | |
| | | @Column(name = "`wecom_option_key`") |
| | | @ApiModelProperty(value = "企微请假类型KEY") |
| | | private String wecomOptionKey; |
| | | |
| | | @Column(name = "`wecom_date_type`") |
| | | @ApiModelProperty(value = "企微时长粒度") |
| | | private String wecomDateType; |
| | | |
| | | @Column(name = "`wecom_duration`") |
| | | @ApiModelProperty(value = "企微申请时长") |
| | | private String wecomDuration; |
| | | |
| | | public void copy(AttendanceLeave source){ |
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); |
| | | } |
| | |
| | | @ApiModelProperty(value = "备注")
|
| | | private String remarks;
|
| | |
|
| | | @Column(name = "`wecom_sp_no`")
|
| | | @ApiModelProperty(value = "企微审批单号")
|
| | | private String wecomSpNo;
|
| | |
|
| | | @Column(name = "`wecom_event_id`")
|
| | | @ApiModelProperty(value = "企微最新审批变化记录ID")
|
| | | private Long wecomEventId;
|
| | |
|
| | | @Column(name = "`wecom_date_type`")
|
| | | @ApiModelProperty(value = "企微时长粒度")
|
| | | private String wecomDateType;
|
| | |
|
| | | @Column(name = "`wecom_duration`")
|
| | | @ApiModelProperty(value = "企微申请时长")
|
| | | private String wecomDuration;
|
| | |
|
| | | @Column(name = "`wecom_attendance_type`")
|
| | | @ApiModelProperty(value = "企微假勤类型(固定值)")
|
| | | private String wecomAttendanceType;
|
| | |
|
| | | public void copy(AttendanceOvertime source){
|
| | | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
| | |
| | |
|
| | | import lombok.Data;
|
| | | import me.zhengjie.base.BaseDTO;
|
| | | import me.zhengjie.modules.approval.service.dto.ApproveEventDto;
|
| | |
|
| | | import java.sql.Timestamp;
|
| | | import java.io.Serializable;
|
| | |
| | | private String userName;
|
| | |
|
| | | private String appUserName;
|
| | |
|
| | | /** 企微审批单号 */
|
| | | private String wecomSpNo;
|
| | |
|
| | | /** 企微最新审批变化记录 */
|
| | | private ApproveEventDto event;
|
| | | } |
| | |
| | | /* 模糊 */ |
| | | @Query(propName = "travelEndTime", type = Query.Type.INNER_LIKE) |
| | | private String travelEndTimeLike; |
| | | |
| | | @Query(type = Query.Type.EQUAL) |
| | | private String wecomSpNo; |
| | | } |
| | |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | import me.zhengjie.modules.approval.service.dto.ApproveEventDto; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | |
| | | /** 审批人 */ |
| | | private String appUserName; |
| | | |
| | | /** 企微审批单号 */ |
| | | private String wecomSpNo; |
| | | |
| | | /** 企微最新审批变化记录 */ |
| | | private ApproveEventDto event; |
| | | } |
| | |
| | | |
| | | // @Query(isOr = "userId,approvalUserId") |
| | | // private Long approver; |
| | | |
| | | @Query(type = Query.Type.EQUAL) |
| | | private String wecomSpNo; |
| | | } |
| | |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | import me.zhengjie.modules.approval.service.dto.ApproveEventDto; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | |
| | | private String userName; |
| | | |
| | | private String appUserName; |
| | | |
| | | /** 企微审批单号 */ |
| | | private String wecomSpNo; |
| | | |
| | | /** 企微最新审批变化记录 */ |
| | | private ApproveEventDto event; |
| | | } |
| | |
| | | /* 模糊 */ |
| | | @Query(propName = "outEndTime", type = Query.Type.INNER_LIKE) |
| | | private String outEndTimeLike; |
| | | |
| | | @Query(type = Query.Type.EQUAL) |
| | | private String wecomSpNo; |
| | | } |
| | |
| | | |
| | | import lombok.Data; |
| | | import me.zhengjie.base.BaseDTO; |
| | | import me.zhengjie.modules.approval.service.dto.ApproveEventDto; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.io.Serializable; |
| | |
| | | /** 审批用户名 */ |
| | | private String appUserName; |
| | | |
| | | /** 企微审批单号 */ |
| | | private String wecomSpNo; |
| | | |
| | | /** 企微最新审批变化记录 */ |
| | | private ApproveEventDto event; |
| | | } |
| | |
| | | /* 模糊 */ |
| | | @Query(propName = "leaveEndTime", type = Query.Type.INNER_LIKE) |
| | | private String leaveEndTimeLike; |
| | | |
| | | @Query(type = Query.Type.EQUAL) |
| | | private String wecomSpNo; |
| | | } |
| | |
| | |
|
| | | import lombok.Data;
|
| | | import me.zhengjie.base.BaseDTO;
|
| | | import me.zhengjie.modules.approval.service.dto.ApproveEventDto;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.sql.Timestamp;
|
| | |
| | | /** 审批用户名 */
|
| | | private String appUserName;
|
| | |
|
| | | /** 企微审批单号 */
|
| | | private String wecomSpNo;
|
| | |
|
| | | /** 企微最新审批变化记录 */
|
| | | private ApproveEventDto event;
|
| | | } |
| | |
| | | @Query(type = Query.Type.BETWEEN, propName = "overtimeEndTime") |
| | | private List<Timestamp> overtimeEndTime; |
| | | |
| | | @Query(type = Query.Type.EQUAL) |
| | | private String wecomSpNo; |
| | | } |
| | |
| | | package me.zhengjie.modules.attendance.service.impl; |
| | | |
| | | import me.zhengjie.exception.BadRequestException; |
| | | import me.zhengjie.modules.approval.domain.ApproveEvent; |
| | | import me.zhengjie.modules.approval.repository.ApproveEventRepository; |
| | | import me.zhengjie.modules.approval.service.TemplateControlFieldService; |
| | | import me.zhengjie.modules.approval.service.mapstruct.ApproveEventMapper; |
| | | import me.zhengjie.modules.attendance.domain.*; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceGoOutRepository; |
| | | import me.zhengjie.modules.attendance.repository.AttendanceLeaveRepository; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.quartz.service.impl.WeComServiceImpl; |
| | | import me.zhengjie.modules.system.domain.DictDetail; |
| | | import me.zhengjie.modules.system.domain.Role; |
| | |
| | | private final AttendanceBusinessTravelMapper attendanceBusinessTravelMapper; |
| | | private final UserRepository userRepository; |
| | | private final UserService userService; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | private final AttendanceLeaveServiceImpl attendanceLeaveService; |
| | | private final AttendanceLeaveRepository attendanceLeaveRepository; |
| | | private final AttendanceGoOutRepository attendanceGoOutRepository; |
| | | private final ApproveEventRepository approveEventRepository; |
| | | private final ApproveEventMapper approveEventMapper; |
| | | private final DictDetailRepository dictDetailRepository; |
| | | private final WeComServiceImpl weComService; |
| | | private final TemplateControlFieldService templateControlFieldService; |
| | | |
| | | @Override |
| | | public Map<String, Object> queryAll(AttendanceBusinessTravelQueryCriteria criteria, Pageable pageable) { |
| | |
| | | public AttendanceBusinessTravelDto apply(AttendanceBusinessTravel attendanceBusinessTravel) { |
| | | // 将实体类转换成DTO |
| | | AttendanceBusinessTravelDto attendanceBusinessTravelDto = attendanceBusinessTravelMapper.toDto(attendanceBusinessTravel); |
| | | //查询用户信息 |
| | | UserDto user = userService.findById(attendanceBusinessTravelDto.getUserId()); |
| | | // 查询用户信息 |
| | | User user = userRepository.findById(attendanceBusinessTravelDto.getUserId()).orElseGet(User::new); |
| | | attendanceBusinessTravelDto.setUserName(user.getNickName()); |
| | | //查询审批用户名 |
| | | UserDto appUser = userService.findById(attendanceBusinessTravelDto.getApprovalUserId()); |
| | | // 查询审批用户名 |
| | | User appUser = userRepository.findById(attendanceBusinessTravelDto.getApprovalUserId()).orElseGet(User::new); |
| | | attendanceBusinessTravelDto.setAppUserName(appUser.getNickName()); |
| | | |
| | | // 查询企微最新审批变化记录 |
| | | if (ObjectUtils.isNotEmpty(attendanceBusinessTravel.getWecomEventId())) { |
| | | ApproveEvent event = approveEventRepository.findById(attendanceBusinessTravel.getWecomEventId()).orElseGet(ApproveEvent::new); |
| | | attendanceBusinessTravelDto.setEvent(approveEventMapper.toDto(event)); |
| | | } |
| | | |
| | | return attendanceBusinessTravelDto; |
| | | } |
| | | }; |
| | |
| | | c.add(Calendar.MINUTE, 59); |
| | | c.add(Calendar.SECOND, 59);// 加一 天 |
| | | attendanceBusinessTravel.setTravelEndTime(new Timestamp(c.getTimeInMillis())); |
| | | |
| | | // 判断是否提交企微审批 |
| | | List<DictDetail> siteTypes = dictDetailRepository.findByDictName(Constant.APPROVAL_SITE_TYPE).stream().filter(siteType -> siteType.getValue().toLowerCase().equals("wecom")).collect(Collectors.toList()); |
| | | if (siteTypes.size() > 0) { |
| | | // 添加企微申请参数 |
| | | attendanceBusinessTravel.setWecomLocation(String.format("%s -至- %s", Optional.ofNullable(attendanceBusinessTravel.getDepartureCity()).orElse("出发城市"), Optional.ofNullable(attendanceBusinessTravel.getArrivalCity()).orElse("到达城市"))); |
| | | attendanceBusinessTravel.setWecomDateType(ElAdminConstant.Constant.TEMPLATE_DATE_TYPE_HALFDAY); |
| | | attendanceBusinessTravel.setWecomDuration(String.valueOf(new BigDecimal(attendanceBusinessTravel.getTravelDuration()).multiply(new BigDecimal(86400)).longValue())); |
| | | attendanceBusinessTravel.setWecomAttendanceType("3"); |
| | | // 提交申请 |
| | | String weComId = userRepository.findById(attendanceBusinessTravel.getUserId()).orElse(new User()).getWeComId(); |
| | | Map<String, String> approvalResultMap = templateControlFieldService.createWecomApproval(attendanceBusinessTravel, weComId); |
| | | if (approvalResultMap.containsKey("spNo")) { |
| | | attendanceBusinessTravel.setWecomSpNo(approvalResultMap.get("spNo")); |
| | | } else { |
| | | throw new BadRequestException(approvalResultMap.containsKey("error") ? approvalResultMap.get("error") : "企微申请提交失败"); |
| | | } |
| | | } |
| | | |
| | | i++; |
| | | attendanceBusinessTravelRepository.save(attendanceBusinessTravel); |
| | | // } |
| | | } |
| | | //发送钉钉给审批人 |
| | | List<String> sendList = new ArrayList<>(); |
| | | //查询审批者信息 |
| | | User appUser = userRepository.getOne(resources.getApprovalUserId()); |
| | | sendList.add(appUser.getDingding()); |
| | | opaiDingTalkService.sendNotice(sendList, "审批提醒", "### 审批提示 \n >" + user.getNickName() + " 提交了出差审批,请登录PMS系统处理", "card"); |
| | | } |
| | | return attendanceBusinessTravelMapper.toDto(resources); |
| | | } |
| | |
| | | package me.zhengjie.modules.attendance.service.impl;
|
| | |
|
| | | import me.zhengjie.exception.BadRequestException;
|
| | | import me.zhengjie.modules.approval.domain.ApproveEvent;
|
| | | import me.zhengjie.modules.approval.repository.ApproveEventRepository;
|
| | | import me.zhengjie.modules.approval.service.TemplateControlFieldService;
|
| | | import me.zhengjie.modules.approval.service.mapstruct.ApproveEventMapper;
|
| | | import me.zhengjie.modules.attendance.domain.AgreeUpdateRequest;
|
| | | import me.zhengjie.modules.attendance.domain.Attendance;
|
| | | import me.zhengjie.modules.attendance.domain.AttendanceCardreplacement;
|
| | | import me.zhengjie.modules.attendance.repository.AttendanceRepository;
|
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceDto;
|
| | | import me.zhengjie.modules.constant.Constant;
|
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService;
|
| | | import me.zhengjie.modules.system.domain.*;
|
| | | import me.zhengjie.modules.system.repository.*;
|
| | | import me.zhengjie.modules.system.service.SysConfigHolidayService;
|
| | |
| | | import java.io.IOException;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import java.util.function.Function;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | /**
|
| | | * @website https://eladmin.vip
|
| | |
| | | private final AttendanceCardreplacementRepository attendanceCardreplacementRepository;
|
| | | private final AttendanceCardreplacementMapper attendanceCardreplacementMapper;
|
| | | private final UserRepository userRepository;
|
| | | private final OpaiDingTalkService opaiDingTalkService;
|
| | | private final RoleRepository roleRepository;
|
| | | private final AttendanceRepository attendanceRepository;
|
| | | private final SysConfigProportionRepository sysConfigProportionRepository;
|
| | | private final DictDetailRepository dictDetailRepository;
|
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository;
|
| | | private final ApproveEventRepository approveEventRepository;
|
| | | private final ApproveEventMapper approveEventMapper;
|
| | | private final TemplateControlFieldService templateControlFieldService;
|
| | |
|
| | | @Override
|
| | | public Map<String,Object> queryAll(AttendanceCardreplacementQueryCriteria criteria, Pageable pageable){
|
| | |
| | | //查询申请人信息
|
| | | User appUser = userRepository.findById(attendanceCardreplacementDto.getApprovalUserId()).orElseGet(User::new);
|
| | | attendanceCardreplacementDto.setAppUserName(appUser.getNickName());
|
| | |
|
| | | // 查询企微最新审批变化记录
|
| | | if (ObjectUtils.isNotEmpty(attendanceCardreplacement.getWecomEventId())) {
|
| | | ApproveEvent event = approveEventRepository.findById(attendanceCardreplacement.getWecomEventId()).orElseGet(ApproveEvent::new);
|
| | | attendanceCardreplacementDto.setEvent(approveEventMapper.toDto(event));
|
| | | }
|
| | |
|
| | | return attendanceCardreplacementDto;
|
| | | }
|
| | | };
|
| | |
| | |
|
| | | resources.setApprovalStatus(Constant.CARD_APPROVE_STATUS_REVIEWED);
|
| | |
|
| | | //发送给审批者
|
| | | List<String> sendList = new ArrayList<>();
|
| | | //查询申请人信息
|
| | | User user = userRepository.getOne(resources.getUserId());
|
| | | //查询审批者信息
|
| | | User appUser = userRepository.getOne(resources.getApprovalUserId());
|
| | | sendList.add(appUser.getDingding());
|
| | | opaiDingTalkService.sendNotice(sendList, "审批提醒", "### 审批提示 \n >" + user.getNickName() + " 提交了补卡审批,请登录PMS系统处理", "card");
|
| | | // 判断是否提交企微审批
|
| | | List<DictDetail> siteTypes = dictDetailRepository.findByDictName(Constant.APPROVAL_SITE_TYPE).stream().filter(siteType -> siteType.getValue().toLowerCase().equals("wecom")).collect(Collectors.toList());
|
| | | if (siteTypes.size() > 0) {
|
| | | // 添加企微申请参数
|
| | | resources.setWecomDateType(ElAdminConstant.Constant.TEMPLATE_DATE_TYPE_HOUR);
|
| | | Map<String, String> cardTypeMap = dictDetailRepository.findByDictName(Constant.CARD_REPLACEMENT_DIFFERENTIATION).stream().collect(Collectors.toMap(DictDetail::getValue, DictDetail::getLabel));
|
| | | resources.setWecomTypeOptionVal(cardTypeMap.get(resources.getCardReplacementDistinguish()));
|
| | | // 提交申请
|
| | | String weComId = userRepository.findById(resources.getUserId()).orElse(new User()).getWeComId();
|
| | | Map<String, String> approvalResultMap = templateControlFieldService.createWecomApproval(resources, weComId);
|
| | | if (approvalResultMap.containsKey("spNo")) {
|
| | | resources.setWecomSpNo(approvalResultMap.get("spNo"));
|
| | | } else {
|
| | | throw new BadRequestException(approvalResultMap.containsKey("error") ? approvalResultMap.get("error") : "企微申请提交失败");
|
| | | }
|
| | | }
|
| | |
|
| | | return attendanceCardreplacementMapper.toDto(attendanceCardreplacementRepository.save(resources));
|
| | | }
|
| | |
|
| | |
| | | /*
|
| | | * Copyright 2019-2020 Zheng Jie
|
| | | *
|
| | | * Licensed under the Apache License, Version 2.0 (the "License");
|
| | | * you may not use this file except in compliance with the License.
|
| | | * You may obtain a copy of the License at
|
| | | *
|
| | | * http://www.apache.org/licenses/LICENSE-2.0
|
| | | *
|
| | | * Unless required by applicable law or agreed to in writing, software
|
| | | * distributed under the License is distributed on an "AS IS" BASIS,
|
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | * Copyright 2019-2020 Zheng Jie
|
| | | *
|
| | | * Licensed under the Apache License, Version 2.0 (the "License");
|
| | | * you may not use this file except in compliance with the License.
|
| | | * You may obtain a copy of the License at
|
| | | *
|
| | | * http://www.apache.org/licenses/LICENSE-2.0
|
| | | *
|
| | | * Unless required by applicable law or agreed to in writing, software
|
| | | * distributed under the License is distributed on an "AS IS" BASIS,
|
| | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| | | * See the License for the specific language governing permissions and
|
| | | * limitations under the License.
|
| | | */
|
| | | package me.zhengjie.modules.attendance.service.impl;
|
| | |
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import me.zhengjie.exception.BadRequestException;
|
| | | import me.zhengjie.modules.approval.domain.ApproveEvent;
|
| | | import me.zhengjie.modules.approval.repository.ApproveEventRepository;
|
| | | import me.zhengjie.modules.approval.service.TemplateControlFieldService;
|
| | | import me.zhengjie.modules.approval.service.mapstruct.ApproveEventMapper;
|
| | | import me.zhengjie.modules.attendance.domain.*;
|
| | | import me.zhengjie.modules.attendance.repository.AttendanceBusinessTravelRepository;
|
| | | import me.zhengjie.modules.attendance.repository.AttendanceGoOutRepository;
|
| | |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceGoOutQueryCriteria;
|
| | | import me.zhengjie.modules.attendance.service.mapstruct.AttendanceGoOutMapper;
|
| | | import me.zhengjie.modules.constant.Constant;
|
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService;
|
| | | import me.zhengjie.modules.quartz.service.impl.WeComServiceImpl;
|
| | | import me.zhengjie.modules.system.domain.DictDetail;
|
| | | import me.zhengjie.modules.system.domain.Role;
|
| | | import me.zhengjie.modules.system.domain.SysRostering;
|
| | | import me.zhengjie.modules.system.domain.User;
|
| | |
| | | import java.time.temporal.ChronoUnit;
|
| | | import java.util.*;
|
| | | import java.util.function.Function;
|
| | | import java.util.stream.Collectors;
|
| | | import java.util.stream.Stream;
|
| | |
|
| | | /**
|
| | | * @website https://eladmin.vip
|
| | | * @description 服务实现
|
| | | * @author wcd
|
| | | * @date 2023-01-04
|
| | | **/
|
| | | * @author wcd
|
| | | * @website https://eladmin.vip
|
| | | * @description 服务实现
|
| | | * @date 2023-01-04
|
| | | **/
|
| | | @Service
|
| | | @RequiredArgsConstructor
|
| | | public class AttendanceGoOutServiceImpl implements AttendanceGoOutService {
|
| | |
| | | private final AttendanceService attendanceService;
|
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository;
|
| | | private final AttendanceLeaveServiceImpl attendanceLeaveService;
|
| | | private final OpaiDingTalkService opaiDingTalkService;
|
| | | private final AttendanceRepository attendanceRepository;
|
| | | private final AttendanceLeaveRepository attendanceLeaveRepository;
|
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository;
|
| | | private final ApproveEventRepository approveEventRepository;
|
| | | private final ApproveEventMapper approveEventMapper;
|
| | | private final DictDetailRepository dictDetailRepository;
|
| | | private final WeComServiceImpl weComService;
|
| | | private final TemplateControlFieldService templateControlFieldService;
|
| | |
|
| | | private final SysConfigHolidayService sysConfigHolidayService;
|
| | |
|
| | | @Override
|
| | | public Map<String,Object> queryAll(AttendanceGoOutQueryCriteria criteria, Pageable pageable){
|
| | | Page<AttendanceGoOut> page = attendanceGoOutRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
| | | public Map<String, Object> queryAll(AttendanceGoOutQueryCriteria criteria, Pageable pageable) {
|
| | | Page<AttendanceGoOut> page = attendanceGoOutRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
|
| | |
|
| | | //将实体转换为Dto(重写)
|
| | | Function<AttendanceGoOut, AttendanceGoOutDto> func = new Function<AttendanceGoOut, AttendanceGoOutDto>(){
|
| | | Function<AttendanceGoOut, AttendanceGoOutDto> func = new Function<AttendanceGoOut, AttendanceGoOutDto>() {
|
| | |
|
| | | @Override
|
| | | public AttendanceGoOutDto apply(AttendanceGoOut attendanceGoOut) {
|
| | |
| | | //查询审批用户名
|
| | | User appUser = userRepository.findById(attendanceGoOutDto.getApprovalUserId()).orElseGet(User::new);
|
| | | attendanceGoOutDto.setAppUserName(appUser.getNickName());
|
| | |
|
| | | // 查询企微最新审批变化记录
|
| | | if (ObjectUtils.isNotEmpty(attendanceGoOut.getWecomEventId())) {
|
| | | ApproveEvent event = approveEventRepository.findById(attendanceGoOut.getWecomEventId()).orElseGet(ApproveEvent::new);
|
| | | attendanceGoOutDto.setEvent(approveEventMapper.toDto(event));
|
| | | }
|
| | |
|
| | | return attendanceGoOutDto;
|
| | | }
|
| | | };
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public List<AttendanceGoOutDto> queryAll(AttendanceGoOutQueryCriteria criteria){
|
| | | public List<AttendanceGoOutDto> queryAll(AttendanceGoOutQueryCriteria criteria) {
|
| | | List<AttendanceGoOutDto> attendanceGoOutDtoList = attendanceGoOutMapper.toDto(attendanceGoOutRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
| | | attendanceGoOutDtoList.forEach(attendanceGoOutDto -> {
|
| | | //查询用户信息
|
| | |
| | | @Transactional
|
| | | public AttendanceGoOutDto findById(Long id) {
|
| | | AttendanceGoOut attendanceGoOut = attendanceGoOutRepository.findById(id).orElseGet(AttendanceGoOut::new);
|
| | | ValidationUtil.isNull(attendanceGoOut.getId(),"AttendanceGoOut","id",id);
|
| | | ValidationUtil.isNull(attendanceGoOut.getId(), "AttendanceGoOut", "id", id);
|
| | | return attendanceGoOutMapper.toDto(attendanceGoOut);
|
| | | }
|
| | |
|
| | |
| | | // Boolean isWeekend = localDate.getDayOfWeek() == DayOfWeek.SATURDAY || localDate.getDayOfWeek() == DayOfWeek.SUNDAY;
|
| | | // if ((sysConfigHolidayDto == null && !isWeekend) ||
|
| | | // sysConfigHolidayDto != null && Constant.DATE_TYPE_WEEKDAY.equals(sysConfigHolidayDto.getDateType())) {
|
| | | AttendanceGoOut attendanceGoOut = new AttendanceGoOut();
|
| | | //resUserId为null说明是添加,反之
|
| | | if (resources.getUserId() == null) {
|
| | | resources.setUserId(user.getId());
|
| | | }
|
| | | resources.setOutStartTime(Timestamp.valueOf(localDate.atTime(startTime)));
|
| | | resources.setOutEndTime(Timestamp.valueOf(localDate.atTime(endTime)));
|
| | | AttendanceGoOut attendanceGoOut = new AttendanceGoOut();
|
| | | //resUserId为null说明是添加,反之
|
| | | if (resources.getUserId() == null) {
|
| | | resources.setUserId(user.getId());
|
| | | }
|
| | | resources.setOutStartTime(Timestamp.valueOf(localDate.atTime(startTime)));
|
| | | resources.setOutEndTime(Timestamp.valueOf(localDate.atTime(endTime)));
|
| | |
|
| | | Double result = getRemainingTime(resources);
|
| | | resources.setOutDuration(result);
|
| | | resources.setApprovalStatus(Constant.GOOUT_APPROVE_STATUS_REVIEWED);
|
| | | attendanceGoOut.copy(resources);
|
| | | attendanceGoOutRepository.save(attendanceGoOut);
|
| | | Double result = getRemainingTime(resources);
|
| | | resources.setOutDuration(result);
|
| | | resources.setApprovalStatus(Constant.GOOUT_APPROVE_STATUS_REVIEWED);
|
| | |
|
| | | // 判断是否提交企微审批
|
| | | List<DictDetail> siteTypes = dictDetailRepository.findByDictName(Constant.APPROVAL_SITE_TYPE).stream().filter(siteType -> siteType.getValue().toLowerCase().equals("wecom")).collect(Collectors.toList());
|
| | | if (siteTypes.size() > 0) {
|
| | | // 添加企微申请参数
|
| | | resources.setWecomType(dictDetailRepository.findByDictNameAndValue("go_out_type", resources.getOutOfOfficeType()).getLabel());
|
| | | resources.setWecomLocation("暂无");
|
| | | resources.setWecomDateType(ElAdminConstant.Constant.TEMPLATE_DATE_TYPE_HOUR);
|
| | | resources.setWecomDuration(String.valueOf(new BigDecimal(resources.getOutDuration()).multiply(new BigDecimal(3600)).longValue()));
|
| | | resources.setWecomAttendanceType("4");
|
| | | // 提交申请
|
| | | String weComId = userRepository.findById(resources.getUserId()).orElse(new User()).getWeComId();
|
| | | Map<String, String> approvalResultMap = templateControlFieldService.createWecomApproval(resources, weComId);
|
| | | if (approvalResultMap.containsKey("spNo")) {
|
| | | resources.setWecomSpNo(approvalResultMap.get("spNo"));
|
| | | } else {
|
| | | throw new BadRequestException(approvalResultMap.containsKey("error") ? approvalResultMap.get("error") : "企微申请提交失败");
|
| | | }
|
| | | }
|
| | |
|
| | | attendanceGoOut.copy(resources);
|
| | | attendanceGoOutRepository.save(attendanceGoOut);
|
| | | // }
|
| | | // SysConfigHolidayDto sysConfigHolidayDto = sysConfigHolidayService.queryByHolidayDate(localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
| | | // Boolean isWeekend = localDate.getDayOfWeek() == DayOfWeek.SATURDAY || localDate.getDayOfWeek() == DayOfWeek.SUNDAY;
|
| | |
| | | // attendanceGoOutRepository.save(attendanceGoOut);
|
| | | // }
|
| | | // }
|
| | | //发送钉钉给审批人
|
| | | List<String> sendList = new ArrayList<>();
|
| | | //查询审批者信息
|
| | | User appUser = userRepository.getOne(resources.getApprovalUserId());
|
| | | sendList.add(appUser.getDingding());
|
| | | opaiDingTalkService.sendNotice(sendList, "审批提醒", "### 审批提示 \n >" + user.getNickName() + " 提交了外出审批,请登录PMS系统处理", "card");
|
| | | }
|
| | | return attendanceGoOutMapper.toDto(resources);
|
| | | }
|
| | |
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void update(AttendanceGoOut resources) {
|
| | | AttendanceGoOut attendanceGoOut = attendanceGoOutRepository.findById(resources.getId()).orElseGet(AttendanceGoOut::new);
|
| | | ValidationUtil.isNull( attendanceGoOut.getId(),"AttendanceGoOut","id",resources.getId());
|
| | | ValidationUtil.isNull(attendanceGoOut.getId(), "AttendanceGoOut", "id", resources.getId());
|
| | | attendanceGoOut.copy(resources);
|
| | |
|
| | | //审核通过或者退回不能修改
|
| | | if(attendanceGoOut.getApprovalStatus().equals(Constant.GOOUT_APPROVE_STATUS_AGREE) || attendanceGoOut.getApprovalStatus().equals(Constant.GOOUT_APPROVE_STATUS_REFUSE)){
|
| | | if (attendanceGoOut.getApprovalStatus().equals(Constant.GOOUT_APPROVE_STATUS_AGREE) || attendanceGoOut.getApprovalStatus().equals(Constant.GOOUT_APPROVE_STATUS_REFUSE)) {
|
| | | throw new BadRequestException("审核通过或退回的不能进行修改");
|
| | | }
|
| | |
|
| | |
| | | User user1 = userRepository.getOne(SecurityUtils.getCurrentUserId());
|
| | | Role role = user1.getRoles().iterator().next();
|
| | | //除超管、总经理只能修改自己信息
|
| | | if(role.getId() != Constant.ROLE_LEVEL_SUPER && role.getId() != Constant.ROLE_LEVEL_GENERAL){
|
| | | if (!Long.valueOf(resources.getUserId()).equals(SecurityUtils.getCurrentUserId())){
|
| | | if (role.getId() != Constant.ROLE_LEVEL_SUPER && role.getId() != Constant.ROLE_LEVEL_GENERAL) {
|
| | | if (!Long.valueOf(resources.getUserId()).equals(SecurityUtils.getCurrentUserId())) {
|
| | | throw new BadRequestException("只能修改自己的记录");
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | /**
|
| | | * 验证其他状态的表是否有重复
|
| | | *
|
| | | * @param goStartTime
|
| | | * @param goEndTime
|
| | | */
|
| | | public void repeatValidation(String goStartTime, String goEndTime, Long userId){
|
| | | public void repeatValidation(String goStartTime, String goEndTime, Long userId) {
|
| | | // 查询请假表(时单位)
|
| | | List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.checkCreateLeaveTime(goStartTime,goEndTime, userId);
|
| | | if(attendanceLeaveList.size() > 0){
|
| | | List<AttendanceLeave> attendanceLeaveList = attendanceLeaveRepository.checkCreateLeaveTime(goStartTime, goEndTime, userId);
|
| | | if (attendanceLeaveList.size() > 0) {
|
| | | AttendanceLeave errorSysAskForLeave = attendanceLeaveList.get(0);
|
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
| | | throw new BadRequestException("请假时间冲突," + errorFormat.format(errorSysAskForLeave.getLeaveStartTime()) + "至" + errorFormat.format(errorSysAskForLeave.getLeaveEndTime())
|
| | | + "已经存在请假记录,请调整时间");
|
| | | }
|
| | | // 查询出差表
|
| | | List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.checkCreateTime(goStartTime.substring(0,10),goEndTime.substring(0,10), userId);
|
| | | if(attendanceBusinessTravelList.size() > 0){
|
| | | List<AttendanceBusinessTravel> attendanceBusinessTravelList = attendanceBusinessTravelRepository.checkCreateTime(goStartTime.substring(0, 10), goEndTime.substring(0, 10), userId);
|
| | | if (attendanceBusinessTravelList.size() > 0) {
|
| | | AttendanceBusinessTravel errorSysAskForLeave = attendanceBusinessTravelList.get(0);
|
| | | SimpleDateFormat errorFormat = new SimpleDateFormat("yyyy年MM月dd日");
|
| | | throw new BadRequestException("出差时间冲突," + errorFormat.format(errorSysAskForLeave.getTravelStartTime()) + "至" + errorFormat.format(errorSysAskForLeave.getTravelEndTime())
|
| | |
| | | //根据id查询记录
|
| | | Optional<AttendanceGoOut> attendanceGoOut = attendanceGoOutRepository.findById(id);
|
| | | //审核通过或者退回不能删除
|
| | | if(attendanceGoOut.get().getApprovalStatus().equals(Constant.GOOUT_APPROVE_STATUS_AGREE) || attendanceGoOut.get().getApprovalStatus().equals(Constant.GOOUT_APPROVE_STATUS_REFUSE)){
|
| | | if (attendanceGoOut.get().getApprovalStatus().equals(Constant.GOOUT_APPROVE_STATUS_AGREE) || attendanceGoOut.get().getApprovalStatus().equals(Constant.GOOUT_APPROVE_STATUS_REFUSE)) {
|
| | | throw new BadRequestException("审核通过或退回的不能进行删除");
|
| | | }
|
| | |
|
| | |
| | | User user = userRepository.getOne(SecurityUtils.getCurrentUserId());
|
| | | Role role = user.getRoles().iterator().next();
|
| | | //除超管、总经理只能删除自己信息
|
| | | if(role.getId() != Constant.ROLE_LEVEL_SUPER && role.getId() != Constant.ROLE_LEVEL_GENERAL){
|
| | | if (!Long.valueOf(attendanceGoOut.get().getUserId()).equals(SecurityUtils.getCurrentUserId())){
|
| | | if (role.getId() != Constant.ROLE_LEVEL_SUPER && role.getId() != Constant.ROLE_LEVEL_GENERAL) {
|
| | | if (!Long.valueOf(attendanceGoOut.get().getUserId()).equals(SecurityUtils.getCurrentUserId())) {
|
| | | throw new BadRequestException("只能删除自己的记录");
|
| | | }
|
| | | }
|
| | |
| | | for (AttendanceGoOutDto attendanceGoOut : all) {
|
| | | String outOfOfficeType = attendanceGoOut.getOutOfOfficeType() != null ? dictDetailRepository.findByDictNameAndValue("go_out_type", attendanceGoOut.getOutOfOfficeType()).getLabel() : "";
|
| | | String outDurationUnit = attendanceGoOut.getDurationUnit() != null ? dictDetailRepository.findByDictNameAndValue(Constant.LEAVE_TIME_TYPE, attendanceGoOut.getDurationUnit()).getLabel() : "";
|
| | | Map<String,Object> map = new LinkedHashMap<>();
|
| | | Map<String, Object> map = new LinkedHashMap<>();
|
| | | map.put("申请者", attendanceGoOut.getUserName());
|
| | | map.put("审批者", attendanceGoOut.getAppUserName());
|
| | | map.put("外出开始时间", attendanceGoOut.getOutStartTime());
|
| | |
| | |
|
| | | /**
|
| | | * 计算外出时长
|
| | | *
|
| | | * @param attendanceGoOut
|
| | | * @return
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 审核/撤销功能
|
| | | *
|
| | | * @param resources /
|
| | | */
|
| | | @Override
|
| | | public void updateApprove(AttendanceGoOut resources) throws Exception {
|
| | | AttendanceGoOut attendanceGoOut = attendanceGoOutRepository.findById(resources.getId()).orElseGet(AttendanceGoOut::new);
|
| | | ValidationUtil.isNull( attendanceGoOut.getId(),"AttendanceGoOut","id",resources.getId());
|
| | | ValidationUtil.isNull(attendanceGoOut.getId(), "AttendanceGoOut", "id", resources.getId());
|
| | | attendanceGoOut.copy(resources);
|
| | | attendanceGoOutRepository.save(attendanceGoOut);
|
| | | // 调用定时任务修改考勤记录
|
| | | List<User> userList = new ArrayList<>();
|
| | | if(ObjectUtils.isNotEmpty(attendanceGoOut.getUserId())){
|
| | | if (ObjectUtils.isNotEmpty(attendanceGoOut.getUserId())) {
|
| | | User user = userRepository.findById(attendanceGoOut.getUserId()).orElseGet(User::new);
|
| | | userList.add(user);
|
| | | }
|
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
| | | String attendanceDate = df.format(attendanceGoOut.getOutStartTime());
|
| | | weComService.getWeComAttendanceListOfNoonOrNight(attendanceDate,userList);
|
| | | weComService.getWeComAttendanceListOfNoonOrNight(attendanceDate, userList);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 批量审核(外出)
|
| | | *
|
| | | * @param request
|
| | | * @throws Exception
|
| | | */
|
| | |
| | | public void updateAgree(AgreeUpdateRequest request) throws Exception {
|
| | | for (Long id : request.getIds()) {
|
| | | AttendanceGoOut attendanceGoOut = attendanceGoOutRepository.findById(id).orElseGet(AttendanceGoOut::new);
|
| | | ValidationUtil.isNull( attendanceGoOut.getId(),"AttendanceGoOut","id",id);
|
| | | if (request.getNum().equals(Long.valueOf(1))){
|
| | | ValidationUtil.isNull(attendanceGoOut.getId(), "AttendanceGoOut", "id", id);
|
| | | if (request.getNum().equals(Long.valueOf(1))) {
|
| | | attendanceGoOut.setApprovalStatus(Constant.GOOUT_APPROVE_STATUS_AGREE);
|
| | | } else {
|
| | | attendanceGoOut.setApprovalStatus(Constant.GOOUT_APPROVE_STATUS_REFUSE);
|
| | |
| | | attendanceGoOutRepository.save(attendanceGoOut);
|
| | | // 调用定时任务修改考勤记录
|
| | | List<User> userList = new ArrayList<>();
|
| | | if(ObjectUtils.isNotEmpty(attendanceGoOut.getUserId())){
|
| | | if (ObjectUtils.isNotEmpty(attendanceGoOut.getUserId())) {
|
| | | User user = userRepository.findById(attendanceGoOut.getUserId()).orElseGet(User::new);
|
| | | userList.add(user);
|
| | | }
|
| | | SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
| | | String attendanceDate = df.format(attendanceGoOut.getOutStartTime());
|
| | | weComService.getWeComAttendanceListOfNoonOrNight(attendanceDate,userList);
|
| | | weComService.getWeComAttendanceListOfNoonOrNight(attendanceDate, userList);
|
| | | }
|
| | | }
|
| | | } |
| | |
| | |
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import me.zhengjie.exception.BadRequestException;
|
| | | import me.zhengjie.modules.approval.domain.ApproveEvent;
|
| | | import me.zhengjie.modules.approval.repository.ApproveEventRepository;
|
| | | import me.zhengjie.modules.approval.service.TemplateControlFieldService;
|
| | | import me.zhengjie.modules.approval.service.TemplateService;
|
| | | import me.zhengjie.modules.approval.service.mapstruct.ApproveEventMapper;
|
| | | import me.zhengjie.modules.attendance.domain.*;
|
| | | import me.zhengjie.modules.attendance.repository.*;
|
| | | import me.zhengjie.modules.attendance.service.AttendanceLeaveService;
|
| | |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceLeaveQueryCriteria;
|
| | | import me.zhengjie.modules.attendance.service.mapstruct.AttendanceLeaveMapper;
|
| | | import me.zhengjie.modules.constant.Constant;
|
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService;
|
| | | import me.zhengjie.modules.quartz.service.impl.WeComServiceImpl;
|
| | | import me.zhengjie.modules.system.domain.*;
|
| | | import me.zhengjie.modules.system.repository.DictDetailRepository;
|
| | |
| | | import java.time.format.DateTimeFormatter;
|
| | | import java.util.*;
|
| | | import java.util.function.Function;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | /**
|
| | | * @author wcd
|
| | | * @website https://eladmin.vip
|
| | | * @description 服务实现
|
| | | * @author wcd
|
| | | * @date 2022-12-16
|
| | | **/
|
| | | @Service
|
| | |
| | | private final AttendanceService attendanceService;
|
| | | private final SysUserLevelOtherRepository sysUserLevelOtherRepository;
|
| | | private final UserRepository userRepository;
|
| | | private final OpaiDingTalkService opaiDingTalkService;
|
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository;
|
| | | private final AttendanceRepository attendanceRepository;
|
| | | private final AttendanceGoOutRepository attendanceGoOutRepository;
|
| | | private final AttendanceBusinessTravelRepository attendanceBusinessTravelRepository;
|
| | | private final AttendanceOvertimeRepository attendanceOvertimeRepository;
|
| | | private final ApproveEventRepository approveEventRepository;
|
| | | private final ApproveEventMapper approveEventMapper;
|
| | | private final WeComServiceImpl weComService;
|
| | | private final TemplateService templateService;
|
| | | private final TemplateControlFieldService templateControlFieldService;
|
| | |
|
| | | @Override
|
| | | public Map<String,Object> queryAll(AttendanceLeaveQueryCriteria criteria, Pageable pageable){
|
| | |
| | | //查询审批用户名
|
| | | User appUser = userRepository.findById(attendanceLeaveDto.getApprovalUserId()).orElseGet(User::new);
|
| | | attendanceLeaveDto.setAppUserName(appUser.getNickName());
|
| | |
|
| | | // 查询企微最新审批变化记录
|
| | | if (ObjectUtils.isNotEmpty(attendanceLeave.getWecomEventId())) {
|
| | | ApproveEvent event = approveEventRepository.findById(attendanceLeave.getWecomEventId()).orElseGet(ApproveEvent::new);
|
| | | attendanceLeaveDto.setEvent(approveEventMapper.toDto(event));
|
| | | }
|
| | |
|
| | | return attendanceLeaveDto;
|
| | | }
|
| | | };
|
| | |
| | | Boolean isWeekend = localDate.getDayOfWeek() == DayOfWeek.SATURDAY || localDate.getDayOfWeek() == DayOfWeek.SUNDAY;
|
| | | // 不是周末并且节假日表中不存在在创建
|
| | | if((!isWeekend && !holiday.contains(date)) || (isWeekend && isWork.contains(date))){
|
| | | AttendanceLeave attendanceLeave = getAttendanceLeave(resources,date,user,i,LeaStartTime,LeaEndTime,null);
|
| | | i++;
|
| | | attendanceLeaveRepository.save(attendanceLeave);
|
| | | AttendanceLeave attendanceLeave = getAttendanceLeave(resources,date,user,i,LeaStartTime,LeaEndTime,null);
|
| | |
|
| | | // 判断是否提交企微审批
|
| | | List<DictDetail> siteTypes = dictDetailRepository.findByDictName(Constant.APPROVAL_SITE_TYPE).stream().filter(siteType -> siteType.getValue().toLowerCase().equals("wecom")).collect(Collectors.toList());
|
| | | if (siteTypes.size() > 0) {
|
| | | // 添加企微申请参数
|
| | | if (resources.getLeaveDurationUnit().equals(Constant.LEAVE_TIME_TYPE_HOUR)) {
|
| | | attendanceLeave.setWecomDateType(ElAdminConstant.Constant.TEMPLATE_DATE_TYPE_HOUR);
|
| | | attendanceLeave.setWecomDuration(String.valueOf(new BigDecimal(attendanceLeave.getLeaveDuration()).multiply(new BigDecimal(3600)).longValue()));
|
| | | } else {
|
| | | attendanceLeave.setWecomDateType(ElAdminConstant.Constant.TEMPLATE_DATE_TYPE_HALFDAY);
|
| | | attendanceLeave.setWecomDuration(String.valueOf(new BigDecimal(attendanceLeave.getLeaveDuration()).multiply(new BigDecimal(86400)).longValue()));
|
| | | }
|
| | | // 添加企微申请参数
|
| | | Map<String, String> leaveTypeMap = dictDetailRepository.findByDictName(Constant.LEAVE_TYPE).stream().collect(Collectors.toMap(DictDetail::getValue, DictDetail::getLabel));
|
| | | attendanceLeave.setWecomOptionKey(templateService.getVacationKey(leaveTypeMap.get(attendanceLeave.getLeaveType())));
|
| | | // 提交申请
|
| | | String weComId = userRepository.findById(resources.getUserId()).orElse(new User()).getWeComId();
|
| | | Map<String, String> approvalResultMap = templateControlFieldService.createWecomApproval(attendanceLeave, weComId);
|
| | | if (approvalResultMap.containsKey("spNo")) {
|
| | | attendanceLeave.setWecomSpNo(approvalResultMap.get("spNo"));
|
| | | } else {
|
| | | throw new BadRequestException(approvalResultMap.containsKey("error") ? approvalResultMap.get("error") : "企微申请提交失败");
|
| | | }
|
| | | }
|
| | |
|
| | | i++;
|
| | | attendanceLeaveRepository.save(attendanceLeave);
|
| | | }
|
| | | }
|
| | | //发送钉钉给审批人
|
| | | List<String> sendList = new ArrayList<>();
|
| | | //查询审批者信息
|
| | | User appUser = userRepository.getOne(resources.getApprovalUserId());
|
| | | sendList.add(appUser.getDingding());
|
| | | opaiDingTalkService.sendNotice(sendList, "审批提醒", "### 审批提示 \n >" + user.getNickName() + " 提交了请假审批,请登录PMS系统处理", "card");
|
| | |
|
| | | return attendanceLeaveMapper.toDto(resources);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 添加多条记录
|
| | | *
|
| | | * @param resources
|
| | | * @param date
|
| | | * @param user
|
| | |
| | |
|
| | | /**
|
| | | * 验证其他状态的表是否有重复
|
| | | *
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @param userId
|
| | |
| | |
|
| | | /**
|
| | | * 获取两个日期之间的所有日期
|
| | | *
|
| | | * @param startTime
|
| | | * @param endTime
|
| | | * @return
|
| | |
| | |
|
| | | /**
|
| | | * 计算请假时长
|
| | | *
|
| | | * @param resources /
|
| | | * @return
|
| | | * @throws Exception
|
| | |
| | |
|
| | | /**
|
| | | * 审核功能
|
| | | *
|
| | | * @param resources /
|
| | | */
|
| | | @Override
|
| | |
| | |
|
| | | /**
|
| | | * 批量审核
|
| | | *
|
| | | * @param request
|
| | | */
|
| | | @Override
|
| | |
| | |
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import me.zhengjie.exception.BadRequestException;
|
| | | import me.zhengjie.modules.approval.domain.ApproveEvent;
|
| | | import me.zhengjie.modules.approval.repository.ApproveEventRepository;
|
| | | import me.zhengjie.modules.approval.service.TemplateControlFieldService;
|
| | | import me.zhengjie.modules.approval.service.mapstruct.ApproveEventMapper;
|
| | | import me.zhengjie.modules.attendance.domain.*;
|
| | | import me.zhengjie.modules.attendance.repository.AttendanceOvertimeRepository;
|
| | | import me.zhengjie.modules.attendance.repository.AttendanceRepository;
|
| | |
| | | import me.zhengjie.modules.attendance.service.dto.AttendanceOvertimeQueryCriteria;
|
| | | import me.zhengjie.modules.attendance.service.mapstruct.AttendanceOvertimeMapper;
|
| | | import me.zhengjie.modules.constant.Constant;
|
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService;
|
| | | import me.zhengjie.modules.system.domain.Role;
|
| | | import me.zhengjie.modules.system.domain.SysConfigHoliday;
|
| | | import me.zhengjie.modules.system.domain.SysRostering;
|
| | | import me.zhengjie.modules.system.domain.User;
|
| | | import me.zhengjie.modules.system.domain.*;
|
| | | import me.zhengjie.modules.system.repository.DictDetailRepository;
|
| | | import me.zhengjie.modules.system.repository.SysConfigHolidayRepository;
|
| | | import me.zhengjie.modules.system.repository.UserRepository;
|
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.function.Function;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | /**
|
| | | * @website https://eladmin.vip
|
| | |
| | | private final AttendanceRepository attendanceRepository;
|
| | | private final DictDetailRepository dictDetailRepository;
|
| | | private final UserRepository userRepository;
|
| | | private final OpaiDingTalkService opaiDingTalkService;
|
| | | private final SysConfigHolidayRepository sysConfigHolidayRepository;
|
| | | private final ApproveEventRepository approveEventRepository;
|
| | | private final ApproveEventMapper approveEventMapper;
|
| | | private final TemplateControlFieldService templateControlFieldService;
|
| | |
|
| | | @Override
|
| | | public Map<String,Object> queryAll(AttendanceOvertimeQueryCriteria criteria, Pageable pageable){
|
| | |
| | | //查询审批用户名
|
| | | User appUser = userRepository.findById(attendanceOvertimeDto.getApprovalUserId()).orElseGet(User::new);
|
| | | attendanceOvertimeDto.setAppUserName(appUser.getNickName());
|
| | |
|
| | | // 查询企微最新审批变化记录
|
| | | if (ObjectUtils.isNotEmpty(attendanceOvertime.getWecomEventId())) {
|
| | | ApproveEvent event = approveEventRepository.findById(attendanceOvertime.getWecomEventId()).orElseGet(ApproveEvent::new);
|
| | | attendanceOvertimeDto.setEvent(approveEventMapper.toDto(event));
|
| | | }
|
| | |
|
| | | return attendanceOvertimeDto;
|
| | | }
|
| | | };
|
| | |
| | | resources.setDateType(Constant.DATE_TYPE_WEEKEND);
|
| | | }
|
| | | resources.setApprovalStatus(Constant.OVERTIME_APPROVAL);
|
| | | try {
|
| | | //发送给审批者
|
| | | List<String> sendList = new ArrayList<>();
|
| | | //查询申请人信息
|
| | | User user = userRepository.getOne(resources.getUserId());
|
| | | //查询审批者信息
|
| | | User appUser = userRepository.getOne(resources.getApprovalUserId());
|
| | | sendList.add(appUser.getDingding());
|
| | | opaiDingTalkService.sendNotice(sendList, "审批提醒", "### 审批提示 \n >" + user.getNickName() + " 提交了加班审批,请登录PMS系统处理", "card");
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | |
|
| | | // 判断是否提交企微审批
|
| | | List<DictDetail> siteTypes = dictDetailRepository.findByDictName(Constant.APPROVAL_SITE_TYPE).stream().filter(siteType -> siteType.getValue().toLowerCase().equals("wecom")).collect(Collectors.toList());
|
| | | if (siteTypes.size() > 0) {
|
| | | // 添加企微申请参数
|
| | | resources.setWecomDateType(ElAdminConstant.Constant.TEMPLATE_DATE_TYPE_HOUR);
|
| | | resources.setWecomDuration(String.valueOf(new BigDecimal(resources.getOvertimeDuration()).multiply(new BigDecimal(3600)).longValue()));
|
| | | resources.setWecomAttendanceType("5");
|
| | | // 提交申请
|
| | | String weComId = userRepository.findById(resources.getUserId()).orElse(new User()).getWeComId();
|
| | | Map<String, String> approvalResultMap = templateControlFieldService.createWecomApproval(resources, weComId);
|
| | | if (approvalResultMap.containsKey("spNo")) {
|
| | | resources.setWecomSpNo(approvalResultMap.get("spNo"));
|
| | | } else {
|
| | | throw new BadRequestException(approvalResultMap.containsKey("error") ? approvalResultMap.get("error") : "企微申请提交失败");
|
| | | }
|
| | | }
|
| | |
|
| | | return attendanceOvertimeMapper.toDto(attendanceOvertimeRepository.save(resources));
|
| | | }
|
| | |
|
| | |
| | | public static final String RECOVERY_STATUS_NORMAL = "recovery_status_normal";
|
| | | // 钱款缴纳状态:放弃
|
| | | public static final String RECOVERY_STATUS_ABANDON = "recovery_status_abandon";
|
| | |
|
| | | // 企微请假类型
|
| | | public static final String WECOM_LEAVE_TYPE = "wecom_leave_type";
|
| | | // 企微请假类型描述
|
| | | public static final String WECOM_LEAVE_TYPE_DESCRIPTION = "企微请假类型";
|
| | |
|
| | | // 申请审核站点
|
| | | public static final String APPROVAL_SITE_TYPE = "approval_site_type";
|
| | | }
|
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class Applyer { |
| | | @SerializedName("UserId") |
| | | private String userId; |
| | | |
| | | @SerializedName("Party") |
| | | private String party; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class ApprovalInfo { |
| | | @SerializedName("SpStatus") |
| | | private Integer spStatus; |
| | | |
| | | @SerializedName("ApplyTime") |
| | | private String applyTime; |
| | | |
| | | @SerializedName("ProcessList") |
| | | private List<ProcessList> processList; |
| | | |
| | | @SerializedName("StatuChangeEvent") |
| | | private Integer statuChangeEvent; |
| | | |
| | | @SerializedName("SpRecord") |
| | | private List<SpRecord> spRecord; |
| | | |
| | | @SerializedName("SpNo") |
| | | private String spNo; |
| | | |
| | | @SerializedName("SpName") |
| | | private String spName; |
| | | |
| | | @SerializedName("Applyer") |
| | | private Applyer applyer; |
| | | |
| | | @SerializedName("TemplateId") |
| | | private String templateId; |
| | | |
| | | @SerializedName("Notifyer") |
| | | private List<Notifyer> notifyer; |
| | | |
| | | @SerializedName("Comments") |
| | | private List<Comments> comments; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class ApprovalSend { |
| | | @SerializedName("ApprovalInfo") |
| | | private ApprovalInfo approvalInfo; |
| | | |
| | | @SerializedName("CreateTime") |
| | | private String createTime; |
| | | |
| | | @SerializedName("Event") |
| | | private String event; |
| | | |
| | | @SerializedName("ToUserName") |
| | | private String toUserName; |
| | | |
| | | @SerializedName("FromUserName") |
| | | private String fromUserName; |
| | | |
| | | @SerializedName("MsgType") |
| | | private String msgType; |
| | | |
| | | @SerializedName("AgentID") |
| | | private String agentId; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class Approver { |
| | | @SerializedName("UserId") |
| | | private String userId; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class CommentUserInfo { |
| | | @SerializedName("UserId") |
| | | private String userId; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class Comments { |
| | | @SerializedName("CommentUserInfo") |
| | | private CommentUserInfo commentUserInfo; |
| | | |
| | | @SerializedName("CommentTime") |
| | | private String commentTime; |
| | | |
| | | @SerializedName("CommentContent") |
| | | private String commentContent; |
| | | |
| | | @SerializedName("CommentId") |
| | | private String commentId; |
| | | |
| | | @SerializedName("Attach") |
| | | private String attach; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class Details { |
| | | @SerializedName("SpStatus") |
| | | private Integer spStatus; |
| | | |
| | | @SerializedName("Speech") |
| | | private String speech; |
| | | |
| | | @SerializedName("Approver") |
| | | private Approver approver; |
| | | |
| | | @SerializedName("SpTime") |
| | | private String spTime; |
| | | |
| | | @SerializedName("MediaId") |
| | | private String mediaId; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class NodeList { |
| | | @SerializedName("NodeType") |
| | | private Integer nodeType; |
| | | |
| | | @SerializedName("SpStatus") |
| | | private Integer spStatus; |
| | | |
| | | @SerializedName("ApvRel") |
| | | private Integer apvRel; |
| | | |
| | | @SerializedName("SubNodeList") |
| | | private List<SubNode> subNodeList; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class Notifyer { |
| | | @SerializedName("UserId") |
| | | private String userId; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class ProcessList { |
| | | @SerializedName("NodeList") |
| | | private List<NodeList> nodeList; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class SpRecord { |
| | | @SerializedName("SpStatus") |
| | | private Integer spStatus; |
| | | |
| | | @SerializedName("ApproverAttr") |
| | | private Integer approverAttr; |
| | | |
| | | @SerializedName("Details") |
| | | private List<Details> details; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class SubNode { |
| | | @SerializedName("Sptime") |
| | | private Integer spTime; |
| | | |
| | | @SerializedName("Speech") |
| | | private String speech; |
| | | |
| | | @SerializedName("SpYj") |
| | | private Integer spYj; |
| | | |
| | | @SerializedName("UserInfo") |
| | | private UserInfo userInfo; |
| | | |
| | | @SerializedName("MediaIds") |
| | | private String mediaIds; |
| | | } |
| New file |
| | |
| | | package me.zhengjie.modules.temp.service.dto.wecom; |
| | | |
| | | import com.google.gson.annotations.SerializedName; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | |
| | | @Getter |
| | | @Setter |
| | | public class UserInfo { |
| | | @SerializedName("UserId") |
| | | private String userId; |
| | | } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/template', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/template/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/template', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function queryTemplate(data) { |
| | | return request({ |
| | | url: 'api/template/queryWeComTemplate', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, queryTemplate } |
| New file |
| | |
| | | import request from '@/utils/request' |
| | | import qs from 'qs' |
| | | |
| | | export function add(data) { |
| | | return request({ |
| | | url: 'api/templateControlField', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function del(ids) { |
| | | return request({ |
| | | url: 'api/templateControlField/', |
| | | method: 'delete', |
| | | data: ids |
| | | }) |
| | | } |
| | | |
| | | export function edit(data) { |
| | | return request({ |
| | | url: 'api/templateControlField', |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function bind(data) { |
| | | return request({ |
| | | url: 'api/templateControlField/bind', |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | |
| | | export function queryByTable(params) { |
| | | return request({ |
| | | url: 'api/templateControlField/queryByTable?' + qs.stringify(params, { indices: false }), |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export function editWecomVacationType() { |
| | | return request({ |
| | | url: 'api/templateControlField/editWecomVacationType', |
| | | method: 'post' |
| | | }) |
| | | } |
| | | |
| | | export function editApprovalSite(params) { |
| | | return request({ |
| | | url: 'api/templateControlField/editApprovalSite?' + qs.stringify(params, { indices: false }), |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | export default { add, edit, del, bind, queryByTable } |
| New file |
| | |
| | | <template> |
| | | <div> |
| | | <el-timeline> |
| | | <el-timeline-item v-for="(node, index) in nodeList" :key="index"> |
| | | <div v-if="node.NodeType && node.NodeType === 1 && node.SubNodeList" class="flex-column gap-10"> |
| | | <div class="flex-row gap-10 weight-600"> |
| | | <div class="flex-row align-center">审批人</div> |
| | | <div class="flex-row align-center"> |
| | | <span>{{ spStatusMap[node.SpStatus] || '其他' }}</span> |
| | | </div> |
| | | <div> |
| | | <el-tag size="mini">{{ apvRelMap[node.ApvRel] || '其他' }}</el-tag> |
| | | </div> |
| | | </div> |
| | | <div v-for="(subNode, subIndex) in node.SubNodeList" :key="'sub_node_' + index + '_' + subIndex" class="jkl"> |
| | | <div v-if="subNode.UserInfo && subNode.UserInfo.UserId"> |
| | | <div class="flex-row gap-10 align-center between"> |
| | | <div class="flex-row gap-10 align-center"> |
| | | <el-badge is-dot type="success" :hidden="node.ApvRel !== 2 || (node.ApvRel === 2 && node.SpStatus !== subNode.SpYj)"> |
| | | <div class="header">{{ getFirstChar(userNameMap[subNode.UserInfo.UserId] || subNode.UserInfo.UserId) }}</div> |
| | | </el-badge> |
| | | <div class="name">{{ userNameMap[subNode.UserInfo.UserId] || subNode.UserInfo.UserId }}</div> |
| | | </div> |
| | | <div class="flex-row gap-10 align-center"> |
| | | <div class="status">{{ node.ApvRel === 2 && node.SpStatus !== subNode.SpYj ? '' : (subSpStatusMap[subNode.SpYj] || '其他') }}</div> |
| | | <div class="time">{{ subNode.Sptime > 0 ? parseTime(subNode.Sptime, '{y}/{m}/{d} {h}:{i}') : '' }}</div> |
| | | </div> |
| | | </div> |
| | | <div v-show="subNode.Speech && subNode.Speech.length > 0" class="comment"> |
| | | <div>{{ subNode.Speech }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div v-else-if="node.NodeType && node.NodeType === 2 && node.SubNodeList" class="flex-column gap-10"> |
| | | <div class="flex-row gap-10 weight-600"> |
| | | <div class="flex-row align-center">抄送人</div> |
| | | <div class="flex-row align-center"> |
| | | <span>{{ node.SubNodeList.length > 0 && node.SubNodeList[0].Sptime ? '已抄送' : '' }}</span> |
| | | </div> |
| | | </div> |
| | | <div v-for="(subNode, subIndex) in node.SubNodeList" :key="'sub_node_' + index + '_' + subIndex"> |
| | | <div v-if="subNode.UserInfo && subNode.UserInfo.UserId"> |
| | | <div class="flex-row gap-10 align-center between"> |
| | | <div class="flex-row gap-10 align-center"> |
| | | <div class="header">{{ getFirstChar(userNameMap[subNode.UserInfo.UserId] || subNode.UserInfo.UserId) }}</div> |
| | | <div class="name">{{ userNameMap[subNode.UserInfo.UserId] || subNode.UserInfo.UserId }}</div> |
| | | </div> |
| | | <div class="flex-row gap-10 align-center"> |
| | | <div class="status">{{ subNode.Sptime ? '已抄送' : '' }}</div> |
| | | <div class="time">{{ subNode.Sptime > 0 ? parseTime(subNode.Sptime, '{y}/{m}/{d} {h}:{i}') : '' }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div v-else-if="node.NodeType && node.NodeType === 3 && node.SubNodeList" class="flex-column gap-10"> |
| | | <div class="flex-row gap-10 weight-600"> |
| | | <div class="flex-row align-center">办理人</div> |
| | | <div class="flex-row align-center"> |
| | | <span>{{ node.SubNodeList.length > 0 && node.SubNodeList[0].Sptime ? '已办理' : '' }}</span> |
| | | </div> |
| | | </div> |
| | | <div v-for="(subNode, subIndex) in node.SubNodeList" :key="'sub_node_' + index + '_' + subIndex"> |
| | | <div v-if="subNode.UserInfo && subNode.UserInfo.UserId"> |
| | | <div class="flex-row gap-10 align-center between"> |
| | | <div class="flex-row gap-10 align-center"> |
| | | <div class="header">{{ getFirstChar(userNameMap[subNode.UserInfo.UserId] || subNode.UserInfo.UserId) }}</div> |
| | | <div class="name">{{ userNameMap[subNode.UserInfo.UserId] || subNode.UserInfo.UserId }}</div> |
| | | </div> |
| | | <div class="flex-row gap-10 align-center"> |
| | | <div class="status">{{ subNode.Sptime ? '已办理' : '' }}</div> |
| | | <div class="time">{{ subNode.Sptime > 0 ? parseTime(subNode.Sptime, '{y}/{m}/{d} {h}:{i}') : '' }}</div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | <div v-else>暂无</div> |
| | | </el-timeline-item> |
| | | </el-timeline> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { parseTime } from '@/utils/index' |
| | | |
| | | export default { |
| | | props: { |
| | | eventData: { |
| | | type: Object, |
| | | default: () => { return {} } |
| | | }, |
| | | userList: { |
| | | type: Array, |
| | | default: () => { return [] } |
| | | } |
| | | }, |
| | | data() { |
| | | return { |
| | | spStatusMap: { |
| | | 1: '审批中', |
| | | 2: '已同意', |
| | | 3: '已驳回', |
| | | 4: '已转审', |
| | | 11: '退回至指定审批人', |
| | | 12: '加签', |
| | | 13: '同意并加签', |
| | | 14: '已办理', |
| | | 15: '已转交' |
| | | }, |
| | | apvRelMap: { |
| | | 1: '会签', |
| | | 2: '或签', |
| | | 3: '依次审批' |
| | | }, |
| | | subSpStatusMap: { |
| | | 1: '审批中', |
| | | 2: '已同意', |
| | | 3: '已驳回', |
| | | 4: '已转审', |
| | | 11: '退回至指定审批人', |
| | | 12: '加签', |
| | | 13: '同意并加签', |
| | | 14: '已办理', |
| | | 15: '已转交' |
| | | } |
| | | } |
| | | }, |
| | | computed: { |
| | | nodeList() { |
| | | const that = this |
| | | if (that.eventData.processList) { |
| | | const processList = JSON.parse(that.eventData.processList) |
| | | return processList[0].NodeList ? processList[0].NodeList.map((item, index) => { |
| | | if (item.NodeType && item.NodeType === 2) { |
| | | if (index === 0) { |
| | | const subNodeList = item.SubNodeList.map(subItem => { |
| | | return { |
| | | ...subItem, |
| | | Sptime: that.eventData.applyTime |
| | | } |
| | | }) |
| | | return { ...item, SubNodeList: subNodeList } |
| | | } else { |
| | | let subNodeList = item.SubNodeList |
| | | for (let i = index; i >= 0; i--) { |
| | | if (processList[0].NodeList[i].NodeType && processList[0].NodeList[i].NodeType === 1) { |
| | | if (processList[0].NodeList[i].SpStatus === 2) { |
| | | const filterSubNodeList = processList[0].NodeList[i].SubNodeList.filter(subItem => subItem.SpYj === 2) |
| | | if (filterSubNodeList.length > 0) { |
| | | subNodeList = item.SubNodeList.map(subItem => { |
| | | return { |
| | | ...subItem, |
| | | Sptime: filterSubNodeList[0].Sptime |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | break |
| | | } else if (i === 0) { |
| | | subNodeList = item.SubNodeList.map(subItem => { |
| | | return { |
| | | ...subItem, |
| | | Sptime: that.eventData.applyTime |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | return { ...item, SubNodeList: subNodeList } |
| | | } |
| | | } else { |
| | | return item |
| | | } |
| | | }) : [] |
| | | } else { |
| | | return [] |
| | | } |
| | | }, |
| | | userNameMap() { |
| | | const that = this |
| | | const userNameMap = {} |
| | | that.userList.forEach(item => { |
| | | if (item.weComId) { |
| | | userNameMap[item.weComId] = item.nickName |
| | | } |
| | | }) |
| | | return userNameMap |
| | | } |
| | | }, |
| | | methods: { |
| | | parseTime, |
| | | |
| | | // 获取名称第一个字 |
| | | getFirstChar(str) { |
| | | return str ? str.charAt(0) : '无' |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .flex-row { |
| | | display: flex; |
| | | flex-direction: row; |
| | | } |
| | | .flex-column { |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | .between { |
| | | justify-content: space-between; |
| | | } |
| | | .gap-10 { |
| | | gap: 10px; |
| | | } |
| | | .weight-600 { |
| | | font-weight: 600; |
| | | } |
| | | .align-center { |
| | | align-items: center; |
| | | } |
| | | .header { |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | background-color: #1890ff; |
| | | color: #FFFFFF; |
| | | width: 30px; |
| | | height: 30px; |
| | | border-radius: 5px; |
| | | } |
| | | .comment { |
| | | padding: 10px; |
| | | background-color: #f0f2f5; |
| | | border-radius: 5px; |
| | | margin-top: 10px; |
| | | } |
| | | </style> |
| | |
| | | // 钱款缴纳状态 |
| | | export const RECOVERY_STATUS = 'recovery_status' |
| | | |
| | | // 企微审批字段绑定:请假字段绑定 |
| | | export const WECOM_BIND_LEAVE = 'AttendanceLeave' |
| | | // 企微审批字段绑定:外出字段绑定 |
| | | export const WECOM_BIND_GOOUT = 'AttendanceGoOut' |
| | | // 企微审批字段绑定:出差字段绑定 |
| | | export const WECOM_BIND_TRAVEL = 'AttendanceBusinessTravel' |
| | | // 企微审批字段绑定:换休字段绑定 |
| | | export const WECOM_BIND_OVERTIME = 'AttendanceOvertime' |
| | | // 企微审批字段绑定:补卡字段绑定 |
| | | export const WECOM_BIND_REPLACEMENT = 'AttendanceCardreplacement' |
| | | // 申请审核站点 |
| | | export const APPROVAL_SITE_TYPE = 'approval_site_type' |
| | | |
| | | export default { |
| | | ROLE_LEVEL_SUPER, |
| | | ROLE_LEVEL_GENERAL, |
| | |
| | | OVERTIME_PASS, |
| | | OVERTIME_RETURN, |
| | | BUSINESS_TRAVEL_CATEGORY, |
| | | RECOVERY_STATUS |
| | | RECOVERY_STATUS, |
| | | WECOM_BIND_LEAVE, |
| | | WECOM_BIND_GOOUT, |
| | | WECOM_BIND_TRAVEL, |
| | | WECOM_BIND_OVERTIME, |
| | | WECOM_BIND_REPLACEMENT, |
| | | APPROVAL_SITE_TYPE |
| | | } |
| | |
| | | clearable |
| | | placeholder="请选择" |
| | | style="width: 340px;" |
| | | :disabled="disabledUser(form)" |
| | | :disabled="disabledUser(form) || form.wecomSpNo !== null" |
| | | > |
| | | <el-option |
| | | v-for="item in users" |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批者" prop="approvalUserId"> |
| | | <el-form-item label="审批者" prop="approvalUserId" :hidden="form.wecomSpNo !== null || (form.id == null && wecomApprovalVisible)"> |
| | | <el-select |
| | | v-model="form.approvalUserId" |
| | | filterable |
| | |
| | | style="width: 340px;" |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | > |
| | | <el-option |
| | |
| | | }" |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | @change="checkTime" |
| | | /> |
| | |
| | | }" |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | @change="checkTime" |
| | | /> |
| | |
| | | style="width: 340px;" |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | /> |
| | | </el-form-item> |
| | |
| | | style="width: 340px;" |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | /> |
| | | </el-form-item> |
| | |
| | | style="width: 340px;" |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | /> |
| | | </el-form-item> |
| | |
| | | style="width: 340px;" |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | > |
| | | <el-option |
| | |
| | | style="width: 340px;" |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | /> |
| | | </el-form-item> |
| | |
| | | show-overflow-tooltip |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.appUserName }}</el-tag> |
| | | <el-popover |
| | | v-if="scope.row.wecomSpNo && scope.row.event" |
| | | placement="right-start" |
| | | width="600" |
| | | trigger="click" |
| | | > |
| | | <approvalLine :event-data="scope.row.event" :user-list="users" /> |
| | | <el-tag slot="reference" effect="dark"> |
| | | <i class="el-icon-search" /> |
| | | <span>详细</span> |
| | | </el-tag> |
| | | </el-popover> |
| | | |
| | | <el-tag v-else-if="scope.row.appUserName">{{ scope.row.appUserName }}</el-tag> |
| | | <el-tag v-else>暂无</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo" |
| | | v-permission="permission.approve" |
| | | :loading="crud.status.cu === 2" |
| | | size="mini" |
| | |
| | | >确定</el-button> |
| | | </div> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo" |
| | | slot="reference" |
| | | v-permission="permission.approve" |
| | | type="danger" |
| | |
| | | >撤销 |
| | | </el-button> |
| | | </el-popover> |
| | | <el-link v-if="scope.row.wecomSpNo" type="primary">请前往企微审核</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <udOperation :data="scope.row" :permission="permission" /> |
| | | <udOperation v-if="!scope.row.wecomSpNo" :data="scope.row" :permission="permission" /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import approvalLine from '@/components/ApprovalLine' |
| | | import constant from '../../../utils/constant' |
| | | |
| | | const defaultForm = { |
| | |
| | | createBy: null, |
| | | createTime: null, |
| | | updateBy: null, |
| | | updateTime: null |
| | | updateTime: null, |
| | | wecomSpNo: null, |
| | | event: null |
| | | } |
| | | export default { |
| | | name: 'AttendanceBusinessTravel', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | components: { pagination, crudOperation, rrOperation, udOperation, approvalLine }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ |
| | |
| | | }) |
| | | }, |
| | | // 数据字典constant |
| | | dicts: [constant.BUSSINESS_APPROVE_STATUS, constant.LEAVE_TIME_TYPE, constant.BUSINESS_TRAVEL_CATEGORY], |
| | | dicts: [constant.BUSSINESS_APPROVE_STATUS, constant.LEAVE_TIME_TYPE, constant.BUSINESS_TRAVEL_CATEGORY, constant.APPROVAL_SITE_TYPE], |
| | | data() { |
| | | return { |
| | | permission: { |
| | |
| | | dictLeaveTimeTypeDay: constant.LEAVE_TIME_TYPE_DAY, |
| | | dictLeaveTimeType: constant.LEAVE_TIME_TYPE, |
| | | dictBusinessTravelCategory: constant.BUSINESS_TRAVEL_CATEGORY, |
| | | dictApprovalSiteType: constant.APPROVAL_SITE_TYPE, |
| | | makeUpCardVisible: false, |
| | | successLoading: false, |
| | | userRolesLevelMin: null, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // 角色级别: 总经理 |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL, |
| | | // 企微审核判断 |
| | | wecomApprovalVisible: false |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['user']) |
| | | }, |
| | | created() { |
| | | this.getUsers() |
| | | this.getApprovalUsers() |
| | | const that = this |
| | | that.getUsers() |
| | | that.getApprovalUsers() |
| | | that.$on('dictReady', () => { |
| | | const dictData = { ...that.dict } |
| | | const filterData = dictData[constant.APPROVAL_SITE_TYPE].filter(item => item.value.toLowerCase() === 'wecom') |
| | | if (filterData.length > 0) { |
| | | that.wecomApprovalVisible = true |
| | | } |
| | | }) |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | | |
| | | if (this.wecomApprovalVisible) { |
| | | this.form.approvalUserId = 0 |
| | | } |
| | | }, |
| | | // 禁用 |
| | |
| | | // 循环数据 |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | if (data[i].wecomSpNo) { |
| | | continue |
| | | } |
| | | ids.push(data[i].id) |
| | | } |
| | | crudAttendanceBusinessTravel |
| | |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="申请人" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="disabledUser(form)"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 370px;" :disabled="disabledUser(form) || form.wecomSpNo !== null"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批者" prop="approvalUserId"> |
| | | <el-select v-model="form.approvalUserId" clearable filterable placeholder="请选择" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse"> |
| | | <el-form-item label="审批者" prop="approvalUserId" :hidden="form.wecomSpNo !== null || (form.id == null && wecomApprovalVisible)"> |
| | | <el-select v-model="form.approvalUserId" clearable filterable placeholder="请选择" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse || form.wecomSpNo !== null"> |
| | | <el-option |
| | | v-for="item in approvalUsers" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="补卡区分" prop="cardReplacementDistinguish"> |
| | | <el-select v-model="form.cardReplacementDistinguish" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse"> |
| | | <el-select v-model="form.cardReplacementDistinguish" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse || form.wecomSpNo !== null"> |
| | | <el-option |
| | | v-for="item in dict[dictCardReplacement]" |
| | | :key="item.value" |
| | |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | align="right" |
| | | :default-time="form.cardReplacementDistinguish === 'card_replacement_differentiation_goOn' ? $store.state.user.user.sysRostering.workStartTime + ':00' : $store.state.user.user.sysRostering.workEndTime + ':00'" |
| | | :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse" |
| | | :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse || form.wecomSpNo !== null" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="补卡原因"> |
| | | <el-input v-model="form.cardReplacementReason" type="textarea" rows="3" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse" /> |
| | | <el-input v-model="form.cardReplacementReason" type="textarea" rows="3" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse || form.wecomSpNo !== null" /> |
| | | </el-form-item> |
| | | <el-form-item v-if="form.id !== null" label="审批状态" prop="approvalStatus"> |
| | | <el-select v-model="form.approvalStatus" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse"> |
| | | <el-select v-model="form.approvalStatus" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse || form.wecomSpNo !== null"> |
| | | <el-option |
| | | v-for="item in dict[dictCardApproveStatus]" |
| | | :key="item.value" |
| | |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 370px;" disabled /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse" /> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 370px;" :disabled="form.approvalStatus == dictCardApproveStatusAgree || form.approvalStatus == dictCardApproveStatusRefuse || form.wecomSpNo !== null" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="appUserName" label="审批者" min-width="100" show-overflow-tooltip fixed="left"> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.appUserName }}</el-tag> |
| | | <el-popover |
| | | v-if="scope.row.wecomSpNo && scope.row.event" |
| | | placement="right-start" |
| | | width="600" |
| | | trigger="click" |
| | | > |
| | | <approvalLine :event-data="scope.row.event" :user-list="users" /> |
| | | <el-tag slot="reference" effect="dark"> |
| | | <i class="el-icon-search" /> |
| | | <span>详细</span> |
| | | </el-tag> |
| | | </el-popover> |
| | | |
| | | <el-tag v-else-if="scope.row.appUserName">{{ scope.row.appUserName }}</el-tag> |
| | | <el-tag v-else>暂无</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="cardReplacementTime" label="补卡时间" min-width="140" show-overflow-tooltip /> |
| | |
| | | <el-table-column v-if="checkPer(['admin','attendanceCardreplacement:approve'])" label="审核操作" width="180px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo" |
| | | v-permission="permission.approve" |
| | | :loading="crud.status.cu === 2" |
| | | size="mini" |
| | |
| | | <el-button :loading="crud.status.cu === 2" type="primary" size="mini" @click="revoke(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo" |
| | | slot="reference" |
| | | v-permission="permission.approve" |
| | | type="danger" |
| | |
| | | >撤销 |
| | | </el-button> |
| | | </el-popover> |
| | | <el-link v-if="scope.row.wecomSpNo" type="primary">请前往企微审核</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','attendanceCardreplacement:edit','attendanceCardreplacement:del'])" label="操作" width="150px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | v-if="!scope.row.wecomSpNo" |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import approvalLine from '@/components/ApprovalLine' |
| | | import constant from '../../../utils/constant' |
| | | |
| | | const defaultForm = { id: null, userId: null, userName: null, approvalUserId: null, cardReplacementTime: null, cardReplacementReason: null, approvalStatus: null, approvalDescription: null, cardReplacementDistinguish: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, userId: null, userName: null, approvalUserId: null, cardReplacementTime: null, cardReplacementReason: null, approvalStatus: null, approvalDescription: null, cardReplacementDistinguish: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, wecomSpNo: null, event: null } |
| | | export default { |
| | | name: 'AttendanceCardreplacement', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | components: { pagination, crudOperation, rrOperation, udOperation, approvalLine }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | // 数据字典 |
| | | dicts: [constant.CARD_REPLACEMENT_DIFFERENTIATION, constant.CARD_APPROVE_STATUS], |
| | | dicts: [constant.CARD_REPLACEMENT_DIFFERENTIATION, constant.CARD_APPROVE_STATUS, constant.APPROVAL_SITE_TYPE], |
| | | cruds() { |
| | | return CRUD({ title: '补卡记录', url: 'api/attendanceCardreplacement', idField: 'id', sort: 'cardReplacementTime,desc', crudMethod: { ...crudAttendanceCardreplacement }}) |
| | | }, |
| | |
| | | dictCardApproveStatusAgree: constant.CARD_APPROVE_STATUS_AGREE, |
| | | dictCardApproveStatusRefuse: constant.CARD_APPROVE_STATUS_REFUSE, |
| | | dictCardReplacement: constant.CARD_REPLACEMENT_DIFFERENTIATION, |
| | | dictApprovalSiteType: constant.APPROVAL_SITE_TYPE, |
| | | userRolesLevelMin: null, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // 角色级别: 总经理 |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL } |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL, |
| | | // 企微审核判断 |
| | | wecomApprovalVisible: false |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | |
| | | // } |
| | | // } |
| | | // }, |
| | | created() { |
| | | const that = this |
| | | that.$on('dictReady', () => { |
| | | const dictData = { ...that.dict } |
| | | const filterData = dictData[constant.APPROVAL_SITE_TYPE].filter(item => item.value.toLowerCase() === 'wecom') |
| | | if (filterData.length > 0) { |
| | | that.wecomApprovalVisible = true |
| | | } |
| | | }) |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | | |
| | | if (this.wecomApprovalVisible) { |
| | | this.form.approvalUserId = 0 |
| | | } |
| | | }, |
| | | // 禁用 |
| | |
| | | // 循环数据 |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | if (data[i].wecomSpNo) { |
| | | continue |
| | | } |
| | | ids.push(data[i].id) |
| | | } |
| | | crudAttendanceCardreplacement.updateAgree({ |
| | |
| | | clearable |
| | | placeholder="请选择" |
| | | style="width: 340px;" |
| | | :disabled="disabledUser(form)" |
| | | :disabled="disabledUser(form) || form.wecomSpNo !== null" |
| | | > |
| | | <el-option |
| | | v-for="item in users" |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批者" prop="approvalUserId"> |
| | | <el-form-item label="审批者" prop="approvalUserId" :hidden="form.wecomSpNo !== null || (form.id == null && wecomApprovalVisible)"> |
| | | <el-select |
| | | v-model="form.approvalUserId" |
| | | filterable |
| | |
| | | style="width: 340px;" |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | > |
| | | <el-option |
| | |
| | | clearable |
| | | placeholder="请选择" |
| | | style="width: 340px;" |
| | | :disabled="form.wecomSpNo !== null" |
| | | > |
| | | <el-option |
| | | v-for="item in dict[dictGoOutTypr]" |
| | |
| | | " |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | @change="checkTime" |
| | | /> |
| | |
| | | " |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | @change="checkTime" |
| | | /> |
| | |
| | | style="width: 340px;" |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | /> |
| | | </el-form-item> |
| | |
| | | style="width: 340px;" |
| | | :disabled=" |
| | | form.approvalStatus == dictGoOutAgree || |
| | | form.approvalStatus == dictGoOutReturn |
| | | form.approvalStatus == dictGoOutReturn || |
| | | form.wecomSpNo !== null |
| | | " |
| | | /> |
| | | </el-form-item> |
| | |
| | | show-overflow-tooltip |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.appUserName }}</el-tag> |
| | | <el-popover |
| | | v-if="scope.row.wecomSpNo && scope.row.event" |
| | | placement="right-start" |
| | | width="600" |
| | | trigger="click" |
| | | > |
| | | <approvalLine :event-data="scope.row.event" :user-list="users" /> |
| | | <el-tag slot="reference" effect="dark"> |
| | | <i class="el-icon-search" /> |
| | | <span>详细</span> |
| | | </el-tag> |
| | | </el-popover> |
| | | |
| | | <el-tag v-else-if="scope.row.appUserName">{{ scope.row.appUserName }}</el-tag> |
| | | <el-tag v-else>暂无</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | > |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo" |
| | | v-permission="permission.approve" |
| | | :loading="crud.status.cu === 2" |
| | | size="mini" |
| | |
| | | >确定</el-button> |
| | | </div> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo" |
| | | slot="reference" |
| | | v-permission="permission.approve" |
| | | type="danger" |
| | |
| | | >撤销 |
| | | </el-button> |
| | | </el-popover> |
| | | <el-link v-if="scope.row.wecomSpNo" type="primary">请前往企微审核</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="scope"> |
| | | <udOperation :data="scope.row" :permission="permission" /> |
| | | <udOperation v-if="!scope.row.wecomSpNo" :data="scope.row" :permission="permission" /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import approvalLine from '@/components/ApprovalLine' |
| | | import constant from '@/utils/constant' |
| | | |
| | | const defaultForm = { |
| | |
| | | createBy: null, |
| | | createTime: null, |
| | | updateBy: null, |
| | | updateTime: null |
| | | updateTime: null, |
| | | wecomSpNo: null, |
| | | event: null |
| | | } |
| | | export default { |
| | | name: 'AttendanceGoOut', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | components: { pagination, crudOperation, rrOperation, udOperation, approvalLine }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ |
| | |
| | | dicts: [ |
| | | constant.LEAVE_TIME_TYPE, |
| | | constant.GO_OUT_TYPE, |
| | | constant.GO_OUT_APPROVE_STATUS |
| | | constant.GO_OUT_APPROVE_STATUS, |
| | | constant.APPROVAL_SITE_TYPE |
| | | ], |
| | | data() { |
| | | return { |
| | |
| | | dictGoOutAppRev: constant.GO_OUT_APPROVE_STATUS_REVIEWED, |
| | | dictGoOutAgree: constant.GO_OUT_APPROVE_STATUS_AGREE, |
| | | dictGoOutReturn: constant.GO_OUT_APPROVE_STATUS_REFUSE, |
| | | dictApprovalSiteType: constant.APPROVAL_SITE_TYPE, |
| | | makeUpCardVisible: false, |
| | | successLoading: false, |
| | | userRolesLevelMin: null, |
| | | // 角色级别:普通用户 |
| | | roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY, |
| | | // 角色级别: 总经理 |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL, |
| | | // 企微审核判断 |
| | | wecomApprovalVisible: false |
| | | } |
| | | }, |
| | | computed: { |
| | | ...mapGetters(['user']) |
| | | }, |
| | | created() { |
| | | this.getUsers() |
| | | this.getApprovalUsers() |
| | | const that = this |
| | | that.getUsers() |
| | | that.getApprovalUsers() |
| | | that.$on('dictReady', () => { |
| | | const dictData = { ...that.dict } |
| | | const filterData = dictData[constant.APPROVAL_SITE_TYPE].filter(item => item.value.toLowerCase() === 'wecom') |
| | | if (filterData.length > 0) { |
| | | that.wecomApprovalVisible = true |
| | | } |
| | | }) |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | | |
| | | if (this.wecomApprovalVisible) { |
| | | this.form.approvalUserId = 0 |
| | | } |
| | | }, |
| | | // 禁用 |
| | |
| | | // 循环数据 |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | if (data[i].wecomSpNo) { |
| | | continue |
| | | } |
| | | ids.push(data[i].id) |
| | | } |
| | | crudAttendanceGoOut |
| | |
| | | // 时间同步 |
| | | toReflash(data) { |
| | | const ids = [] |
| | | // 循环数据 |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | ids.push(data[i].id) |
| | | } |
| | | crudAttendanceGoOut |
| | | .reflashTime(ids) |
| | | .then(res => { |
| | | // 消息提示 |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '刷新成功!' |
| | | }) |
| | | // 刷新数据 |
| | | this.crud.refresh() |
| | | // 循环数据 |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | ids.push(data[i].id) |
| | | } |
| | | crudAttendanceGoOut |
| | | .reflashTime(ids) |
| | | .then(res => { |
| | | // 消息提示 |
| | | this.$message({ |
| | | type: 'success', |
| | | message: '刷新成功!' |
| | | }) |
| | | // 刷新数据 |
| | | this.crud.refresh() |
| | | }) |
| | | }, |
| | | |
| | | // 审批页面赋值 |
| | |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px"> |
| | | <el-form-item label="申请人" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="disabledUser(form)" @change="checkLeaveTime"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="disabledUser(form) || form.wecomSpNo !== null" @change="checkLeaveTime"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批者" prop="approvalUserId"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn"> |
| | | <el-form-item label="审批者" prop="approvalUserId" :hidden="form.wecomSpNo !== null || (form.id == null && wecomApprovalVisible)"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn || form.wecomSpNo !== null"> |
| | | <el-option |
| | | v-for="item in approvalUsers" |
| | | :key="item.id" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="请假类型" prop="leaveType"> |
| | | <el-select v-model="form.leaveType" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" @change="checkLeaveTime"> |
| | | <el-select v-model="form.leaveType" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn || form.wecomSpNo !== null" @change="checkLeaveTime"> |
| | | <el-option |
| | | v-for="item in dict[dictLeaveType]" |
| | | :key="item.value" |
| | |
| | | } |
| | | }" |
| | | :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'" |
| | | :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" |
| | | :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn || form.wecomSpNo !== null" |
| | | @change="checkLeaveTime" |
| | | /> |
| | | </el-form-item> |
| | |
| | | } |
| | | }" |
| | | :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'" |
| | | :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" |
| | | :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn || form.wecomSpNo !== null" |
| | | @change="checkLeaveTime" |
| | | /> |
| | | </el-form-item> |
| | |
| | | </el-input> |
| | | </el-form-item> |
| | | <el-form-item label="请假原因"> |
| | | <el-input v-model="form.leaveReason" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" /> |
| | | <el-input v-model="form.leaveReason" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn || form.wecomSpNo !== null" /> |
| | | </el-form-item> |
| | | <el-form-item label="审批说明"> |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 340px;" disabled /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" /> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn || form.wecomSpNo !== null" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="appUserName" label="审批者" min-width="100" fixed="left" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.appUserName }}</el-tag> |
| | | <el-popover |
| | | v-if="scope.row.wecomSpNo && scope.row.event" |
| | | placement="right-start" |
| | | width="600" |
| | | trigger="click" |
| | | > |
| | | <approvalLine :event-data="scope.row.event" :user-list="users" /> |
| | | <el-tag slot="reference" effect="dark"> |
| | | <i class="el-icon-search" /> |
| | | <span>详细</span> |
| | | </el-tag> |
| | | </el-popover> |
| | | |
| | | <el-tag v-else-if="scope.row.appUserName">{{ scope.row.appUserName }}</el-tag> |
| | | <el-tag v-else>暂无</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="leaveType" label="请假类型" min-width="80" show-overflow-tooltip> |
| | |
| | | <el-table-column v-if="checkPer(['admin','attendanceLeave:approve'])" label="审核操作" width="180px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo" |
| | | v-permission="permission.approve" |
| | | :loading="crud.status.cu === 2" |
| | | size="mini" |
| | |
| | | <el-button :loading="successLoading" type="primary" size="mini" @click="revoke(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button |
| | | v-show="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-show="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo" |
| | | slot="reference" |
| | | v-permission="permission.approve" |
| | | type="danger" |
| | |
| | | >撤销 |
| | | </el-button> |
| | | </el-popover> |
| | | <el-link v-if="scope.row.wecomSpNo" type="primary">请前往企微审核</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','attendanceLeave:edit','attendanceLeave:del'])" label="操作" width="150px" align="center" fixed="right"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | v-if="!scope.row.wecomSpNo" |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import approvalLine from '@/components/ApprovalLine' |
| | | import constant from '@/utils/constant' |
| | | |
| | | const defaultForm = { id: null, userId: null, approvalUserId: null, leaveType: null, leaveStartTime: null, leaveEndTime: null, leaveDuration: null, leaveDurationUnit: null, leaveReason: null, approvalStatus: null, approvalDescription: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, userId: null, approvalUserId: null, leaveType: null, leaveStartTime: null, leaveEndTime: null, leaveDuration: null, leaveDurationUnit: null, leaveReason: null, approvalStatus: null, approvalDescription: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, wecomSpNo: null, event: null } |
| | | export default { |
| | | name: 'AttendanceLeave', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | components: { pagination, crudOperation, rrOperation, udOperation, approvalLine }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '请假记录', url: 'api/attendanceLeave', idField: 'id', sort: 'leaveStartTime,desc', crudMethod: { ...crudAttendanceLeave }}) |
| | | }, |
| | | // 数据字典 |
| | | dicts: [constant.LEAVE_TYPE, constant.APPROVAL_STATUS, constant.LEAVE_TIME_TYPE], |
| | | dicts: [constant.LEAVE_TYPE, constant.APPROVAL_STATUS, constant.LEAVE_TIME_TYPE, constant.APPROVAL_SITE_TYPE], |
| | | data() { |
| | | return { |
| | | permission: { |
| | |
| | | dictLeaveTimeType: constant.LEAVE_TIME_TYPE, |
| | | dictLeaveTimeTypeHour: constant.LEAVE_TIME_TYPE_HOUR, |
| | | dictLeaveTimeTypeDay: constant.LEAVE_TIME_TYPE_DAY, |
| | | dictApprovalSiteType: constant.APPROVAL_SITE_TYPE, |
| | | yearTimeLenght: null, |
| | | OverTimeLenght: null, |
| | | makeUpCardVisible: false, |
| | | successLoading: false, |
| | | userRolesLevelMin: null, |
| | | // 角色级别: 总经理 |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL |
| | | roleLevelGenerl: constant.ROLE_LEVEL_GENERAL, |
| | | // 企微审核判断 |
| | | wecomApprovalVisible: false |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | ]) |
| | | }, |
| | | created() { |
| | | this.getUsers() |
| | | this.getApprovalUsers() |
| | | const that = this |
| | | that.getUsers() |
| | | that.getApprovalUsers() |
| | | // this.getUserTimes() |
| | | that.$on('dictReady', () => { |
| | | const dictData = { ...that.dict } |
| | | const filterData = dictData[constant.APPROVAL_SITE_TYPE].filter(item => item.value.toLowerCase() === 'wecom') |
| | | if (filterData.length > 0) { |
| | | that.wecomApprovalVisible = true |
| | | } |
| | | }) |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | |
| | | if (this.userRolesLevelMin > this.roleLevelGenerl) { |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | | if (this.wecomApprovalVisible) { |
| | | this.form.approvalUserId = 0 |
| | | } |
| | | }, |
| | | // 钩子:在编辑之前执行 |
| | |
| | | // 循环数据 |
| | | for (let i = 0; i < data.length; i++) { |
| | | // ID列表 |
| | | if (data[i].wecomSpNo) { |
| | | continue |
| | | } |
| | | ids.push(data[i].id) |
| | | } |
| | | crudAttendanceLeave.updateAgree({ |
| | |
| | | <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px"> |
| | | <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="申请人" prop="userId"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="disabledUser(form)"> |
| | | <el-select v-model="form.userId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="disabledUser(form) || form.wecomSpNo !== null"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="审批者" prop="approvalUserId"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn"> |
| | | <el-form-item label="审批者" prop="approvalUserId" :hidden="form.wecomSpNo !== null || (form.id == null && wecomApprovalVisible)"> |
| | | <el-select v-model="form.approvalUserId" filterable clearable placeholder="请选择" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn || form.wecomSpNo !== null"> |
| | | <el-option |
| | | v-for="item in approvalUsers" |
| | | :key="item.id" |
| | |
| | | } |
| | | }" |
| | | :default-time="$store.state.user.user.sysRostering.workStartTime + ':00'" |
| | | :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" |
| | | :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn || form.wecomSpNo !== null" |
| | | @change="checkLeaveTime()" |
| | | /> |
| | | </el-form-item> |
| | |
| | | } |
| | | }" |
| | | :default-time="$store.state.user.user.sysRostering.workEndTime + ':00'" |
| | | :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" |
| | | :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn || form.wecomSpNo !== null" |
| | | @change="checkLeaveTime()" |
| | | /> |
| | | </el-form-item> |
| | |
| | | <el-input v-model="form.overtimeDuration" disabled style="width: 340px;" /> |
| | | </el-form-item> |
| | | <el-form-item label="审批说明"> |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 340px;" /> |
| | | <el-input v-model="form.approvalDescription" type="textarea" rows="3" style="width: 340px;" :disabled="form.wecomSpNo !== null" /> |
| | | </el-form-item> |
| | | <el-form-item label="备注"> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn" /> |
| | | <el-input v-model="form.remarks" type="textarea" rows="3" style="width: 340px;" :disabled="form.approvalStatus == dictAppRovalStatusPassed || form.approvalStatus == dictAppRovalStatusReturn || form.wecomSpNo !== null" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | |
| | | </el-table-column> |
| | | <el-table-column prop="appUserName" label="审批者" min-width="100" fixed="left" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.appUserName }}</el-tag> |
| | | <el-popover |
| | | v-if="scope.row.wecomSpNo && scope.row.event" |
| | | placement="right-start" |
| | | width="600" |
| | | trigger="click" |
| | | > |
| | | <approvalLine :event-data="scope.row.event" :user-list="users" /> |
| | | <el-tag slot="reference" effect="dark"> |
| | | <i class="el-icon-search" /> |
| | | <span>详细</span> |
| | | </el-tag> |
| | | </el-popover> |
| | | |
| | | <el-tag v-else-if="scope.row.appUserName">{{ scope.row.appUserName }}</el-tag> |
| | | <el-tag v-else>暂无</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="overtimeStartTime" label="加班开始时间" show-overflow-tooltip /> |
| | |
| | | <el-table-column v-if="checkPer(['admin','attendanceOvertime:approve'])" label="审核操作" width="180px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-if="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo" |
| | | v-permission="permission.approve" |
| | | :loading="crud.status.cu === 2" |
| | | size="mini" |
| | |
| | | <el-button :loading="successLoading" type="primary" size="mini" @click="revoke(scope.row)">确定</el-button> |
| | | </div> |
| | | <el-button |
| | | v-show="scope.row.approvalUserId === $store.state.user.user.id" |
| | | v-show="scope.row.approvalUserId === $store.state.user.user.id && !scope.row.wecomSpNo" |
| | | slot="reference" |
| | | v-permission="permission.approve" |
| | | type="danger" |
| | |
| | | >撤销 |
| | | </el-button> |
| | | </el-popover> |
| | | <el-link v-if="scope.row.wecomSpNo" type="primary">请前往企微审核</el-link> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column v-if="checkPer(['admin','attendanceOvertime:edit','attendanceOvertime:del'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <udOperation |
| | | v-if="!scope.row.wecomSpNo" |
| | | :data="scope.row" |
| | | :permission="permission" |
| | | /> |
| | |
| | | import crudOperation from '@crud/CRUD.operation' |
| | | import udOperation from '@crud/UD.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import approvalLine from '@/components/ApprovalLine' |
| | | import constant from '@/utils/constant' |
| | | import { mapGetters } from 'vuex' |
| | | |
| | | const defaultForm = { id: null, userId: null, approvalUserId: null, overtimeStartTime: null, overtimeEndTime: null, overtimeDuration: null, overtimeDurationUnit: null, approvalStatus: null, approvalDescription: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | const defaultForm = { id: null, userId: null, approvalUserId: null, overtimeStartTime: null, overtimeEndTime: null, overtimeDuration: null, overtimeDurationUnit: null, approvalStatus: null, approvalDescription: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, wecomSpNo: null, event: null } |
| | | export default { |
| | | name: 'AttendanceOvertime', |
| | | components: { pagination, crudOperation, rrOperation, udOperation }, |
| | | components: { pagination, crudOperation, rrOperation, udOperation, approvalLine }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '考勤加班', url: 'api/attendanceOvertime', idField: 'id', sort: 'id,desc', crudMethod: { ...crudAttendanceOvertime }}) |
| | | }, |
| | | dicts: [constant.OVERTIME_STATUS], |
| | | dicts: [constant.OVERTIME_STATUS, constant.APPROVAL_SITE_TYPE], |
| | | data() { |
| | | return { |
| | | permission: { |
| | |
| | | dictAppRovalStatusUnderAppover: constant.OVERTIME_APPROVAL, |
| | | dictAppRovalStatusPassed: constant.OVERTIME_PASS, |
| | | dictAppRovalStatusReturn: constant.OVERTIME_RETURN, |
| | | dictApprovalSiteType: constant.APPROVAL_SITE_TYPE, |
| | | successLoading: false, |
| | | makeUpCardVisible: false |
| | | makeUpCardVisible: false, |
| | | // 企微审核判断 |
| | | wecomApprovalVisible: false |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | ]) |
| | | }, |
| | | created() { |
| | | this.getUsers() |
| | | this.getApprovalUsers() |
| | | const that = this |
| | | that.getUsers() |
| | | that.getApprovalUsers() |
| | | that.$on('dictReady', () => { |
| | | const dictData = { ...that.dict } |
| | | const filterData = dictData[constant.APPROVAL_SITE_TYPE].filter(item => item.value.toLowerCase() === 'wecom') |
| | | if (filterData.length > 0) { |
| | | that.wecomApprovalVisible = true |
| | | } |
| | | }) |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | |
| | | // 表单赋值 |
| | | this.form.userId = this.user.id |
| | | } |
| | | |
| | | if (this.wecomApprovalVisible) { |
| | | this.form.approvalUserId = 0 |
| | | } |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-row :gutter="40" class="panel-group"> |
| | | <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> |
| | | <div class="card-panel"> |
| | | <div class="card-panel-icon-wrapper icon-people"> |
| | | <svg-icon icon-class="visits" class-name="card-panel-icon" /> |
| | | </div> |
| | | <div class="card-panel-description"> |
| | | <div class="card-panel-text"> |
| | | 补卡未承认 |
| | | </div> |
| | | <count-to |
| | | :start-val="0" |
| | | :end-val="100" |
| | | :duration="1" |
| | | class="card-panel-num" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> |
| | | <div class="card-panel"> |
| | | <div class="card-panel-icon-wrapper icon-permission"> |
| | | <svg-icon icon-class="people" class-name="card-panel-icon" /> |
| | | </div> |
| | | <div class="card-panel-description"> |
| | | <div class="card-panel-text"> |
| | | 请假未承认 |
| | | </div> |
| | | <count-to |
| | | :start-val="0" |
| | | :end-val="100" |
| | | :duration="3000" |
| | | :decimals="2" |
| | | class="card-panel-num" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> |
| | | <div class="card-panel"> |
| | | <div class="card-panel-icon-wrapper icon-message"> |
| | | <svg-icon icon-class="message" class-name="card-panel-icon" /> |
| | | </div> |
| | | <div class="card-panel-description"> |
| | | <div class="card-panel-text"> |
| | | 外出未承认 |
| | | </div> |
| | | <count-to |
| | | :start-val="0" |
| | | :end-val="100" |
| | | :duration="3600" |
| | | class="card-panel-num" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | <el-col :xs="12" :sm="12" :lg="6" class="card-panel-col"> |
| | | <div class="card-panel"> |
| | | <div class="card-panel-icon-wrapper icon-timings"> |
| | | <svg-icon icon-class="timing" class-name="card-panel-icon" /> |
| | | </div> |
| | | <div class="card-panel-description"> |
| | | <div class="card-panel-text"> |
| | | 出差未承认 |
| | | </div> |
| | | <count-to |
| | | :start-val="0" |
| | | :end-val="100" |
| | | :decimals="2" |
| | | :duration="3600" |
| | | class="card-panel-num" |
| | | /> |
| | | <span class="card-panel-texts">/</span> |
| | | <count-to |
| | | :start-val="0" |
| | | :end-val="100" |
| | | :duration="3600" |
| | | class="card-panel-num" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </el-col> |
| | | </el-row> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <div> |
| | | <el-select v-model="query.userId" filterable clearable placeholder="所属员工" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery"> |
| | | <el-option |
| | | v-for="item in users" |
| | | :key="item.id" |
| | | :label="item.nickName" |
| | | :value="item.id" |
| | | /> |
| | | </el-select> |
| | | <el-date-picker |
| | | v-model="query.attendanceDate" |
| | | type="daterange" |
| | | clearable |
| | | class="filter-item" |
| | | value-format="yyyy-MM-dd" |
| | | placeholder="请选择考勤日期" |
| | | range-separator=" ~ " |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | style="width: 285px;" |
| | | /> |
| | | <rrOperation /> |
| | | </div> |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="crud.loading" :data="crud.data" row-key="id" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="userName" label="所属员工" fixed="left" width="100" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ scope.row.userName }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="attendanceDate" label="考勤日期" fixed="left" width="100" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | {{ crud.toDate(scope.row.attendanceDate) }} |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="rosteringWorkStartTime" min-width="140" label="排班工作开始时间" show-overflow-tooltip /> |
| | | <el-table-column prop="actualWorkStartTime" min-width="140" label="实际工作开始时间" show-overflow-tooltip /> |
| | | <el-table-column prop="startLocationResults" min-width="100" label="开始位置结果" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.startLocationResults === dictlocationResultsNormal" type="success">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.startLocationResults === dictlocationResultsOutside" type="warning">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.startLocationResults === dictlocationResultsNotSigned" type="danger">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.startLocationResults === dictlocationResultsRest" type="warning">{{ dict.label[lacationResules][scope.row.startLocationResults] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="startClockResults" min-width="100" label="开始打卡结果" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.startClockResults === dictAttendanceStateWaitFor" type="warning">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.startClockResults === dictAttendanceStateNormal" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.startClockResults === dictAttendanceStateNotSigned" type="danger">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.startClockResults === dictAttendanceStateGoOut" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.startClockResults === dictAttendanceStateBusiness" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.startClockResults === dictAttendanceStateLeave" type="success">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.startClockResults === dictAttendanceStateRest" type="warning">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.startClockResults === dictEndanceStateLackOfTime" type="danger">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.startClockResults === dictStartLate" type="warning">{{ dict.label[attendanceState][scope.row.startClockResults] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="rosteringWorkEndTime" min-width="140" label="排班工作结束时间" show-overflow-tooltip /> |
| | | <el-table-column prop="actualWorkEndTime" min-width="140" label="实际工作结束时间" show-overflow-tooltip /> |
| | | <el-table-column prop="endLocationResults" min-width="100" label="结束位置结果" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.endLocationResults === dictlocationResultsNormal" type="success">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.endLocationResults === dictlocationResultsOutside" type="warning">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.endLocationResults === dictlocationResultsNotSigned" type="danger">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.endLocationResults === dictlocationResultsRest" type="warning">{{ dict.label[lacationResules][scope.row.endLocationResults] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="endClockResults" min-width="100" label="结束打卡结果" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.endClockResults === dictAttendanceStateWaitFor" type="warning">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.endClockResults === dictAttendanceStateNormal" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.endClockResults === dictAttendanceStateNotSigned" type="danger">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.endClockResults === dictAttendanceStateGoOut" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.endClockResults === dictAttendanceStateBusiness" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.endClockResults === dictAttendanceStateLeave" type="success">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.endClockResults === dictAttendanceStateRest" type="warning">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.endClockResults === dictEndanceStateLackOfTime" type="danger">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag> |
| | | <el-tag v-if="scope.row.endClockResults === dictStartEarly" type="warning">{{ dict.label[attendanceState][scope.row.endClockResults] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="dateType" min-width="80" label="日期类型" show-overflow-tooltip> |
| | | <template slot-scope="scope"> |
| | | <el-tag>{{ dict.label[dateType][scope.row.dateType] }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!--分页组件--> |
| | | <pagination /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import crudAttendance from '@/api/attendance/attendance' |
| | | import crudAttendanceCardreplacement from '@/api/attendance/attendanceCardreplacement' |
| | | import crudAttendanceGoOut from '@/api/attendance/attendanceGoOut' |
| | | import crudAttendanceBusinessTravel from '@/api/attendance/attendanceBusinessTravel' |
| | | import crudUser from '@/api/system/user' |
| | | import CRUD, { presenter, header, form, crud } from '@crud/crud' |
| | | import rrOperation from '@crud/RR.operation' |
| | | import pagination from '@crud/Pagination' |
| | | import constant from '@/utils/constant' |
| | | |
| | | const defaultForm = { id: null, userId: null, attendanceDate: null, rosteringWorkStartTime: null, actualWorkStartTime: null, startLocationResults: null, startClockResults: null, rosteringWorkEndTime: null, actualWorkEndTime: null, endLocationResults: null, endClockResults: null, dateType: null, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null } |
| | | export default { |
| | | name: 'AttendanceTotal', |
| | | components: { pagination, rrOperation }, |
| | | mixins: [presenter(), header(), form(defaultForm), crud()], |
| | | cruds() { |
| | | return CRUD({ title: '考勤记录', url: 'api/attendance/notNormal', idField: 'id', sort: 'attendanceDate,desc', crudMethod: { ...crudAttendance }}) |
| | | }, |
| | | // 数据字典 |
| | | dicts: [constant.ATTENDANCE_STATE, constant.DATE_TYPE, constant.LOCATION_RESULTS, constant.CARD_REPLACEMENT_DIFFERENTIATION, constant.CARD_APPROVE_STATUS, constant.LEAVE_TIME_TYPE, constant.GO_OUT_TYPE], |
| | | data() { |
| | | return { |
| | | permission: { |
| | | add: ['admin', 'attendance:add'], |
| | | edit: ['admin', 'attendance:edit'], |
| | | del: ['admin', 'attendance:del'], |
| | | download: ['admin', 'attendance:download'], |
| | | addAttendanceInfo: ['admin', 'attendance:addAttendanceInfo'] |
| | | }, |
| | | attendanceState: constant.ATTENDANCE_STATE, |
| | | lacationResules: constant.LOCATION_RESULTS, |
| | | dateType: constant.DATE_TYPE, |
| | | dictlocationResultsNormal: constant.LOCATION_RESULTS_NORMAL, |
| | | dictlocationResultsOutside: constant.LOCATION_RESULTS_OUTSIDE, |
| | | dictlocationResultsNotSigned: constant.LOCATION_RESULTS_NOTSIGNED, |
| | | dictlocationResultsRest: constant.LOCATION_RESULTS_REST, |
| | | dictAttendanceStateWaitFor: constant.ATTENDANCE_STATE_WAITFOR, |
| | | dictAttendanceStateNormal: constant.ATTENDANCE_STATE_NORMAL, |
| | | dictAttendanceStateNotSigned: constant.ATTENDANCE_STATE_NOTSIGNED, |
| | | dictAttendanceStateGoOut: constant.ATTENDANCE_STATE_GOOUT, |
| | | dictAttendanceStateBusiness: constant.ATTENDANCE_STATE_BUSINESS, |
| | | dictAttendanceStateLeave: constant.ATTENDANCE_STATE_LEAVE, |
| | | dictAttendanceStateRest: constant.ATTENDANCE_STATE_REST, |
| | | dictEndanceStateLackOfTime: constant.ATTENDANCE_STATE_LACK_OF_TIME, |
| | | dictStartEarly: constant.ATTENDANCE_STATE_EARLY, |
| | | dictStartLate: constant.ATTENDANCE_STATE_LATE, |
| | | users: [], |
| | | users1: [], |
| | | approvalUsers: [], |
| | | goOutVisible: false, |
| | | goSuccessLoading: false, |
| | | dictLeaveTimeType: constant.LEAVE_TIME_TYPE, |
| | | dictGoOutTypr: constant.GO_OUT_TYPE, |
| | | dictLeaveTimeTypeHour: constant.LEAVE_TIME_TYPE_HOUR, |
| | | dictLeaveTimeTypeDay: constant.LEAVE_TIME_TYPE_DAY, |
| | | } |
| | | }, |
| | | methods: { |
| | | // 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
| | | [CRUD.HOOK.beforeRefresh]() { |
| | | this.getUsers() |
| | | this.getUsers1() |
| | | this.getApprovalUsers() |
| | | return true |
| | | }, |
| | | // 查询员工 |
| | | getUsers() { |
| | | crudUser.getAll().then(res => { |
| | | this.users = res |
| | | }) |
| | | }, |
| | | // 查询员工 |
| | | getUsers1() { |
| | | crudUser.getUserInfose().then(res => { |
| | | this.users1 = res |
| | | }) |
| | | }, |
| | | // 查询审核人 |
| | | getApprovalUsers() { |
| | | crudUser.getApprovalUsers().then(res => { |
| | | this.approvalUsers = res |
| | | }) |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | |
| | | .attCss { |
| | | font-size: 12px; |
| | | text-align: center; |
| | | } |
| | | |
| | | .panel-group { |
| | | margin-top: 18px; |
| | | |
| | | .card-panel-col { |
| | | margin-bottom: 32px; |
| | | } |
| | | |
| | | .card-panel { |
| | | height: 108px; |
| | | cursor: pointer; |
| | | font-size: 12px; |
| | | position: relative; |
| | | overflow: hidden; |
| | | color: #666; |
| | | background: #fff; |
| | | box-shadow: 4px 4px 40px rgba(0, 0, 0, 0.05); |
| | | border-color: rgba(0, 0, 0, 0.05); |
| | | |
| | | &:hover { |
| | | .card-panel-icon-wrapper { |
| | | color: #fff; |
| | | } |
| | | |
| | | .icon-people { |
| | | background: #40c9c6; |
| | | } |
| | | |
| | | .icon-message { |
| | | background: #36a3f7; |
| | | } |
| | | |
| | | .icon-permission { |
| | | background: #34bfa3; |
| | | } |
| | | |
| | | .icon-timings { |
| | | background: #f4516c; |
| | | } |
| | | } |
| | | |
| | | .icon-people { |
| | | color: #40c9c6; |
| | | } |
| | | |
| | | .icon-message { |
| | | color: #36a3f7; |
| | | } |
| | | |
| | | .icon-permission { |
| | | color: #34bfa3; |
| | | } |
| | | |
| | | .card-panel-icon-wrapper { |
| | | float: left; |
| | | margin: 14px 0 0 14px; |
| | | padding: 16px; |
| | | transition: all 0.38s ease-out; |
| | | border-radius: 6px; |
| | | } |
| | | |
| | | .card-panel-icon { |
| | | float: left; |
| | | font-size: 48px; |
| | | } |
| | | |
| | | .card-panel-description { |
| | | float: right; |
| | | font-weight: bold; |
| | | margin: 26px; |
| | | margin-left: 0px; |
| | | |
| | | .card-panel-text { |
| | | line-height: 18px; |
| | | color: rgba(0, 0, 0, 0.45); |
| | | font-size: 16px; |
| | | margin-bottom: 12px; |
| | | } |
| | | |
| | | .card-panel-texts { |
| | | font-size: 20px; |
| | | } |
| | | |
| | | .card-panel-num { |
| | | font-size: 20px; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @media (max-width: 550px) { |
| | | .card-panel-description { |
| | | display: none; |
| | | } |
| | | |
| | | .card-panel-icon-wrapper { |
| | | float: none !important; |
| | | width: 100%; |
| | | height: 100%; |
| | | margin: 0 !important; |
| | | |
| | | .svg-icon { |
| | | display: block; |
| | | margin: 14px auto !important; |
| | | float: none !important; |
| | | } |
| | | } |
| | | } |
| | | </style> |
| New file |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <!--工具栏--> |
| | | <div class="head-container"> |
| | | <!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'--> |
| | | <div> |
| | | <el-button |
| | | slot="right" |
| | | size="mini" |
| | | type="primary" |
| | | icon="el-icon-edit" |
| | | class="filter-item" |
| | | :loading="refreshWecomVacationTypeLoading" |
| | | @click="refreshWecomVacationType()" |
| | | > |
| | | 更新企微请假类型 |
| | | </el-button> |
| | | |
| | | <el-popover |
| | | slot="right" |
| | | placement="bottom-start" |
| | | width="400" |
| | | trigger="click" |
| | | title="更新申请审核站点" |
| | | @show="showEditApprovalSite()" |
| | | @hide="hideEditApprovalSite()" |
| | | > |
| | | <el-form ref="form" :model="approvalSiteParam.form" :rules="rules" size="small" label-width="80px"> |
| | | <el-form-item label="审核站点"> |
| | | <el-radio-group v-model="approvalSiteParam.form.approvalSite"> |
| | | <el-radio-button label="system">系统</el-radio-button> |
| | | <el-radio-button label="wecom">企微</el-radio-button> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div class="popover-footer"> |
| | | <el-button :loading="approvalSiteParam.loading" type="primary" @click="doEditApprovalSite">确认</el-button> |
| | | </div> |
| | | |
| | | <el-button |
| | | slot="reference" |
| | | size="mini" |
| | | type="warning" |
| | | icon="el-icon-edit" |
| | | class="filter-item" |
| | | > |
| | | 更新申请审核站点 |
| | | </el-button> |
| | | </el-popover> |
| | | </div> |
| | | <!--表单组件--> |
| | | <el-dialog :close-on-click-modal="false" :before-close="cancelBind" :visible.sync="bindParam.visible" :title="bindParam.title" width="600px"> |
| | | <div class="query-container"> |
| | | <el-input v-model="bindParam.queryTemplateId" placeholder="请输入模版ID查询" style="width: 300px;" /> |
| | | <span> |
| | | <el-button icon="el-icon-search" type="primary" size="mini" @click="toQueryTemplate">查新</el-button> |
| | | <el-button icon="el-icon-search" type="primary" size="mini" @click="toQueryTemplate(false)">查旧</el-button> |
| | | <el-button icon="el-icon-refresh-right" type="warning" size="mini" @click="resetTemplate">重置</el-button> |
| | | </span> |
| | | </div> |
| | | |
| | | <el-divider /> |
| | | |
| | | <el-form ref="form" :model="bindParam.data" :rules="rules" size="small" label-width="180px"> |
| | | <el-form-item label="模板ID"> |
| | | <el-input v-model="bindParam.data.templateId" disabled style="width: 370px;" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item label="模版名称"> |
| | | <el-input v-model="bindParam.data.templateName" disabled style="width: 370px;" /> |
| | | </el-form-item> |
| | | |
| | | <el-form-item |
| | | v-for="control in bindParam.currentTemplateData.templateControls" |
| | | :key="control.id" |
| | | :label="`${control.titleTextZh || control.titleTextEn}(${control.controlParamName})`" |
| | | :prop="`${control.id}`" |
| | | :rules="[{ |
| | | required: control.contentRequire == 1, message: `${control.titleTextZh || control.titleTextEn}(${control.controlParamName})不能为空`, trigger: 'change' |
| | | }]" |
| | | > |
| | | <el-select v-model="bindParam.data[`${control.id}`]" filterable clearable :placeholder="`请选择${control.titleTextZh || control.titleTextEn}(${control.controlParamName})`" style="width: 370px;"> |
| | | <el-option v-for="item in bindParam.tableData.fieldNames" :key="control.id + control.controlId + '_' + item.propName" :label="`${item.label}(${item.propName})`" :value="item.propName" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="text" @click="cancelBind">取消</el-button> |
| | | <el-button :loading="bindParam.loading" type="primary" @click="doBind">确认</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!--表格渲染--> |
| | | <el-table ref="table" v-loading="queryLoading" :data="tableInfoData" size="small" style="width: 100%;"> |
| | | <el-table-column type="selection" width="55" /> |
| | | <el-table-column prop="name" label="绑定类型" /> |
| | | <el-table-column prop="fieldTable" label="绑定表名" /> |
| | | <el-table-column v-if="checkPer(['admin','templateControlField:edit'])" label="操作" width="150px" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-button v-permission="permission.edit" size="mini" type="primary" icon="el-icon-edit" @click="toBind(scope.row)" /> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { bind, queryByTable, editWecomVacationType, editApprovalSite } from '@/api/template/templateControlField' |
| | | import { queryTemplate } from '@/api/template/template' |
| | | import constant from '@utils/constant' |
| | | import Vue from 'vue' |
| | | |
| | | export default { |
| | | name: 'TemplateBind', |
| | | data() { |
| | | return { |
| | | // 绑定审批表信息 |
| | | tableInfoData: [], |
| | | queryLoading: false, |
| | | bindParam: { |
| | | loading: false, |
| | | visible: false, |
| | | title: '审批模板绑定', |
| | | queryTemplateId: null, |
| | | // 选中表数据 |
| | | tableData: null, |
| | | // 当前模板信息 |
| | | currentTemplateData: {}, |
| | | // 当前控件绑定信息 |
| | | currentTemplateControlFieldData: [], |
| | | // 原始模板信息 |
| | | originTemplateData: {}, |
| | | // 原始控件绑定信息 |
| | | originTemplateControlFieldData: [], |
| | | // 绑定表单数据 |
| | | data: {} |
| | | }, |
| | | // 更新企微请假类型Loading |
| | | refreshWecomVacationTypeLoading: false, |
| | | // 更新申请审核站点参数 |
| | | approvalSiteParam: { |
| | | form: { |
| | | approvalSite: null |
| | | }, |
| | | loading: false |
| | | }, |
| | | // 申请审核站点: system-系统审批,wecom-企业微信审批。默认为system |
| | | approvalSite: 'system', |
| | | permission: { |
| | | add: ['admin', 'templateControlField:add'], |
| | | edit: ['admin', 'templateControlField:edit'], |
| | | del: ['admin', 'templateControlField:del'] |
| | | }, |
| | | rules: {} |
| | | } |
| | | }, |
| | | dicts: [constant.WECOM_BIND_LEAVE, constant.WECOM_BIND_GOOUT, constant.WECOM_BIND_TRAVEL, constant.WECOM_BIND_OVERTIME, constant.WECOM_BIND_REPLACEMENT, constant.APPROVAL_SITE_TYPE], |
| | | created() { |
| | | const that = this |
| | | that.queryLoading = true |
| | | that.$on('dictReady', () => { |
| | | const dictData = { ...that.dict } |
| | | // 请假字段绑定信息制作 |
| | | const leaveTableDate = { name: '请假', fieldTable: constant.WECOM_BIND_LEAVE, fieldNames: [] } |
| | | dictData[constant.WECOM_BIND_LEAVE].forEach(leave => { |
| | | leaveTableDate.fieldNames.push({ label: leave.label, propName: leave.value }) |
| | | return leave |
| | | }) |
| | | // 外出字段绑定信息制作 |
| | | const goOutTableDate = { name: '外出', fieldTable: constant.WECOM_BIND_GOOUT, fieldNames: [] } |
| | | dictData[constant.WECOM_BIND_GOOUT].forEach(goOut => { |
| | | goOutTableDate.fieldNames.push({ label: goOut.label, propName: goOut.value }) |
| | | }) |
| | | // 出差字段绑定信息制作 |
| | | const travelTableDate = { name: '出差', fieldTable: constant.WECOM_BIND_TRAVEL, fieldNames: [] } |
| | | dictData[constant.WECOM_BIND_TRAVEL].forEach(travel => { |
| | | travelTableDate.fieldNames.push({ label: travel.label, propName: travel.value }) |
| | | }) |
| | | // 换休字段绑定信息制作 |
| | | const overtimeTableDate = { name: '换休', fieldTable: constant.WECOM_BIND_OVERTIME, fieldNames: [] } |
| | | dictData[constant.WECOM_BIND_OVERTIME].forEach(overtime => { |
| | | overtimeTableDate.fieldNames.push({ label: overtime.label, propName: overtime.value }) |
| | | }) |
| | | // 补卡字段绑定信息制作 |
| | | const replacementTableDate = { name: '补卡', fieldTable: constant.WECOM_BIND_REPLACEMENT, fieldNames: [] } |
| | | dictData[constant.WECOM_BIND_REPLACEMENT].forEach(replacement => { |
| | | replacementTableDate.fieldNames.push({ label: replacement.label, propName: replacement.value }) |
| | | }) |
| | | that.tableInfoData.push(leaveTableDate, goOutTableDate, travelTableDate, overtimeTableDate, replacementTableDate) |
| | | |
| | | that.queryLoading = false |
| | | |
| | | // 判断申请审核站点 |
| | | const filterData = dictData[constant.APPROVAL_SITE_TYPE].filter(item => item.value.toLowerCase() === 'wecom') |
| | | if (filterData.length > 0) { |
| | | that.approvalSite = 'wecom' |
| | | } |
| | | }) |
| | | }, |
| | | methods: { |
| | | // 更新企微请假类型 |
| | | refreshWecomVacationType() { |
| | | const that = this |
| | | that.refreshWecomVacationTypeLoading = true |
| | | editWecomVacationType().then(() => { |
| | | that.$message({ |
| | | message: '企微请假类型更新成功', |
| | | type: 'success', |
| | | duration: 1500 |
| | | }) |
| | | that.refreshWecomVacationTypeLoading = false |
| | | }).catch(() => { |
| | | that.refreshWecomVacationTypeLoading = false |
| | | }) |
| | | }, |
| | | |
| | | // 执行绑定 |
| | | toBind(data) { |
| | | const that = this |
| | | |
| | | // 显示模版绑定弹窗 |
| | | that.bindParam.visible = true |
| | | // 显示模版绑定Loading |
| | | that.bindParam.loading = true |
| | | // 绑定数据赋值 |
| | | that.bindParam.tableData = data |
| | | |
| | | // 查询模版绑定信息 |
| | | queryByTable({ fieldTable: data.fieldTable }).then(res => { |
| | | if (res) { |
| | | // 源数据赋值 |
| | | that.bindParam.originTemplateData = res.template || {} |
| | | that.bindParam.currentTemplateData = res.template || {} |
| | | that.bindParam.originTemplateControlFieldData = res.templateControlField || [] |
| | | that.bindParam.currentTemplateControlFieldData = res.templateControlField || [] |
| | | if (res.template) { |
| | | Vue.set(that.bindParam.data, 'templateId', res.template.templateId) |
| | | Vue.set(that.bindParam.data, 'templateName', res.template.templateNameZh || res.template.templateNameEn) |
| | | } |
| | | res.templateControlField.forEach(i => { |
| | | Vue.set(that.bindParam.data, `${i.controlId}`, i.fieldName || null) |
| | | }) |
| | | } |
| | | |
| | | // 关闭模版绑定Loading |
| | | that.bindParam.loading = false |
| | | }).catch(() => { |
| | | // 关闭模版绑定Loading |
| | | that.bindParam.loading = false |
| | | }) |
| | | }, |
| | | |
| | | // 执行绑定 |
| | | doBind() { |
| | | const that = this |
| | | that.$refs.form.validate((valid) => { |
| | | if (!valid) { |
| | | return |
| | | } |
| | | const finalData = [] |
| | | that.bindParam.currentTemplateData.templateControls.forEach(i => { |
| | | const item = {} |
| | | item.templateId = that.bindParam.currentTemplateData.id |
| | | item.controlId = i.id |
| | | item.fieldTable = that.bindParam.tableData.fieldTable |
| | | item.fieldName = that.bindParam.data[`${i.id}`] || null |
| | | finalData.push(item) |
| | | }) |
| | | |
| | | bind(finalData).then(() => { |
| | | that.cancelBind() |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | // 获取模版信息 |
| | | toQueryTemplate(update = true) { |
| | | const that = this |
| | | if (that.bindParam.queryTemplateId === null || that.bindParam.queryTemplateId === '') { |
| | | return |
| | | } |
| | | queryTemplate({ templateId: that.bindParam.queryTemplateId, queryNew: (!!update) }).then(res => { |
| | | that.bindParam.currentTemplateData = res |
| | | that.bindParam.currentTemplateControlFieldData = [] |
| | | that.bindParam.data = { |
| | | templateId: res.templateId, |
| | | templateName: res.templateNameZh || res.templateNameEn |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | // 重置模版信息 |
| | | resetTemplate() { |
| | | const that = this |
| | | that.bindParam.currentTemplateData = { ...that.bindParam.originTemplateData } |
| | | that.bindParam.currentTemplateControlFieldData = { ...that.bindParam.originTemplateControlFieldData } |
| | | if (that.bindParam.originTemplateData.templateId) { |
| | | that.bindParam.data['templateId'] = that.bindParam.originTemplateData.templateId |
| | | that.bindParam.data['templateName'] = that.bindParam.originTemplateData.templateNameZh || that.bindParam.originTemplateData.templateNameEn |
| | | } else { |
| | | that.bindParam.data['templateId'] = null |
| | | that.bindParam.data['templateName'] = null |
| | | } |
| | | that.bindParam.originTemplateControlFieldData.forEach(i => { |
| | | that.bindParam.data[`${i.controlId}`] = i.fieldName |
| | | }) |
| | | }, |
| | | |
| | | // 清空模板绑定数据 |
| | | clearTemplateBindData() { |
| | | const that = this |
| | | that.bindParam.currentTemplateData = {} |
| | | that.bindParam.currentTemplateControlFieldData = [] |
| | | that.bindParam.originTemplateData = {} |
| | | that.bindParam.originTemplateControlFieldData = [] |
| | | that.bindParam.queryTemplateId = null |
| | | that.bindParam.tableData = null |
| | | that.bindParam.data = {} |
| | | }, |
| | | |
| | | // 取消模版绑定 |
| | | cancelBind() { |
| | | const that = this |
| | | that.bindParam.visible = false |
| | | that.bindParam.loading = false |
| | | that.clearTemplateBindData() |
| | | }, |
| | | |
| | | // 开启更新申请审核站点弹窗 |
| | | showEditApprovalSite() { |
| | | const that = this |
| | | that.$set(that.approvalSiteParam.form, 'approvalSite', that.approvalSite) |
| | | }, |
| | | |
| | | // 隐藏更新申请审核站点弹窗 |
| | | hideEditApprovalSite() { |
| | | const that = this |
| | | that.$set(that.approvalSiteParam.form, 'approvalSite', null) |
| | | }, |
| | | |
| | | // 执行更新申请审核站点 |
| | | doEditApprovalSite() { |
| | | const that = this |
| | | const approvalSite = that.approvalSiteParam.form.approvalSite |
| | | that.approvalSiteParam.loading = true |
| | | editApprovalSite({ approvalSite: approvalSite }).then(() => { |
| | | that.$message({ |
| | | message: '申请审核站点更新成功', |
| | | type: 'success', |
| | | duration: 1500 |
| | | }) |
| | | that.$set(that, 'approvalSite', approvalSite) |
| | | that.approvalSiteParam.loading = false |
| | | }).catch(() => { |
| | | that.approvalSiteParam.loading = false |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .query-container { |
| | | display: flex; |
| | | flex-direction: row; |
| | | justify-content: center; |
| | | align-items: center; |
| | | gap: 10px; |
| | | } |
| | | .popover-footer { |
| | | display: flex; |
| | | justify-content: end; |
| | | } |
| | | </style> |