فهرست منبع

后台年假功能,年假提交,审批,显示年假列表接口功能

yanliming 1 سال پیش
والد
کامیت
f62649c35c
14فایلهای تغییر یافته به همراه1813 افزوده شده و 34 حذف شده
  1. 1 1
      common/src/main/java/com/jpsoft/shinestar/modules/base/entity/ApprovalConfig.java
  2. 1 0
      common/src/main/java/com/jpsoft/shinestar/modules/business/dao/YearRequestForLeaveInfoDAO.java
  3. 92 0
      common/src/main/java/com/jpsoft/shinestar/modules/business/dto/YearRequestForLeaveDetailDTO.java
  4. 40 0
      common/src/main/java/com/jpsoft/shinestar/modules/business/dto/YearRequestForLeaveInfoDTO.java
  5. 1 1
      common/src/main/java/com/jpsoft/shinestar/modules/business/entity/WorkScheduleAttendance.java
  6. 44 1
      common/src/main/java/com/jpsoft/shinestar/modules/business/entity/YearRequestForLeaveInfo.java
  7. 6 0
      common/src/main/java/com/jpsoft/shinestar/modules/business/service/YearRequestForLeaveInfoService.java
  8. 426 3
      common/src/main/java/com/jpsoft/shinestar/modules/business/service/impl/YearRequestForLeaveInfoServiceImpl.java
  9. 9 0
      common/src/main/java/com/jpsoft/shinestar/modules/common/utils/TypeNameUtil.java
  10. 92 0
      common/src/main/java/com/jpsoft/shinestar/modules/workflow/service/impl/ProcinstActUserServiceImpl.java
  11. 0 1
      common/src/main/java/com/jpsoft/shinestar/modules/workflow/service/impl/ProcinstServiceImpl.java
  12. 142 7
      common/src/main/resources/mapper/business/YearRequestForLeaveInfo.xml
  13. 303 20
      web/src/main/java/com/jpsoft/shinestar/modules/business/controller/YearRequestForLeaveInfoController.java
  14. 656 0
      web/src/main/java/com/jpsoft/shinestar/modules/mobile/controller/YearRequestForLeaveInfoApiController.java

+ 1 - 1
common/src/main/java/com/jpsoft/shinestar/modules/base/entity/ApprovalConfig.java

@@ -22,7 +22,7 @@ public class ApprovalConfig {
     private String companyId;
     @ApiModelProperty(value = "公司名称")
     private String companyName;
-    @ApiModelProperty(value = "类型(1:补卡,2:外出,3:出差,4:休假,5:加班)")
+    @ApiModelProperty(value = "类型(1:补卡,2:外出,3:出差,4:休假,5:加班:7:年假)")
     private String type;
     @ApiModelProperty(value = "类型翻译")
     private String typeN;

+ 1 - 0
common/src/main/java/com/jpsoft/shinestar/modules/business/dao/YearRequestForLeaveInfoDAO.java

@@ -15,4 +15,5 @@ public interface YearRequestForLeaveInfoDAO {
 	int delete(String id);
 	List<YearRequestForLeaveInfo> list();
 	List<YearRequestForLeaveInfo> search(Map<String, Object> searchParams, List<Sort> sortList);
+	List<YearRequestForLeaveInfo> mobileSearch(Map<String, Object> searchParams, List<Sort> sortList);
 }

+ 92 - 0
common/src/main/java/com/jpsoft/shinestar/modules/business/dto/YearRequestForLeaveDetailDTO.java

@@ -0,0 +1,92 @@
+package com.jpsoft.shinestar.modules.business.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jpsoft.shinestar.modules.base.dto.ApprovalDTO;
+import com.jpsoft.shinestar.modules.common.utils.TypeNameUtil;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+import java.util.List;
+
+
+@Data
+public class YearRequestForLeaveDetailDTO {
+    @ApiModelProperty(value = "姓名")
+    private String name;
+
+    @ApiModelProperty(value = "个人照片")
+    private String picUrl;
+
+    @ApiModelProperty(value = "状态 0-未处理,1-已批准,2-已拒绝")
+    private Integer status;
+
+    @ApiModelProperty(value = "状态 0-未处理,1-已批准,2-已拒绝")
+    private String statusN;
+
+    @ApiModelProperty(value = "身份证号")
+    private String idCard;
+
+    @ApiModelProperty(value = "工号")
+    private String jobNumber;
+
+    @ApiModelProperty(value = "部门")
+    private String department;
+
+    @ApiModelProperty(value = "开始时间")
+    private String startTime;
+
+    @ApiModelProperty(value = "结束时间")
+    private String endTime;
+
+    @ApiModelProperty(value = "开始时间段(0:上午,1:下午)")
+    private String startTimeQuantum;
+
+    @ApiModelProperty(value = "结束时间段(0:上午,1:下午)")
+    private String endTimeQuantum;
+
+    @ApiModelProperty(value = "请假理由")
+    private String reason;
+
+    @ApiModelProperty(value = "上传照片")
+    private String imageUrl;
+
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+    @ApiModelProperty(value = "审批人")
+    private String approvedName;
+
+    @ApiModelProperty(value = "审批意见")
+    private String approvalOpinions;
+
+    @ApiModelProperty(value = "意见说明")
+    private String approvalExplain;
+
+    @ApiModelProperty(value = "审核时间")
+    private String approvedTime;
+
+    private List<ApprovalDTO> list;
+
+    private Boolean approvalEnable;
+
+    public String getStatusN(){
+        String text = TypeNameUtil.getExamineTypeName(String.valueOf(status));
+        return text;
+        /*if (Integer.valueOf(0).equals(status)){
+            return "未处理";
+        }
+        else if (Integer.valueOf(1).equals(status)){
+            return "已批准";
+        }
+        else if (Integer.valueOf(2).equals(status)){
+            return "已拒绝";
+        }
+        else{
+            return "";
+        }*/
+    }
+}

+ 40 - 0
common/src/main/java/com/jpsoft/shinestar/modules/business/dto/YearRequestForLeaveInfoDTO.java

@@ -0,0 +1,40 @@
+package com.jpsoft.shinestar.modules.business.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+
+@Data
+public class YearRequestForLeaveInfoDTO {
+
+    @ApiModelProperty(value = "编号")
+    private String id;
+    @ApiModelProperty(value = "姓名")
+    private String name;
+    @ApiModelProperty(value = "个人照片")
+    private String picUrl;
+
+    @ApiModelProperty(value = "标题")
+    private String title;
+
+    @ApiModelProperty(value = "申请时间")
+    private String createTime;
+
+    private String startTime;
+
+    private String startTimeQuantum;
+
+    private String endTime;
+
+    private String endTimeQuantum;
+
+    @ApiModelProperty(value = "状态 0-未处理,1-已批准,2-已拒绝")
+    private Integer status;
+
+    @ApiModelProperty(value = "状态 0-未处理,1-已批准,2-已拒绝")
+    private String statusN;
+
+    private String mergeStatus;
+
+    private String mergeStatusN;
+}

+ 1 - 1
common/src/main/java/com/jpsoft/shinestar/modules/business/entity/WorkScheduleAttendance.java

@@ -98,7 +98,7 @@ public class WorkScheduleAttendance {
     /**
      * 工作状态
      */
-    @ApiModelProperty(value = "工作状态(1-工作,2-外出,3-出差,4-休假)")
+    @ApiModelProperty(value = "工作状态(1-工作,2-外出,3-出差,4-休假,5-年假)")
     private String workStatus;
     /**
      * 备注

+ 44 - 1
common/src/main/java/com/jpsoft/shinestar/modules/business/entity/YearRequestForLeaveInfo.java

@@ -4,6 +4,8 @@ import java.io.Serializable;
 import java.util.Date;
 import java.text.SimpleDateFormat;
 import java.math.BigDecimal;
+
+import com.jpsoft.shinestar.modules.common.utils.TypeNameUtil;
 import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
@@ -65,6 +67,12 @@ public class YearRequestForLeaveInfo {
 	
 				@ApiModelProperty(value = "审核状态(0:审核中,1:同意,2:退回,3:拒绝,4:无需审核,6:已撤销)")
 	private Integer status;
+
+	@ApiModelProperty(value = "审批人ID")
+	private Long approvedId;
+
+	@ApiModelProperty(value = "审批意见")
+	private String approvalOpinions;
 	
 				@ApiModelProperty(value = "意见说明")
 	private String approvalExplain;
@@ -100,5 +108,40 @@ public class YearRequestForLeaveInfo {
 	
 				@ApiModelProperty(value = "流程实例编号")
 	private String procinstId;
-	
+
+	@ApiModelProperty(value = "请假人头像")
+	private String faceImageUrl;
+
+	@ApiModelProperty(value = "姓名")
+	private String studentName;
+
+	@ApiModelProperty(value = "身份证号")
+	private String idCard;
+
+	@ApiModelProperty(value = "请假类型(名称)")
+	private String leaveTypeN;
+
+	@ApiModelProperty(value = "班级编号")
+	private String classId;
+
+	@ApiModelProperty(value = "班级名称")
+	private String className;
+
+	@ApiModelProperty(value = "姓名")
+	private String approvedName;
+
+	public String getStatusN() {
+		String text = TypeNameUtil.getExamineTypeName(String.valueOf(status));
+		return text;
+        /*if (Integer.valueOf(0).equals(status)) {
+            return "未处理";
+        } else if (Integer.valueOf(1).equals(status)) {
+            return "已批准";
+        } else if (Integer.valueOf(2).equals(status)) {
+            return "已拒绝";
+        } else {
+            return "";
+        }*/
+	}
+
 		}

+ 6 - 0
common/src/main/java/com/jpsoft/shinestar/modules/business/service/YearRequestForLeaveInfoService.java

@@ -2,6 +2,9 @@ package com.jpsoft.shinestar.modules.business.service;
 
 import java.util.List;
 import java.util.Map;
+
+import com.jpsoft.shinestar.modules.base.entity.PersonInfo;
+import com.jpsoft.shinestar.modules.base.entity.PersonPopedom;
 import com.jpsoft.shinestar.modules.business.entity.YearRequestForLeaveInfo;
 import com.github.pagehelper.Page;
 import com.jpsoft.shinestar.modules.common.dto.Sort;
@@ -14,4 +17,7 @@ public interface YearRequestForLeaveInfoService {
 	int delete(String id);
 	List<YearRequestForLeaveInfo> list();
 	Page<YearRequestForLeaveInfo> pageSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+	Page<YearRequestForLeaveInfo> pageMobileSearch(Map<String, Object> searchParams, int pageNum, int pageSize, boolean count, List<Sort> sortList);
+	void approvalRequestForLeave(PersonInfo personInfo, String id, String approvalOpinions, String approvalExplain, int status) throws Exception;
+	String leaveSubmit(PersonPopedom personPopedom,String startTime, String endTime, String startTimeQuantum, String endTimeQuantum, String imageUrl, String reason, String days, String formId, String activityId, String draft, String id) throws Exception;
 }

+ 426 - 3
common/src/main/java/com/jpsoft/shinestar/modules/business/service/impl/YearRequestForLeaveInfoServiceImpl.java

@@ -1,9 +1,31 @@
 package com.jpsoft.shinestar.modules.business.service.impl;
 
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.math.BigDecimal;
+import java.util.*;
 import javax.annotation.Resource;
+
+import cn.hutool.core.date.DateUtil;
+import com.jpsoft.shinestar.config.WxConfig;
+import com.jpsoft.shinestar.modules.base.entity.ApprovalConfig;
+import com.jpsoft.shinestar.modules.base.entity.CompanyInfo;
+import com.jpsoft.shinestar.modules.base.entity.PersonInfo;
+import com.jpsoft.shinestar.modules.base.entity.PersonPopedom;
+import com.jpsoft.shinestar.modules.base.service.ApprovalConfigService;
+import com.jpsoft.shinestar.modules.base.service.CompanyInfoService;
+import com.jpsoft.shinestar.modules.base.service.PersonInfoService;
+import com.jpsoft.shinestar.modules.base.service.PersonPopedomService;
+import com.jpsoft.shinestar.modules.common.utils.JwtUtil2;
+import com.jpsoft.shinestar.modules.common.utils.WechatMessageUtil;
+import com.jpsoft.shinestar.modules.workflow.entity.ProcinstActUser;
+import com.jpsoft.shinestar.modules.workflow.entity.ProcinstActivity;
+import com.jpsoft.shinestar.modules.workflow.service.ProcinstActUserService;
+import com.jpsoft.shinestar.modules.workflow.service.ProcinstActivityService;
+import com.jpsoft.shinestar.modules.workflow.service.ProcinstService;
+import org.apache.commons.lang3.StringUtils;
+import org.joda.time.DateTime;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 import com.jpsoft.shinestar.modules.business.dao.YearRequestForLeaveInfoDAO;
@@ -19,6 +41,37 @@ public class YearRequestForLeaveInfoServiceImpl implements YearRequestForLeaveIn
 	@Resource(name="yearRequestForLeaveInfoDAO")
 	private YearRequestForLeaveInfoDAO yearRequestForLeaveInfoDAO;
 
+	@Autowired
+	private ProcinstService procinstService;
+
+	@Autowired
+	private ProcinstActivityService procinstActivityService;
+
+	@Autowired
+	private ProcinstActUserService procinstActUserService;
+
+	@Autowired
+	private PersonInfoService personInfoService;
+
+	@Autowired
+	private PersonPopedomService personPopedomService;
+
+	@Autowired
+	private ApprovalConfigService approvalConfigService;
+
+	@Value("${jwt.secret}")
+	private String jwtSecret;
+
+	@Autowired
+	private WxConfig wxConfig;
+
+	@Autowired
+	private CompanyInfoService companyInfoService;
+
+	@Autowired
+	RabbitTemplate rabbitTemplate;
+
+
 	@Override
 	public YearRequestForLeaveInfo get(String id) {
 		// TODO Auto-generated method stub
@@ -67,4 +120,374 @@ public class YearRequestForLeaveInfoServiceImpl implements YearRequestForLeaveIn
         
         return page;
 	}
+
+	@Override
+	public Page<YearRequestForLeaveInfo> pageMobileSearch(Map<String, Object> searchParams, int pageNumber, int pageSize, boolean count, List<Sort> sortList) {
+		Page<YearRequestForLeaveInfo> page = PageHelper.startPage(pageNumber, pageSize, count).doSelectPage(() -> {
+			yearRequestForLeaveInfoDAO.mobileSearch(searchParams, sortList);
+		});
+		return page;
+	}
+
+
+	@Override
+	public String leaveSubmit(PersonPopedom personPopedom, String startTime, String endTime, String startTimeQuantum, String endTimeQuantum, String imageUrl, String reason, String days, String formId, String activity, String draft, String id) throws Exception {
+		try {
+			YearRequestForLeaveInfo yearRequestForLeaveInfo = null;
+			if (StringUtils.isNotEmpty(id)) {
+				yearRequestForLeaveInfo = yearRequestForLeaveInfoDAO.get(id);
+
+			} else {
+				yearRequestForLeaveInfo = new YearRequestForLeaveInfo();
+				yearRequestForLeaveInfo.setId(UUID.randomUUID().toString());
+				yearRequestForLeaveInfo.setDelFlag(false);
+			}
+
+			String startTimeStr = DateUtil.format(DateUtil.parse(startTime), "yyyy-MM-dd");
+			String endTimeStr = DateUtil.format(DateUtil.parse(endTime), "yyyy-MM-dd");
+			if ("0".equals(startTimeQuantum)) {
+				startTimeStr = startTimeStr + " " + "00:00:00";
+			}
+			if ("1".equals(startTimeQuantum)) {
+				startTimeStr = startTimeStr + " " + "12:00:00";
+			}
+			if ("0".equals(endTimeQuantum)) {
+				endTimeStr = endTimeStr + " " + "12:00:00";
+			}
+			if ("1".equals(endTimeQuantum)) {
+				endTimeStr = endTimeStr + " " + "23:59:59";
+			}
+			yearRequestForLeaveInfo.setStartTime(DateUtil.parse(startTimeStr, "yyyy-MM-dd HH:mm:ss"));
+			/*if (days.contains(".")){
+				Integer n  = days.indexOf(".");
+				String intDays = days.substring(0,n);
+				requestForLeaveInfo.setEndTime(DateUtil.offsetDay(requestForLeaveInfo.getStartTime(),Integer.parseInt(intDays)));
+				requestForLeaveInfo.setEndTime(DateUtil.offsetHour(requestForLeaveInfo.getStartTime(),12));
+			}else {
+				requestForLeaveInfo.setEndTime(DateUtil.offsetDay(requestForLeaveInfo.getStartTime(),Integer.parseInt(days)));
+			}*/
+
+
+			yearRequestForLeaveInfo.setEndTime(DateUtil.parse(endTimeStr, "yyyy-MM-dd HH:mm:ss"));
+			yearRequestForLeaveInfo.setImageUrl(imageUrl);
+			yearRequestForLeaveInfo.setReason(reason);
+			yearRequestForLeaveInfo.setPersonId(personPopedom.getPersonId());
+			yearRequestForLeaveInfo.setPersonPopedomId(personPopedom.getId());
+			yearRequestForLeaveInfo.setCreateTime(new Date());
+			yearRequestForLeaveInfo.setStatus(-99);
+
+			yearRequestForLeaveInfo.setStartTimeQuantum(startTimeQuantum);
+			yearRequestForLeaveInfo.setEndTimeQuantum(endTimeQuantum);
+			yearRequestForLeaveInfo.setDays(days);
+			if (StringUtils.isNotEmpty(id)) {
+
+				update(yearRequestForLeaveInfo);
+			} else {
+				insert(yearRequestForLeaveInfo);
+			}
+
+			String ide = yearRequestForLeaveInfo.getId();
+
+			if ("1".equals(draft)) {
+				Map<String, Object> conditions = new HashMap<>();
+				conditions.put("day", Double.valueOf(days));
+
+				String procInstId = procinstService.addProcInst(ide, "年假", formId, personPopedom, activity, null, null);
+
+				yearRequestForLeaveInfo.setProcinstId(procInstId);
+				yearRequestForLeaveInfo.setStatus(0);
+				update(yearRequestForLeaveInfo);
+
+
+				ProcinstActivity procinstActivity = procinstActivityService.findByActivityIndexAndProcinstId(1, procInstId);
+
+
+				if (procinstActivity != null) {
+
+					List<ProcinstActUser> procinstActUserList = procinstActUserService.findByProcinstActivityIdActionType(procinstActivity.getId(), "0", "1");
+					if (procinstActUserList.size() > 0) {
+
+						new Thread(() -> {
+							for (ProcinstActUser procinstActUser : procinstActUserList) {
+								try {
+									PersonInfo personInfo = personInfoService.get(Long.parseLong(procinstActUser.getUserId()));
+
+									//提交人
+									PersonInfo personInfo1 = personInfoService.get(personPopedom.getPersonId());
+									String accessToken = JwtUtil2.createToken(jwtSecret, personInfo.getId() + "", DateTime.now().plusHours(30 * 24).toDate());
+									WechatMessageUtil.sendEvenMessage(personInfo.getOpenId(), "有一条新的请年假信息待审核", personInfo1.getName(), com.jpsoft.shinestar.modules.common.utils.StringUtils.getApprovalNo(), "前往处理", wxConfig.getPortalUrl() + "xsy/approval/infosp?id=" + ide + "&procinstActUserId=" + procinstActUser.getId() + "&formId=" + formId + "&token=" + accessToken, wxConfig.getAppId(), wxConfig.getAppSecret());
+								} catch (Exception ex) {
+									ex.printStackTrace();
+								}
+
+							}
+						}).start();
+					}
+				}
+			}
+
+			return ide;
+
+		} catch (Exception ex) {
+			throw new Exception(ex.getMessage());
+		}
+	}
+
+
+	@Override
+	public void approvalRequestForLeave(PersonInfo personInfo, String ids, String approvalOpinions, String approvalExplain, int status) throws Exception {
+
+		//审核人
+		PersonPopedom personPopedom = personPopedomService.get(personInfo.getPopedom());
+		List<String> idList = Arrays.asList(ids.split(","));
+		if (idList.size() > 0) {
+			for (String id : idList) {
+				YearRequestForLeaveInfo yearRequestForLeaveInfo = get(id);
+				if (yearRequestForLeaveInfo.getStatus() == 0) {
+					//申请人
+					PersonPopedom personPopedom1 = personPopedomService.get(yearRequestForLeaveInfo.getPersonPopedomId());
+					PersonInfo personInfo1 = personInfoService.get(personPopedom1.getPersonId());
+
+					if (!yearRequestForLeaveInfo.getApprovedPersonPopedomId().equals(personInfo.getPopedom())) {
+						throw new Exception("无权审核");
+					}
+					String approvalPersonIdStr = yearRequestForLeaveInfo.getApprovalPersonIdStr();
+					String approvalStatusStr = yearRequestForLeaveInfo.getApprovalStatusStr();
+					String approvalTimeStr = yearRequestForLeaveInfo.getApprovalTimeStr();
+					String approvalContentStr = yearRequestForLeaveInfo.getApprovalContentStr();
+
+
+					//同意
+					if (status == 1) {
+
+						List<PersonPopedom> personPopedomList = new ArrayList<>();
+
+						String companyId = "";
+						//申请人的公司
+						CompanyInfo companyInfo = companyInfoService.get(personPopedom1.getCompanyId());
+
+						if (!"1".equals(companyInfo.getUnitType())) {
+
+							CompanyInfo parent = null;
+							int loopNum = 10;
+							int zIndex = 0;
+							if (org.apache.commons.lang3.StringUtils.isNotEmpty(companyInfo.getParentId())) {
+								parent = companyInfoService.get(companyInfo.getParentId());
+							}
+							while (parent != null && zIndex < loopNum) {
+								ApprovalConfig approvalConfig = approvalConfigService.findByCompanyIdAndType(companyInfo.getId(), "7");
+								if (approvalConfig != null) {
+									companyId = companyInfo.getId();
+									break;
+								} else if (org.apache.commons.lang3.StringUtils.isBlank(companyInfo.getParentId())) {
+									break;
+								} else {
+									parent = companyInfoService.get(parent.getParentId());
+									companyInfo = companyInfoService.get(companyInfo.getParentId());
+									zIndex++;
+								}
+							}
+
+							/*CompanyInfo parent = null;
+							int loopNum = 10;
+							int zIndex = 0;
+
+							if (StringUtils.isNotEmpty(companyInfo.getParentId())) {
+								parent = companyInfoService.get(companyInfo.getParentId());
+							}
+							while (parent != null && zIndex < loopNum) {
+
+								if ("1".equals(parent.getUnitType())) {
+									//如果是单位类型是公司或没有上级单位,则不再往上级查找
+									companyId = parent.getId();
+									break;
+								}
+								else if (StringUtils.isEmpty(companyInfo.getParentId())){
+									break;
+								}
+								else {
+									parent = companyInfoService.get(parent.getParentId());
+									zIndex++;
+								}
+							}*/
+
+
+						} else {
+							companyId = companyInfo.getId();
+						}
+
+						//默认审核层级
+						int level = 2;
+
+						if (StringUtils.isNotBlank(companyId)) {
+
+							ApprovalConfig approvalConfig = approvalConfigService.findByCompanyIdAndType(companyId, "7");
+							if (approvalConfig != null) {
+								BigDecimal days = new BigDecimal(approvalConfig.getDays());
+								if (days.compareTo(new BigDecimal(yearRequestForLeaveInfo.getDays())) > 0) {
+									level = Integer.valueOf(approvalConfig.getLevel());
+								} else {
+									level = 10;
+								}
+							} else {
+								if (new BigDecimal(3).compareTo(new BigDecimal(yearRequestForLeaveInfo.getDays())) <= 0) {
+									level = 10;
+								}
+							}
+
+						}
+
+						//计算当前审核的是第几级审批
+						int nowLevel = 1;
+						if (StringUtils.isNotBlank(approvalPersonIdStr)) {
+							nowLevel = nowLevel + Arrays.asList(approvalPersonIdStr.split(",")).size();
+						}
+						//判断已审核人总数和需要审核级数
+						if (nowLevel < level) {
+							List<PersonPopedom> dataList = personPopedomService.findApprovalList(personInfo, "4", null, null);
+							if (dataList.size() > 0) {
+								personPopedomList.add(dataList.get(0));
+							}
+
+						}
+
+						//判断审批人数量,审批人数据为0,审批流程走完
+						if (personPopedomList.size() == 0) {
+							yearRequestForLeaveInfo.setApprovedTime(new Date());
+							yearRequestForLeaveInfo.setStatus(status);
+							yearRequestForLeaveInfo.setApprovalOpinions(approvalOpinions);
+							yearRequestForLeaveInfo.setApprovalExplain(approvalExplain);
+							yearRequestForLeaveInfo.setUpdateBy(personInfo.getPopedom());
+							yearRequestForLeaveInfo.setUpdateTime(new Date());
+							update(yearRequestForLeaveInfo);
+
+							int a1 = "0".equals(yearRequestForLeaveInfo.getStartTimeQuantum()) ? 0 : 43200000;
+							int a2 = "0".equals(yearRequestForLeaveInfo.getEndTimeQuantum()) ? 43200000 : 86400000;
+							;
+
+							Date startLong = new Date(yearRequestForLeaveInfo.getStartTime().getTime() + a1);
+							Date endLong = new Date(yearRequestForLeaveInfo.getEndTime().getTime() + a2);
+
+							//时间符合为休假,
+
+							String initStatus = personInfo1.getWorkStatus();
+							if (startLong.getTime() < new Date().getTime() && endLong.getTime() > new Date().getTime()) {
+								personInfo1.setWorkStatus("4");//请假
+								personInfo1.setUpdateBy(personPopedom.getPersonId().toString());
+								personInfo1.setUpdateTime(new Date());
+								personInfoService.update(personInfo1);
+							}
+
+							if (personInfo1.getWorkStatus() == null) {
+								personInfo1.setWorkStatus("1");
+								initStatus = "1";
+							}
+							//休假,还没开始
+							if (startLong.getTime() > new Date().getTime()) {
+
+								//防止连续请假,造成的时间重叠
+								Long milliseconds = startLong.getTime() - new Date().getTime() + 5000;
+								String p = "A_" + personInfo1.getId() + "_" + personInfo1.getWorkStatus() + "_" + personPopedom.getPersonId();
+								rabbitTemplate.convertAndSend("updateWorkStatusExchange", "updateWorkStatus", p, (message) -> {
+									//延时单位毫秒
+									message.getMessageProperties().setHeader("x-delay", milliseconds);
+									return message;
+								});
+							}
+							//休假,结束
+							if (endLong.getTime() > new Date().getTime()) {
+								String p = "B_" + personInfo1.getId() + "_" + initStatus + "_" + personPopedom.getPersonId();
+								//防止连续请假,造成的时间重叠
+								Long milliseconds = endLong.getTime() - new Date().getTime() - 5000;
+
+								rabbitTemplate.convertAndSend("updateWorkStatusExchange", "updateWorkStatus", p, (message) -> {
+									//延时单位毫秒
+									message.getMessageProperties().setHeader("x-delay", milliseconds);
+									return message;
+								});
+							}
+
+
+						}
+						//审批人数据不为0
+						else {
+							PersonPopedom personPopedom2 = personPopedomList.get(0);
+							if (StringUtils.isNotBlank(approvalPersonIdStr)) {
+								yearRequestForLeaveInfo.setApprovalPersonIdStr(approvalPersonIdStr + "," + yearRequestForLeaveInfo.getApprovedPersonPopedomId());
+								yearRequestForLeaveInfo.setApprovalStatusStr(approvalStatusStr + "," + status);
+								yearRequestForLeaveInfo.setApprovalTimeStr(approvalTimeStr + "," + DateUtil.format(new Date(), "yyyy-MM-dd HH:mm"));
+								yearRequestForLeaveInfo.setApprovalContentStr(approvalContentStr + "," + approvalExplain);
+							} else {
+								yearRequestForLeaveInfo.setApprovalPersonIdStr(yearRequestForLeaveInfo.getApprovedPersonPopedomId());
+								yearRequestForLeaveInfo.setApprovalStatusStr(String.valueOf(status));
+								yearRequestForLeaveInfo.setApprovalTimeStr(DateUtil.format(new Date(), "yyyy-MM-dd HH:mm"));
+								yearRequestForLeaveInfo.setApprovalContentStr(approvalExplain);
+							}
+
+							yearRequestForLeaveInfo.setApprovedPersonPopedomId(personPopedom2.getId());
+							yearRequestForLeaveInfo.setStatus(0);
+							yearRequestForLeaveInfo.setApprovalOpinions("");
+							yearRequestForLeaveInfo.setApprovedTime(null);
+							update(yearRequestForLeaveInfo);
+
+							new Thread(() -> {
+								PersonInfo approvalPerson = personInfoService.get(personPopedom2.getPersonId());
+
+								String typeN = "年假";
+								String url = "master/attendance/verifyLeaveInfo?id=";
+
+								String accessToken = JwtUtil2.createToken(jwtSecret, approvalPerson.getId() + "", DateTime.now().plusHours(30 * 24).toDate());
+								WechatMessageUtil.sendEvenMessage(approvalPerson.getOpenId(), "有一条新的" + typeN + "信息待审核", personInfo1.getName(), yearRequestForLeaveInfo.getId().substring(0, 5), "前往处理", wxConfig.getPortalUrl() + url + yearRequestForLeaveInfo.getId() + "&exchange=1&role_id=" + personPopedom2.getId() + "&token=" + accessToken, wxConfig.getAppId(), wxConfig.getAppSecret());
+
+							}).start();
+
+
+						}
+
+						//     }
+
+
+					}
+					//拒绝
+					if (status == 2) {
+						yearRequestForLeaveInfo.setApprovedTime(new Date());
+						yearRequestForLeaveInfo.setStatus(status);
+						yearRequestForLeaveInfo.setApprovalOpinions(approvalOpinions);
+						yearRequestForLeaveInfo.setApprovalExplain(approvalExplain);
+						yearRequestForLeaveInfo.setUpdateBy(personPopedom.getId());
+						yearRequestForLeaveInfo.setUpdateTime(new Date());
+						update(yearRequestForLeaveInfo);
+
+					}
+
+					//通知申请人
+
+					if (yearRequestForLeaveInfo.getStatus() != 0) {
+						new Thread(() -> {
+							String firstMessage = "";
+							String getstatus = "";
+
+							if (1 == status) {
+								firstMessage = "审核通过";
+								getstatus = "1";
+
+							} else {
+								firstMessage = "审核拒绝";
+								getstatus = "2";
+							}
+
+
+							String url = "master/attendance/leaveInfo";
+
+
+							String accessToken = JwtUtil2.createToken(jwtSecret, personInfo1.getId() + "", DateTime.now().plusHours(30 * 24).toDate());
+							WechatMessageUtil.sendExamine(personInfo1.getOpenId(), firstMessage, personInfo1.getName(), getstatus, firstMessage, "请假", "前往查看", wxConfig.getPortalUrl() + url + "?id=" + yearRequestForLeaveInfo.getId() + "&exchange=1&role_id=" + personPopedom1.getId() + "&token=" + accessToken, wxConfig.getAppId(), wxConfig.getAppSecret());
+						}).start();
+
+
+					}
+				}
+			}
+		}
+	}
 }

+ 9 - 0
common/src/main/java/com/jpsoft/shinestar/modules/common/utils/TypeNameUtil.java

@@ -58,6 +58,11 @@ public class TypeNameUtil {
             operationName = "9";
         }
 
+        //年假
+        if ("yearLeaveWork".equals(formId)){
+            operationName = "11";
+        }
+
 
         return operationName;
     }
@@ -101,6 +106,10 @@ public class TypeNameUtil {
         if ("9".equals(type)){
             operationNameStr = "接待进餐";
         }
+        //年假
+        if ("11".equals(type)){
+            operationNameStr = "年假";
+        }
 
 
         return operationNameStr;

+ 92 - 0
common/src/main/java/com/jpsoft/shinestar/modules/workflow/service/impl/ProcinstActUserServiceImpl.java

@@ -45,6 +45,9 @@ public class ProcinstActUserServiceImpl implements ProcinstActUserService {
     @Autowired
     private RequestForLeaveInfoService requestForLeaveInfoService;
 
+    @Autowired
+    private YearRequestForLeaveInfoService yearRequestForLeaveInfoService;
+
     @Autowired
     private PersonInfoService personInfoService;
 
@@ -224,6 +227,14 @@ public class ProcinstActUserServiceImpl implements ProcinstActUserService {
                         businessStatus = customerDiningRecord.getStatus();
 					}
 
+                    //请假
+                    YearRequestForLeaveInfo yearRequestForLeaveInfo = null;
+                    if ("11".equals(procinst.getType())) {
+                        yearRequestForLeaveInfo = yearRequestForLeaveInfoService.get(procinst.getBusinessKey());
+                        businessStatus = String.valueOf(yearRequestForLeaveInfo.getStatus());
+
+                    }
+
                     if (!"0".equals(businessStatus)){
                         throw new Exception("业务非待审核状态");
                     }
@@ -369,6 +380,13 @@ public class ProcinstActUserServiceImpl implements ProcinstActUserService {
 										customerDiningRecordService.update(customerDiningRecord);
 									}
 
+                                    //年假
+                                    if ("11".equals(procinst.getType())) {
+                                        yearRequestForLeaveInfo.setStatus(Integer.parseInt(status));
+                                        yearRequestForLeaveInfo.setUpdateTime(new Date());
+                                        yearRequestForLeaveInfoService.update(yearRequestForLeaveInfo);
+                                    }
+
                                 }
                                 else {
                                     log.warn("有下个步骤,修改下个步骤的状态");
@@ -414,6 +432,9 @@ public class ProcinstActUserServiceImpl implements ProcinstActUserService {
                                                     if ("9".equals(procinst.getType())){
                                                     	typeName = "接待就餐";
 													}
+                                                    if ("11".equals(procinst.getType())) {
+                                                        typeName = "年假";
+                                                    }
                                                    WechatMessageUtil.sendEvenMessage(personInfo.getOpenId(), "有一条新的" + typeName + "信息待审核", personInfo.getName(), com.jpsoft.shinestar.modules.common.utils.StringUtils.getApprovalNo(), "前往处理", wxConfig.getPortalUrl() + "xsy/approval/infosp?id=" + procinst.getBusinessKey() + "&procinstActUserId=" + procinstActUser1.getId() + "&formId=" + processSet.getFormId() + "&token=" + accessToken, wxConfig.getAppId(), wxConfig.getAppSecret());
                                                 } catch (Exception ex) {
                                                     ex.printStackTrace();
@@ -485,6 +506,12 @@ public class ProcinstActUserServiceImpl implements ProcinstActUserService {
                                                 personInfo1 = personInfoService.get(personPopedom1.getPersonId());
 
                                             }
+                                            if ("11".equals(procinst.getType())) {
+                                                typeName = "年假";
+                                                YearRequestForLeaveInfo yearRequestForLeaveInfo1 = yearRequestForLeaveInfoService.get(procinst.getBusinessKey());
+                                                PersonPopedom personPopedom1 = personPopedomService.get(yearRequestForLeaveInfo1.getPersonPopedomId());
+                                                personInfo1 = personInfoService.get(personPopedom1.getPersonId());
+                                            }
                                             WechatMessageUtil.sendCCRemindMessage(personInfo.getOpenId(), "[抄送]" + typeName +"审核通过", personInfo1.getName(), typeName, typeName+"审核", DateUtil.format(procinst.getCreateTime(),"yyyy-MM-dd HH:mm:ss"),"已抄送",wxConfig.getPortalUrl() + "xsy/approval/infosp?id=" + procinst.getBusinessKey() + "&procinstActUserId=" + ccProcinstActUer.getId() + "&formId=" + processSet.getFormId() + "&token=" + accessToken, wxConfig.getAppId(), wxConfig.getAppSecret());
                                         }
                                     }).start();
@@ -584,6 +611,15 @@ public class ProcinstActUserServiceImpl implements ProcinstActUserService {
 									customerDiningRecord.setUpdateTime(new Date());
 									customerDiningRecordService.update(customerDiningRecord);
 								}
+
+                                //年假
+                                if ("11".equals(procinst.getType())) {
+                                    if (yearRequestForLeaveInfo.getStatus() == 0){
+                                        yearRequestForLeaveInfo.setStatus(Integer.parseInt(status));
+                                    }
+                                    yearRequestForLeaveInfo.setUpdateTime(new Date());
+                                    yearRequestForLeaveInfoService.update(yearRequestForLeaveInfo);
+                                }
                             }
                         }
 
@@ -676,6 +712,13 @@ public class ProcinstActUserServiceImpl implements ProcinstActUserService {
 									customerDiningRecord.setUpdateTime(new Date());
 									customerDiningRecordService.update(customerDiningRecord);
 								}
+
+                                //年假
+                                if ("11".equals(procinst.getType())) {
+                                    yearRequestForLeaveInfo.setStatus(Integer.parseInt(status));
+                                    yearRequestForLeaveInfo.setUpdateTime(new Date());
+                                    yearRequestForLeaveInfoService.update(yearRequestForLeaveInfo);
+                                }
                             }
                         }
                     }
@@ -818,6 +861,13 @@ public class ProcinstActUserServiceImpl implements ProcinstActUserService {
 									customerDiningRecord.setUpdateTime(new Date());
 									customerDiningRecordService.update(customerDiningRecord);
 								}
+
+                                //年假
+                                if ("3".equals(procinst.getType())) {
+                                    yearRequestForLeaveInfo.setStatus(Integer.parseInt(status));
+                                    yearRequestForLeaveInfo.setUpdateTime(new Date());
+                                    yearRequestForLeaveInfoService.update(yearRequestForLeaveInfo);
+                                }
                             }
                             else {
                                 log.warn("有下个步骤,修改下个步骤的状态");
@@ -861,6 +911,9 @@ public class ProcinstActUserServiceImpl implements ProcinstActUserService {
                                                 if ("9".equals(procinst.getType())){
                                                 	typeName = "接待就餐";
 												}
+                                                if ("11".equals(procinst.getType())){
+                                                    typeName = "年假";
+                                                }
                                                 WechatMessageUtil.sendEvenMessage(personInfo.getOpenId(), "有一条新的" + typeName + "信息待审核", personInfo.getName(), com.jpsoft.shinestar.modules.common.utils.StringUtils.getApprovalNo(), "前往处理", wxConfig.getPortalUrl() + "xsy/approval/infosp?id=" + procinst.getBusinessKey() + "&procinstActUserId=" + procinstActUser1.getId() + "&formId=" + processSet.getFormId() + "&token=" + accessToken, wxConfig.getAppId(), wxConfig.getAppSecret());
                                             } catch (Exception ex) {
                                                 ex.printStackTrace();
@@ -932,6 +985,12 @@ public class ProcinstActUserServiceImpl implements ProcinstActUserService {
                                             personInfo1 = personInfoService.get(personPopedom1.getPersonId());
 
                                         }
+                                        if ("11".equals(procinst.getType())) {
+                                            typeName = "年假";
+                                            YearRequestForLeaveInfo yearRequestForLeaveInfo1 = yearRequestForLeaveInfoService.get(procinst.getBusinessKey());
+                                            PersonPopedom personPopedom1 = personPopedomService.get(yearRequestForLeaveInfo1.getPersonPopedomId());
+                                            personInfo1 = personInfoService.get(personPopedom1.getPersonId());
+                                        }
                                         WechatMessageUtil.sendCCRemindMessage(personInfo.getOpenId(), "[抄送]" + typeName +"审核通过", personInfo1.getName(), typeName, typeName+"审核", DateUtil.format(procinst.getCreateTime(),"yyyy-MM-dd HH:mm:ss"),"已抄送",wxConfig.getPortalUrl() + "xsy/approval/info?id=" + procinst.getBusinessKey() + "&formId=" + processSet.getFormId() + "&token=" + accessToken, wxConfig.getAppId(), wxConfig.getAppSecret());
                                     }
                                 }).start();
@@ -1023,6 +1082,13 @@ public class ProcinstActUserServiceImpl implements ProcinstActUserService {
 								customerDiningRecord.setUpdateTime(new Date());
 								customerDiningRecordService.update(customerDiningRecord);
 							}
+
+                            //年假
+                            if ("11".equals(procinst.getType())) {
+                                yearRequestForLeaveInfo.setStatus(Integer.parseInt(status));
+                                yearRequestForLeaveInfo.setUpdateTime(new Date());
+                                yearRequestForLeaveInfoService.update(yearRequestForLeaveInfo);
+                            }
                         }
                     }
 
@@ -1249,6 +1315,32 @@ public class ProcinstActUserServiceImpl implements ProcinstActUserService {
 							}).start();
 						}
 					}
+
+
+                    //年假
+                    if ("11".equals(procinst.getType())) {
+                        YearRequestForLeaveInfo yearRequestForLeaveInfo1 = yearRequestForLeaveInfoService.get(procinst.getBusinessKey());
+
+                        if (!"0".equals(yearRequestForLeaveInfo1.getStatus())) {
+                            new Thread(() -> {
+                                String statusN = "";
+                                if ("1".equals(yearRequestForLeaveInfo1.getStatus())) {
+                                    statusN = "同意";
+                                }
+                                if ("3".equals(yearRequestForLeaveInfo1.getStatus())) {
+                                    statusN = "拒绝";
+                                }
+                                PersonPopedom personPopedom1 = personPopedomService.findByIdIgnoreDel(yearRequestForLeaveInfo1.getPersonPopedomId());
+
+                                PersonInfo person = personInfoService.findByIdIgnoreDel(personPopedom1.getPersonId());
+
+                                String accessToken = JwtUtil2.createToken(jwtSecret, person.getId() + "", DateTime.now().plusHours(30 * 24).toDate());
+                                WechatMessageUtil.sendExamine(person.getOpenId(), "年假审核" + statusN, person.getName(), "1", statusN, "年假", "前往查看", wxConfig.getPortalUrl() + "xsy/approval/info?id=" + yearRequestForLeaveInfo1.getId() + "&formId=" + processSet.getFormId() + "&token=" + accessToken, wxConfig.getAppId(), wxConfig.getAppSecret());
+                            }).start();
+
+
+                        }
+                    }
                 }
             }
         }

+ 0 - 1
common/src/main/java/com/jpsoft/shinestar/modules/workflow/service/impl/ProcinstServiceImpl.java

@@ -332,6 +332,5 @@ public class ProcinstServiceImpl implements ProcinstService {
 			customerDiningRecord.setUpdateTime(new Date());
 			customerDiningRecordService.update(customerDiningRecord);
 		}
-
 	}
 }

+ 142 - 7
common/src/main/resources/mapper/business/YearRequestForLeaveInfo.xml

@@ -18,6 +18,11 @@
 			<result property="updateTime" column="update_time" />
 			<result property="delFlag" column="del_flag" />
 			<result property="status" column="status_" />
+			<result property="faceImageUrl" column="face_image_url"/>
+			<result property="studentName" column="student_name"/>
+			<result property="idCard" column="id_card"/>
+			<result property="classId" column="class_company_id"/>
+			<result property="className" column="class_company_name"/>
 			<result property="approvalExplain" column="approval_explain" />
 			<result property="approvedTime" column="approved_time" />
 			<result property="startTimeQuantum" column="start_time_quantum" />
@@ -161,16 +166,146 @@
 	</select>
 	<select id="search" parameterType="hashmap" resultMap="YearRequestForLeaveInfoMap">
 		<![CDATA[
-			select * from business_year_request_for_leave_info
+			select a.*,
+			b.face_image_url,
+			b.name_ as student_name,
+			b.id_card as id_card,
+			d.id_ as class_company_id,
+			d.name_ as class_company_name
+			from business_year_request_for_leave_info a
+			inner join base_person_info b on a.person_id = b.id_
+			inner join base_company_info d on b.company_id = d.id_
 		]]>
 		<where>
-			del_flag = false
-			<if test="searchParams.id != null">
-				and ID_ like #{searchParams.id}
+			a.del_flag = false
+			<if test='searchParams.name!=null'>
+				and b.name_ like #{searchParams.name}
+			</if>
+			<if test='searchParams.status!=null'>
+				and a.status_=#{searchParams.status}
+			</if>
+			<if test="searchParams.studentPersonID != null">
+				and a.student_person_id=#{searchParams.studentPersonID}
+			</if>
+			<if test="searchParams.teacherPersonID != null">
+				and a.teacher_person_id=#{searchParams.teacherPersonID}
+			</if>
+			<if test='searchParams.classId!=null'>
+				and b.company_id = #{searchParams.classId}
+			</if>
+			<if test='searchParams.leaveType!=null'>
+				and a.leave_type = #{searchParams.leaveType}
+			</if>
+			<if test='searchParams.leaveTypeSt!=null'>
+				<![CDATA[
+					and (CAST(a.days_ AS DECIMAL(10,6)) >= 4)
+				]]>
+			</if>
+			<if test='searchParams.requestStartTime!=null'>
+				<![CDATA[
+                    and a.create_time >= #{searchParams.requestStartTime}
+                ]]>
+			</if>
+			<if test='searchParams.requestEndTime!=null'>
+				<![CDATA[
+                    and a.create_time <= #{searchParams.requestEndTime}
+                ]]>
+			</if>
+			<if test='searchParams.startTime!=null'>
+				<![CDATA[
+                    and a.start_time <= #{searchParams.startTime}
+                ]]>
+			</if>
+			<if test='searchParams.endTime!=null'>
+				<![CDATA[
+                    and a.end_time >= #{searchParams.endTime}
+                ]]>
+			</if>
+			<if test='searchParams.endTime1!=null'>
+				<![CDATA[
+                    and a.end_time >= #{searchParams.endTime1}
+                ]]>
+			</if>
+			<if test='searchParams.endTime2!=null'>
+				<![CDATA[
+                    and a.end_time <= #{searchParams.endTime2}
+                ]]>
+			</if>
+
+			<if test='searchParams.auditStartTime!=null'>
+				<![CDATA[
+                    and b.update_time >= #{searchParams.auditStartTime}
+                ]]>
+			</if>
+			<if test='searchParams.requestEndTime!=null'>
+				<![CDATA[
+                    and a.update_time <= #{searchParams.requestEndTime}
+                ]]>
+			</if>
+			<if test="searchParams.companyCode != null">
+				and d.code_ like #{searchParams.companyCode}
+			</if>
+			<if test="searchParams.hqCompanyCode != null">
+				and d.code_ like #{searchParams.hqCompanyCode}
+			</if>
+			<if test="searchParams.hqStatus != null">
+				and b.hq_status = #{searchParams.hqStatus}
+			</if>
+			<if test="searchParams.hqStatus == null and searchParams.hqPerson != null">
+				<![CDATA[
+					and ifnull(b.hq_status,0)<>0
+				]]>
+			</if>
+			<if test="searchParams.personInfoList != null ">
+				<foreach collection="searchParams.personInfoList" item="item" index="index" open="and b.id_ in(" separator="," close=")">
+					#{item.id}
+				</foreach>
+			</if>
+		</where>
+		<foreach item="sort" collection="sortList" open="order by" separator=",">
+			a.${sort.name} ${sort.order}
+		</foreach>
+	</select>
+
+	<select id="mobileSearch" parameterType="hashmap" resultMap="YearRequestForLeaveInfoMap">
+		<![CDATA[
+			select a.*
+			from
+			business_year_request_for_leave_info a
+			left join  base_person_popedom b on a.person_popedom_id = b.id_
+			left join base_person_info c on a.person_id = c.id_
+		]]>
+		<where>
+			a.del_flag = false
+			and b.del_flag = false
+			and c.del_flag = false
+			<if test='searchParams.personId!=null'>
+				and a.person_id =#{searchParams.personId}
+			</if>
+			<if test='searchParams.approvedIdList!=null'>
+				<foreach collection="searchParams.approvedIdList" index="index" item="item" open="and a.approved_id in(" separator="," close=")">
+					#{item}
+				</foreach>
+			</if>
+			<if test='searchParams.type!=null'>
+				<if test='searchParams.type == 0'>
+					and a.status_ = 0
+				</if>
+				<if test='searchParams.type == 1'>
+					and a.status_ != 0
+				</if>
+			</if>
+			<if test="searchParams.approvalPersonPopedomId != null">
+				and a.approved_person_popedom_id = #{searchParams.approvalPersonPopedomId}
+			</if>
+			<if test="searchParams.inCompanyInfo != null">
+				<foreach collection="searchParams.inCompanyInfo" item="companyInfo"  open="and b.company_id in (" separator="," close=")">
+					#{companyInfo.id}
+				</foreach>
 			</if>
 		</where>
-		<foreach item="sort" collection="sortList"  open="order by" separator=",">
-	        ${sort.name} ${sort.order}
-	 	</foreach>
+		<foreach item="sort" collection="sortList" open="order by" separator=",">
+			${sort.name} ${sort.order}
+		</foreach>
 	</select>
 </mapper>

+ 303 - 20
web/src/main/java/com/jpsoft/shinestar/modules/business/controller/YearRequestForLeaveInfoController.java

@@ -1,20 +1,40 @@
 package com.jpsoft.shinestar.modules.business.controller;
 
 import com.github.pagehelper.Page;
+import com.github.pagehelper.util.StringUtil;
+import com.jpsoft.shinestar.config.OSSConfig;
+import com.jpsoft.shinestar.modules.base.entity.CompanyInfo;
+import com.jpsoft.shinestar.modules.base.service.CompanyInfoService;
 import com.jpsoft.shinestar.modules.common.dto.MessageResult;
 import com.jpsoft.shinestar.modules.common.dto.Sort;
 import com.jpsoft.shinestar.modules.business.entity.YearRequestForLeaveInfo;
 import com.jpsoft.shinestar.modules.business.service.YearRequestForLeaveInfoService;
+import com.jpsoft.shinestar.modules.common.utils.IdCardUtils;
+import com.jpsoft.shinestar.modules.common.utils.OSSUtil;
+import com.jpsoft.shinestar.modules.sys.entity.DataDictionary;
+import com.jpsoft.shinestar.modules.sys.entity.User;
+import com.jpsoft.shinestar.modules.sys.service.UserService;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.ibatis.mapping.ResultMap;
 import com.jpsoft.shinestar.modules.common.utils.PojoUtils;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.joda.time.DateTime;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -25,6 +45,15 @@ public class YearRequestForLeaveInfoController {
 
     @Autowired
     private YearRequestForLeaveInfoService yearRequestForLeaveInfoService;
+
+    @Autowired
+    private UserService userService;
+
+    @Autowired
+    private CompanyInfoService companyInfoService;
+
+    @Autowired
+    private OSSConfig ossConfig;
 	
 	
 	@ApiOperation(value="创建空记录")
@@ -193,36 +222,290 @@ public class YearRequestForLeaveInfoController {
         return msgResult;
     }
 
-    @ApiOperation(value="列表")
-    @RequestMapping(value = "pageList",method = RequestMethod.POST)
-    public MessageResult<Map> pageList(
-            String id,
-            @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
-            @RequestParam(value="pageSize",defaultValue="20") int pageSize,
-            HttpServletRequest request){
-        String subject = (String)request.getAttribute("subject");
+    @ApiOperation(value = "请假记录分页")
+    @PostMapping(value = "pageList")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "classId", value = "所属班级", dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "status", value = "审批状态", dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "requestStartTime", value = "请假开始日期", paramType = "form"),
+            @ApiImplicitParam(name = "requestEndTime", value = "请假结束日期", paramType = "form"),
+            @ApiImplicitParam(name = "auditStartTime", value = "审核开始日期", paramType = "form"),
+            @ApiImplicitParam(name = "auditEndTime", value = "审核结束日期", paramType = "form"),
+            @ApiImplicitParam(name = "exportXls", value = "导出报表", paramType = "form")
+    })
+    public MessageResult<Object> pageList(
+            String name,
+            String classId,
+            Integer status,
+            @RequestParam(value="companyId",defaultValue="") String companyId,
+            @RequestParam(value="subordinate",defaultValue="false") Boolean subordinate,
+            @RequestParam(value="hqCompanyId",defaultValue="") String hqCompanyId,
+            @RequestParam(value="hqSubordinate",defaultValue="false") Boolean hqSubordinate,
+            @DateTimeFormat(pattern = "yyyy-MM-dd") Date requestStartTime,
+            @DateTimeFormat(pattern = "yyyy-MM-dd") Date requestEndTime,
+            @DateTimeFormat(pattern = "yyyy-MM-dd") Date auditStartTime,
+            @DateTimeFormat(pattern = "yyyy-MM-dd") Date auditEndTime,
+            @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
+            @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
+            @RequestParam(value = "exportFlag", defaultValue = "false") Boolean exportFlag,
+            @RequestAttribute String subject) {
+        MessageResult<Object> messageResult = new MessageResult<>();
+
+        try {
+            //当前用户ID
+            User user = userService.get(subject);
+
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("create_time", "desc"));
+
+            Map<String, Object> searchParams = new HashMap<>();
+
+            if(!userService.hasRole(user.getId(),"SYSADMIN")) {
+                //非系统管理员
+                CompanyInfo companyInfo = companyInfoService.get(user.getCompanyId());
+                searchParams.put("companyCode", companyInfo.getCode() + "%");
+            }
+
+            if (StringUtil.isNotEmpty(name)) {
+                searchParams.put("name", "%" + name + "%");
+            }
+
+            if (StringUtil.isNotEmpty(classId)) {
+                searchParams.put("classId", classId);
+            }
+
+            if (status!=null) {
+                searchParams.put("status", status);
+            }
+
+            if (requestStartTime!=null) {
+                searchParams.put("requestStartTime", requestStartTime);
+            }
+
+            if (requestEndTime!=null) {
+                searchParams.put("requestEndTime", new DateTime(requestEndTime).plusDays(1).plusSeconds(-1).toDate());
+            }
+
+            if (auditStartTime!=null) {
+                searchParams.put("auditStartTime", auditStartTime);
+            }
+
+            if (auditEndTime!=null) {
+                searchParams.put("auditEndTime", new DateTime(auditEndTime).plusDays(1).plusSeconds(-1).toDate());
+            }
+
+            if (com.jpsoft.shinestar.modules.common.utils.StringUtils.isNotEmpty(companyId)){
+                CompanyInfo companyInfo = companyInfoService.get(companyId);
+
+                if(subordinate){
+                    searchParams.put("companyCode", companyInfo.getCode() + "%");
+                }
+                else {
+                    searchParams.put("companyCode", companyInfo.getCode());
+                }
+            }
+
+            if (com.jpsoft.shinestar.modules.common.utils.StringUtils.isNotEmpty(hqCompanyId)){
+                if("hq1".equals(hqCompanyId)){
+                    //后勤1
+                    searchParams.put("hqStatus", "1");
+                }
+                else if("hq2".equals(hqCompanyId)){
+                    //后勤2
+                    searchParams.put("hqStatus", "2");
+                }
+                else {
+                    CompanyInfo companyInfo = companyInfoService.get(hqCompanyId);
+
+                    if (hqSubordinate) {
+                        searchParams.put("hqCompanyCode", companyInfo.getCode() + "%");
+                    } else {
+                        searchParams.put("hqCompanyCode", companyInfo.getCode());
+                    }
+                }
+
+                searchParams.put("hqPerson",true);
+            }
+
+            searchParams.put("pageIndex", pageIndex);
+            searchParams.put("pageSize", pageSize);
+
+            Page<YearRequestForLeaveInfo> page = yearRequestForLeaveInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
+
+            List<Map> mapList = new ArrayList<>();
+
+            for (YearRequestForLeaveInfo target : page) {
+                Map<String,Object> map = new HashMap<>();
+
+                map.put("id", target.getId());
+
+                map.put("faceImageUrl",target.getFaceImageUrl());
+                map.put("name", target.getStudentName());
+
+                map.put("statusN", target.getStatusN());
+
+                //身份证号
+                map.put("idCard", IdCardUtils.decrypt(target.getIdCard()));
+
+                //班级
+                map.put("className", target.getClassName());
 
-        //当前用户ID
-        System.out.println(subject);
+                map.put("approvedName", target.getApprovedName());
 
-        MessageResult<Map> msgResult = new MessageResult<>();
 
-        Map<String,Object> searchParams = new HashMap<>();
+                //请假时间
+                SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd");
 
-        List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("create_time","desc"));
+                String startTimeQuantum = "上午";
 
-        if (StringUtils.isNotEmpty(id)) {
-            searchParams.put("id","%" + id + "%");
+                if("1".equals(target.getStartTimeQuantum())){
+                    startTimeQuantum = "下午";
+                }
+
+                String endTimeQuantum = "上午";
+
+                if("1".equals(target.getEndTimeQuantum())){
+                    endTimeQuantum = "下午";
+                }
+
+                map.put("startTime",sdf1.format(target.getStartTime()));
+                map.put("days",target.getDays());
+
+                int days = differentDaysByMillisecond(target.getStartTime(),target.getEndTime());
+
+                if(days < 1) {
+                    if("0".equals(target.getStartTimeQuantum()) && "1".equals(target.getEndTimeQuantum())){
+                        //请假一天
+                        map.put("time", String.format("%s年%s", new DateTime(target.getStartTime()).getYear(),
+                                sdf2.format(target.getStartTime())
+                        ));
+                    }
+                    else{
+                        //请假半天
+                        map.put("time", String.format("%s年%s", new DateTime(target.getStartTime()).getYear(),
+                                sdf2.format(target.getStartTime()) + startTimeQuantum
+                        ));
+                    }
+
+                }
+                else{
+                    map.put("time", String.format("%s年%s至%s", new DateTime(target.getStartTime()).getYear(),
+                            sdf2.format(target.getStartTime())+ startTimeQuantum,
+                            sdf2.format(target.getEndTime())+ endTimeQuantum
+                    ));
+                }
+
+                //请假理由
+                map.put("reason", target.getReason());
+
+                //上传图片
+                map.put("imageUrl", target.getImageUrl());
+
+                //申请时间
+                map.put("createTime", sdf1.format(target.getCreateTime()));
+
+                //审批意见
+                map.put("remark", target.getRemark());
+
+                //审批时间
+                if(target.getUpdateTime()!=null) {
+                    map.put("updateTime", sdf1.format(target.getUpdateTime()));
+                }
+
+                map.put("approvalExplain", target.getApprovalExplain());
+
+                if(target.getApprovedTime()!=null) {
+                    map.put("approvedTime", sdf1.format(target.getApprovedTime()));
+                }
+
+                mapList.add(map);
+            }
+
+            if(exportFlag) {
+                String filePath = exportXls(mapList);
+                messageResult.setData(filePath);
+            }
+            else{
+                Map<String, Object> dataMap = PojoUtils.pageWrapper(page);
+                dataMap.put("data", mapList);
+                messageResult.setData(dataMap);
+            }
+
+            messageResult.setResult(true);
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+            messageResult.setResult(false);
         }
 
+        return messageResult;
+    }
 
-        Page<YearRequestForLeaveInfo> page = yearRequestForLeaveInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
 
+    /**
+     * 通过时间秒毫秒数判断两个时间的间隔
+     * @param date1
+     * @param date2
+     * @return
+     */
+    public int differentDaysByMillisecond(Date date1,Date date2)
+    {
+        int days = (int) ((date2.getTime() - date1.getTime()) / (1000*3600*24));
+        return days;
+    }
 
-        msgResult.setResult(true);
-        msgResult.setData(PojoUtils.pageWrapper(page));
 
-        return msgResult;
+    private String exportXls(List<Map> mapList) {
+        String downloadUrl = "";
+
+        Workbook workbook = new HSSFWorkbook();
+        Sheet sheet = workbook.createSheet();
+
+        //表头
+        Row rowTitle = sheet.createRow(0);
+
+        String[] titles = new String[]{"序号","申请时间","姓名","身份证号","所属单位",
+                "审批人","审批状态","年假时间","请假天数","请假事由","审核意见","审核时间"};
+
+        for (int i=0;i<titles.length;i++) {
+            Cell cell = rowTitle.createCell(i);
+            cell.setCellValue(titles[i]);
+        }
+
+        for (int i=0;i<mapList.size();i++){
+            Map<String,Object> map = mapList.get(i);
+
+            Row row = sheet.createRow(i+1);
+
+            int colIndex = 0;
+            row.createCell(colIndex++).setCellValue(i+1);
+            row.createCell(colIndex++).setCellValue(com.jpsoft.shinestar.modules.common.utils.StringUtils.strValue(map.get("createTime"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.shinestar.modules.common.utils.StringUtils.strValue(map.get("name"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.shinestar.modules.common.utils.StringUtils.strValue(map.get("idCard"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.shinestar.modules.common.utils.StringUtils.strValue(map.get("className"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.shinestar.modules.common.utils.StringUtils.strValue(map.get("approvedName"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.shinestar.modules.common.utils.StringUtils.strValue(map.get("statusN"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.shinestar.modules.common.utils.StringUtils.strValue(map.get("time"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.shinestar.modules.common.utils.StringUtils.strValue(map.get("days"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.shinestar.modules.common.utils.StringUtils.strValue(map.get("reason"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.shinestar.modules.common.utils.StringUtils.strValue(map.get("remark"),""));
+            row.createCell(colIndex++).setCellValue(com.jpsoft.shinestar.modules.common.utils.StringUtils.strValue(map.get("updateTime"),""));
+        }
+
+        ByteArrayOutputStream output = new ByteArrayOutputStream();
+
+        try {
+            workbook.write(output);
+
+            byte[] buffer = output.toByteArray();
+            ByteArrayInputStream input = new ByteArrayInputStream(buffer);
+
+            downloadUrl = OSSUtil.upload(ossConfig,"requestForLeave","请假记录.xls",input);
+        }
+        catch (Exception ex){
+            logger.error(ex.getMessage(),ex);
+        }
+
+        return downloadUrl;
     }
 }

+ 656 - 0
web/src/main/java/com/jpsoft/shinestar/modules/mobile/controller/YearRequestForLeaveInfoApiController.java

@@ -0,0 +1,656 @@
+package com.jpsoft.shinestar.modules.mobile.controller;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
+import com.github.pagehelper.Page;
+import com.github.pagehelper.util.StringUtil;
+import com.jpsoft.shinestar.modules.base.dto.ApprovalDTO;
+import com.jpsoft.shinestar.modules.base.entity.CompanyInfo;
+import com.jpsoft.shinestar.modules.base.entity.PersonInfo;
+import com.jpsoft.shinestar.modules.base.entity.PersonPopedom;
+import com.jpsoft.shinestar.modules.base.entity.PersonRoleInfo;
+import com.jpsoft.shinestar.modules.base.service.CompanyInfoService;
+import com.jpsoft.shinestar.modules.base.service.PersonInfoService;
+import com.jpsoft.shinestar.modules.base.service.PersonPopedomService;
+import com.jpsoft.shinestar.modules.base.service.PersonRoleInfoService;
+import com.jpsoft.shinestar.modules.business.dto.YearRequestForLeaveDetailDTO;
+import com.jpsoft.shinestar.modules.business.dto.YearRequestForLeaveInfoDTO;
+import com.jpsoft.shinestar.modules.business.entity.YearRequestForLeaveInfo;
+import com.jpsoft.shinestar.modules.business.service.YearRequestForLeaveInfoService;
+import com.jpsoft.shinestar.modules.common.dto.MessageResult;
+import com.jpsoft.shinestar.modules.common.dto.Sort;
+import com.jpsoft.shinestar.modules.common.utils.PojoUtils;
+import com.jpsoft.shinestar.modules.common.utils.StringUtils;
+import com.jpsoft.shinestar.modules.common.utils.TypeNameUtil;
+import com.jpsoft.shinestar.modules.sys.entity.DataDictionary;
+import com.jpsoft.shinestar.modules.sys.service.DataDictionaryService;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+
+@RestController
+@RequestMapping("/mobile/yearRequestForLeaveInfoApi")
+@Slf4j
+public class YearRequestForLeaveInfoApiController {
+
+
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private PersonInfoService personInfoService;
+
+    @Autowired
+    private PersonRoleInfoService personRoleInfoService;
+
+    @Autowired
+    private PersonPopedomService personPopedomService;
+
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+
+    @Autowired
+    private YearRequestForLeaveInfoService yearRequestForLeaveInfoService;
+
+    @Autowired
+    private CompanyInfoService companyInfoService;
+
+
+    @ApiOperation(value = "请假记录分页")
+    @PostMapping(value = "pageList")
+    public MessageResult<Map> pageList(
+            String token,
+            @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
+            @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
+            @RequestAttribute String subject) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("a.create_time", "desc"));
+
+            Map<String, Object> searchParams = new HashMap<>();
+
+            if (StringUtil.isNotEmpty(subject)) {
+                searchParams.put("personId", subject);
+            }
+
+            searchParams.put("pageIndex", pageIndex);
+            searchParams.put("pageSize", pageSize);
+
+            Page<YearRequestForLeaveInfo> page = yearRequestForLeaveInfoService.pageMobileSearch(searchParams, pageIndex, pageSize, true, sortList);
+
+            Page<YearRequestForLeaveInfoDTO> pageDto = new Page<>();
+
+
+            SimpleDateFormat sdf = new SimpleDateFormat("MM-dd");
+            for (YearRequestForLeaveInfo yearRequestForLeaveInfo : page) {
+
+                YearRequestForLeaveInfoDTO yearRequestForLeaveInfoDTO = new YearRequestForLeaveInfoDTO();
+
+                yearRequestForLeaveInfoDTO.setId(yearRequestForLeaveInfo.getId());
+
+                Date createTime = yearRequestForLeaveInfo.getCreateTime();
+
+                String createTimeStr = "";
+
+                if (createTime != null) {
+                    createTimeStr = sdf.format(createTime);
+                }
+
+                yearRequestForLeaveInfoDTO.setCreateTime(createTimeStr);
+
+                PersonInfo personInfo = personInfoService.get(yearRequestForLeaveInfo.getPersonId());
+
+
+                String title = personInfo.getName() + "的年假申请";
+
+                yearRequestForLeaveInfoDTO.setTitle(title);
+
+                yearRequestForLeaveInfoDTO.setStatus(yearRequestForLeaveInfo.getStatus());
+
+                yearRequestForLeaveInfoDTO.setStatusN(TypeNameUtil.getExamineTypeName(yearRequestForLeaveInfo.getStatus().toString()));
+                yearRequestForLeaveInfoDTO.setStartTime(DateUtil.format(yearRequestForLeaveInfo.getStartTime(),"yyyy-MM-dd"));
+                yearRequestForLeaveInfoDTO.setStartTimeQuantum(yearRequestForLeaveInfo.getStartTimeQuantum());
+                yearRequestForLeaveInfoDTO.setEndTime(DateUtil.format(yearRequestForLeaveInfo.getEndTime(),"yyyy-MM-dd"));
+                yearRequestForLeaveInfoDTO.setEndTimeQuantum(yearRequestForLeaveInfo.getEndTimeQuantum());
+                if (yearRequestForLeaveInfoDTO.getStatus() == 0){
+                    yearRequestForLeaveInfoDTO.setMergeStatus("0");
+                    yearRequestForLeaveInfoDTO.setMergeStatusN("年假待审核");
+                }
+                if (yearRequestForLeaveInfoDTO.getStatus() == 3){
+                    yearRequestForLeaveInfoDTO.setMergeStatus("3");
+                    yearRequestForLeaveInfoDTO.setMergeStatusN("年假已拒绝");
+                }
+
+                pageDto.add(yearRequestForLeaveInfoDTO);
+            }
+
+            pageDto.setPageSize(page.getPageSize());
+            pageDto.setTotal(page.getTotal());
+            pageDto.setPageNum(page.getPageNum());
+
+            messageResult.setResult(true);
+            messageResult.setData(PojoUtils.pageWrapper(pageDto));
+
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+            messageResult.setResult(false);
+        }
+
+        return messageResult;
+    }
+
+
+    @ApiOperation(value = "请年假申请数据提交")
+    @RequestMapping(value = "submitYearRequest", method = RequestMethod.POST)
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "token", value = "令牌", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "subject", value = "目标(不传)", paramType = "form"),
+            @ApiImplicitParam(name = "startTime", value = "请假开始时间", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "endTime", value = "请假结束时间", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "startTimeQuantum", value = "开始时间段(0:上午,1:下午)", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "endTimeQuantum", value = "结束时间段(0:上午,1:下午)", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "imageUrl", value = "上传照片", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "reason", value = "请假理由", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "days", value = "天数", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "reason", value = "请假理由", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "formId", value = "页面路径", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "activityId", value = "步骤id", required = true, paramType = "form"),
+            @ApiImplicitParam(name = "draft", value = "状态(0:草稿,1:提交)", required = true, paramType = "form")
+    })
+    public MessageResult<Map> submitYearRequest(String id,String draft,
+                                             String startTime, String endTime,
+                                             String startTimeQuantum,String endTimeQuantum,
+                                             String imageUrl,String reason,String days,
+                                             String formId,String activityId,
+                                             String token, @RequestAttribute String subject) {
+        MessageResult<Map> msgResult = new MessageResult<>();
+
+        try {
+            //查询操作人
+            PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
+            if (personInfo == null) {
+                throw new Exception("申请人不存在");
+            }
+
+            //申请人角色
+            PersonInfo person = personInfoService.get(Long.parseLong(subject));
+            PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
+
+            String ide = yearRequestForLeaveInfoService.leaveSubmit(personPopedom,startTime,endTime, startTimeQuantum, endTimeQuantum, imageUrl,reason,days,formId,activityId,draft,id);
+
+
+            Map<String, Object> map = new HashMap<>();
+            map.put("id", ide);
+            msgResult.setData(map);
+            msgResult.setCode(200);
+            msgResult.setResult(true);
+
+
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            msgResult.setCode(400);
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
+
+    @ApiOperation(value = "审批人列表")
+    @PostMapping(value = "approvedList")
+    public MessageResult<Object> approvedList(String token, @RequestAttribute String subject) {
+        MessageResult<Object> messageResult = new MessageResult<>();
+
+        PersonInfo person = personInfoService.get(Long.parseLong(subject));
+
+        List<Map<String, Object>> list = new ArrayList<>();
+
+        if (person != null) {
+            //查询企业管理员
+            PersonPopedom personPopedom0 = personPopedomService.get(person.getPopedom());
+            PersonRoleInfo personRoleInfo = personRoleInfoService.get(personPopedom0.getPersonRoleId());
+            if (org.apache.commons.lang3.StringUtils.isNotBlank(personRoleInfo.getParentId())) {
+
+
+                List<PersonPopedom> personPopedomList = personPopedomService.findByCompanyIdAndRoleIds(personPopedom0.getCompanyId(), personRoleInfo.getParentId());
+                for (PersonPopedom personPopedom : personPopedomList) {
+                    PersonInfo personInfo = personInfoService.get(personPopedom.getPersonId());
+
+                    if (personInfo != null && !personInfo.getDelFlag()) {
+                        Map<String, Object> map = new HashMap<>();
+                        map.put("id", personInfo.getId());
+                        map.put("name", personInfo.getName());
+                        list.add(map);
+                    }
+                }
+            }
+
+        }
+
+        messageResult.setResult(true);
+        messageResult.setData(list);
+
+        return messageResult;
+    }
+
+
+    @ApiOperation(value = "根据id查询请假详情")
+    @PostMapping(value = "yearRequestLeaveDetail")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "id", required = true, paramType = "form")
+    })
+    public MessageResult<Map> yearRequestLeaveDetail(String id, String token, @RequestAttribute String subject) {
+
+
+        MessageResult<Map> messageResult = new MessageResult<>();
+        try {
+
+            PersonInfo person = personInfoService.get(Long.parseLong(subject));
+            PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
+
+
+
+            //主业务
+            YearRequestForLeaveInfo yearRequestForLeaveInfo = yearRequestForLeaveInfoService.get(id);
+
+            //申请人
+            //   PersonPopedom requestForLeavePopedom = personPopedomService.get(requestForLeaveInfo.getPersonPopedomId());
+            PersonInfo yearRequestForLeavePerson = personInfoService.get(yearRequestForLeaveInfo.getPersonId());
+
+
+            Map<String, Object> map = new HashMap<>();
+            map.put("name", yearRequestForLeavePerson.getName());
+            map.put("faceImageUrl",yearRequestForLeavePerson.getFaceImageUrl());
+            map.put("imageUrl", yearRequestForLeaveInfo.getImageUrl());
+            map.put("status", yearRequestForLeaveInfo.getStatus());
+            map.put("statusName", TypeNameUtil.getExamineTypeName(yearRequestForLeaveInfo.getStatus().toString()));
+            map.put("startTime", DateUtil.format(yearRequestForLeaveInfo.getStartTime(),"yyyy-MM-dd"));
+            map.put("startTimeQuantum",yearRequestForLeaveInfo.getStartTimeQuantum());
+            map.put("endTime",DateUtil.format(yearRequestForLeaveInfo.getEndTime(),"yyyy-MM-dd"));
+            map.put("endTimeQuantum",yearRequestForLeaveInfo.getEndTimeQuantum());
+            map.put("days",yearRequestForLeaveInfo.getDays());
+            map.put("reason",yearRequestForLeaveInfo.getReason());
+            map.put("createTime",DateUtil.format(yearRequestForLeaveInfo.getCreateTime(),"yyyy-MM-dd HH:mm"));
+
+
+            if (yearRequestForLeaveInfo.getStatus() == 0){
+                map.put("mergeStatus","0");
+                map.put("mergeStatusN","年假待审核");
+            }
+            if (yearRequestForLeaveInfo.getStatus() == 3){
+                map.put("mergeStatus","3");
+                map.put("mergeStatusN","年假已拒绝");
+            }
+
+
+
+
+            messageResult.setData(map);
+            messageResult.setCode(200);
+            messageResult.setResult(true);
+
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            messageResult.setCode(400);
+            messageResult.setMessage(ex.getMessage());
+            messageResult.setResult(false);
+
+        }
+        return messageResult;
+    }
+
+
+    @ApiOperation(value = "详情")
+    @PostMapping(value = "detail")
+    public MessageResult<Object> detail(String id, String token, @RequestAttribute String subject) {
+        MessageResult<Object> messageResult = new MessageResult<>();
+
+        try {
+
+            PersonInfo personInfo0 = personInfoService.get(Long.valueOf(subject));
+            PersonPopedom personPopedom0 = personPopedomService.get(personInfo0.getPopedom());
+
+
+            YearRequestForLeaveInfo yearRequestForLeaveInfo = yearRequestForLeaveInfoService.get(id);
+
+            if (yearRequestForLeaveInfo != null) {
+                SimpleDateFormat sdf = new SimpleDateFormat("y年M月d日");
+
+                PersonInfo person = personInfoService.get(yearRequestForLeaveInfo.getPersonId());
+
+                YearRequestForLeaveDetailDTO yearRequestForLeaveDetailDTO = new YearRequestForLeaveDetailDTO();
+
+
+                yearRequestForLeaveDetailDTO.setName(person.getName());
+                yearRequestForLeaveDetailDTO.setPicUrl(person.getFaceImageUrl());
+
+                yearRequestForLeaveDetailDTO.setStatus(yearRequestForLeaveInfo.getStatus());
+                yearRequestForLeaveDetailDTO.setStatusN(yearRequestForLeaveInfo.getStatusN());
+                yearRequestForLeaveDetailDTO.setIdCard(person.getIdCard());
+
+                String startTime = sdf.format(yearRequestForLeaveInfo.getStartTime());
+                String endTime = sdf.format(yearRequestForLeaveInfo.getEndTime());
+
+                yearRequestForLeaveDetailDTO.setStartTime(startTime);
+                yearRequestForLeaveDetailDTO.setEndTime(endTime);
+                yearRequestForLeaveDetailDTO.setStartTimeQuantum(yearRequestForLeaveInfo.getStartTimeQuantum());
+                yearRequestForLeaveDetailDTO.setEndTimeQuantum(yearRequestForLeaveInfo.getEndTimeQuantum());
+                yearRequestForLeaveDetailDTO.setReason(yearRequestForLeaveInfo.getReason());
+                yearRequestForLeaveDetailDTO.setImageUrl(yearRequestForLeaveInfo.getImageUrl());
+                yearRequestForLeaveDetailDTO.setCreateTime(yearRequestForLeaveInfo.getCreateTime());
+
+
+                //审核人
+                PersonPopedom personPopedom = personPopedomService.get(yearRequestForLeaveInfo.getApprovedPersonPopedomId());
+
+                PersonInfo approved = null;
+                if (personPopedom == null) {
+                    approved = personInfoService.get(yearRequestForLeaveInfo.getApprovedId());
+                } else {
+                    approved = personInfoService.get(personPopedom.getPersonId());
+                }
+                // PersonInfo approved = personInfoService.get(personPopedom.getPersonId());
+
+                yearRequestForLeaveDetailDTO.setApprovedName(approved.getName());
+                yearRequestForLeaveDetailDTO.setApprovalOpinions(yearRequestForLeaveInfo.getApprovalOpinions());
+                yearRequestForLeaveDetailDTO.setApprovalExplain(yearRequestForLeaveInfo.getApprovalExplain());
+
+                if (yearRequestForLeaveDetailDTO.getApprovedTime() != null) {
+                    String approvedTime = sdf.format(yearRequestForLeaveInfo.getApprovedTime());
+                    yearRequestForLeaveDetailDTO.setApprovedTime(approvedTime);
+                }
+
+
+                //审批人
+                List<String> personPopedomList = null;
+                if (org.apache.commons.lang3.StringUtils.isNotBlank(yearRequestForLeaveInfo.getApprovalPersonIdStr())) {
+                    personPopedomList = Arrays.asList(yearRequestForLeaveInfo.getApprovalPersonIdStr().split(","));
+                }
+                //审批时间
+                List<String> approvalTimeList = null;
+                if (org.apache.commons.lang3.StringUtils.isNotBlank(yearRequestForLeaveInfo.getApprovalTimeStr())) {
+                    approvalTimeList = Arrays.asList(yearRequestForLeaveInfo.getApprovalTimeStr().split(","));
+                }
+
+                //审批内容
+                List<String> approvalContentList = null;
+                if (org.apache.commons.lang3.StringUtils.isNotBlank(yearRequestForLeaveInfo.getApprovalContentStr())) {
+                    approvalContentList = Arrays.asList(yearRequestForLeaveInfo.getApprovalContentStr().split(","));
+                }
+
+                //审批状态
+                List<String> statusList = null;
+                if (org.apache.commons.lang3.StringUtils.isNotBlank(yearRequestForLeaveInfo.getApprovalStatusStr())) {
+                    statusList = Arrays.asList(yearRequestForLeaveInfo.getApprovalStatusStr().split(","));
+                }
+
+
+                List<ApprovalDTO> approvalDTOList = new ArrayList<>();
+
+
+                if (personPopedomList != null && personPopedomList.size() != 0) {
+                    Integer n = personPopedomList.size();
+
+                    for (int i = 0; i < n; i++) {
+                        ApprovalDTO approvalDTO = new ApprovalDTO();
+
+                        //审核人
+                        PersonPopedom personPopedom1 = personPopedomService.get(personPopedomList.get(i));
+
+                        if (personPopedom1 != null) {
+
+
+                            PersonInfo personInfo1 = personInfoService.get(personPopedom1.getPersonId());
+                            approvalDTO.setName(personInfo1.getName());
+                            approvalDTO.setFaceImageUrl(personInfo1.getFaceImageUrl());
+                            approvalDTO.setStatus(statusList.get(i));
+                            if ("0".equals(statusList.get(i))) {
+                                approvalDTO.setStatusN("待审核");
+                            }
+                            if ("1".equals(statusList.get(i))) {
+                                approvalDTO.setStatusN("同意");
+                                if (approvalTimeList != null) {
+                                    approvalDTO.setApprovalContent(approvalContentList.get(i));
+                                    approvalDTO.setTime(approvalTimeList.get(i));
+                                }
+                            }
+                            if ("2".equals(statusList.get(i))) {
+                                approvalDTO.setStatusN("拒绝");
+                                if (approvalTimeList != null) {
+                                    approvalDTO.setApprovalContent(approvalContentList.get(i));
+                                    approvalDTO.setTime(approvalTimeList.get(i));
+                                }
+                            }
+                            approvalDTOList.add(approvalDTO);
+
+                        }
+                    }
+                }
+
+                ApprovalDTO approvalDTO0 = new ApprovalDTO();
+
+                if (approved != null) {
+                    approvalDTO0.setName(approved.getName());
+                    approvalDTO0.setFaceImageUrl(approved.getFaceImageUrl());
+                }
+
+                if (yearRequestForLeaveInfo.getApprovedTime() != null) {
+                    approvalDTO0.setTime(DateUtil.format(yearRequestForLeaveInfo.getApprovedTime(), "yyyy-MM-dd HH:mm"));
+                }
+                approvalDTO0.setStatus(yearRequestForLeaveInfo.getStatus().toString());
+                approvalDTO0.setStatusN(yearRequestForLeaveInfo.getStatusN());
+                approvalDTO0.setApprovalContent(yearRequestForLeaveInfo.getApprovalExplain());
+                approvalDTOList.add(approvalDTO0);
+
+
+                yearRequestForLeaveDetailDTO.setList(approvalDTOList);
+                //   requestForLeaveDetailDto.setRemark(businessOut.getRemark());
+                //  requestForLeaveDetailDto.setapp(businessOut.getApprovalPersonPopedomId());
+                boolean approvalEnable = false;
+                if (personPopedom0.getId().equals(yearRequestForLeaveInfo.getApprovedPersonPopedomId())) {
+                    approvalEnable = true;
+                }
+
+                yearRequestForLeaveDetailDTO.setApprovalEnable(approvalEnable);
+
+
+                messageResult.setResult(true);
+                messageResult.setData(yearRequestForLeaveDetailDTO);
+            } else {
+                messageResult.setResult(false);
+                messageResult.setMessage("年假记录不存在!");
+            }
+
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+
+    @ApiOperation(value = "年假假审批列表")
+    @PostMapping(value = "approvedPageList")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "type", value = "是否处理(0:待处理,1:已处理)", dataType = "int", paramType = "query"),
+    })
+    public MessageResult<Map> approvedPageList(
+            @RequestParam(value = "type", defaultValue = "0") int type,
+            String token,
+            @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
+            @RequestParam(value = "pageSize", defaultValue = "20") int pageSize,
+            @RequestAttribute String subject) {
+        MessageResult<Map> messageResult = new MessageResult<>();
+
+        try {
+
+            //  List<Sort> sortList = new ArrayList<>();
+            //  sortList.add(new Sort("a.create_time", "desc"));
+
+            //  Map<String, Object> searchParams = new HashMap<>();
+
+
+            //操作人
+            PersonInfo person = personInfoService.get(Long.parseLong(subject));
+            PersonPopedom personPopedom = personPopedomService.get(person.getPopedom());
+
+            Page<YearRequestForLeaveInfo> page = new Page<>();
+            if (type == 0){
+                Map<String,Object> searchParams = new HashMap<>();
+                searchParams.put("type","0");
+                searchParams.put("approvalPersonPopedomId",personPopedom.getId());
+                List<Sort> sortList = new ArrayList<>();
+                sortList.add(new Sort("a.create_time","desc"));
+                page = yearRequestForLeaveInfoService.pageMobileSearch(searchParams,pageIndex,pageSize,true,sortList);
+
+
+            }else {
+                //操作人的公司
+                CompanyInfo companyInfo = companyInfoService.get(personPopedom.getCompanyId());
+                List<CompanyInfo> companyInfoList = companyInfoService.findAllCompanyByCode("%"+companyInfo.getId()+"%");
+                Map<String,Object> searchParams = new HashMap<>();
+                searchParams.put("type","1");
+                searchParams.put("inCompanyInfo",companyInfoList);
+                List<Sort> sortList = new ArrayList<>();
+                sortList.add(new Sort("a.approved_time","desc"));
+                page = yearRequestForLeaveInfoService.pageMobileSearch(searchParams,pageIndex,pageSize,true,sortList);
+            }
+
+            /*List<PersonRoleInfo> personRoleInfoList = personRoleInfoService.findParentId(personPopedom.getPersonRoleId());
+
+            List<PersonPopedom> totalPersonPopedomList = new ArrayList<>();
+
+
+            for (PersonRoleInfo personRoleInfo : personRoleInfoList) {
+                List<PersonPopedom> personPopedomList = personPopedomService.findByCompanyIdAndRoleIds(personPopedom.getCompanyId(), personRoleInfo.getId());
+                totalPersonPopedomList.addAll(personPopedomList);
+            }
+
+
+            List<Long> approvedIdList = new ArrayList<>();
+
+            approvedIdList.add(person.getId());
+
+            List<PersonInfo> personList = new ArrayList<>();
+
+            for (PersonPopedom item : totalPersonPopedomList) {
+                PersonInfo temp = personInfoService.get(item.getPersonId());
+                if (temp != null) {
+                    approvedIdList.add(item.getPersonId());
+                    personList.add(temp);
+                }
+            }*/
+
+            //    searchParams.put("approvedIdList", approvedIdList);
+
+
+            //    searchParams.put("status", status);
+
+
+            //  Page<RequestForLeaveInfo> page = requestForLeaveInfoService.pageMobileSearch(searchParams, pageIndex, pageSize, true, sortList);
+
+
+            Page<YearRequestForLeaveInfoDTO> pageDto = new Page<>();
+
+            SimpleDateFormat sdf = new SimpleDateFormat("MM-dd");
+            for (YearRequestForLeaveInfo yearRequestForLeaveInfo : page) {
+
+                YearRequestForLeaveInfoDTO yearRequestForLeaveInfoDTO = new YearRequestForLeaveInfoDTO();
+
+                yearRequestForLeaveInfoDTO.setId(yearRequestForLeaveInfo.getId());
+
+                Date createTime = yearRequestForLeaveInfo.getCreateTime();
+
+                String createTimeStr = "";
+
+                if (createTime != null) {
+                    createTimeStr = sdf.format(createTime);
+                }
+
+                yearRequestForLeaveInfoDTO.setCreateTime(createTimeStr);
+
+                PersonInfo personInfo = personInfoService.get(yearRequestForLeaveInfo.getPersonId());
+
+                if (personInfo != null) {
+                    String title = personInfo.getName() + "的年假申请";
+                    yearRequestForLeaveInfoDTO.setPicUrl(personInfo.getFaceImageUrl());
+                    yearRequestForLeaveInfoDTO.setTitle(title);
+                    yearRequestForLeaveInfoDTO.setName(personInfo.getName());
+                }
+
+                yearRequestForLeaveInfoDTO.setStatus(yearRequestForLeaveInfo.getStatus());
+
+                yearRequestForLeaveInfoDTO.setStatusN(yearRequestForLeaveInfo.getStatusN());
+
+                pageDto.add(yearRequestForLeaveInfoDTO);
+            }
+
+            pageDto.setPageSize(page.getPageSize());
+            pageDto.setTotal(page.getTotal());
+            pageDto.setPageNum(page.getPageNum());
+
+            messageResult.setResult(true);
+            messageResult.setData(PojoUtils.pageWrapper(pageDto));
+
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+
+    @ApiOperation(value = "请假审批")
+    @PostMapping(value = "approved")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "id", value = "请假记录ID", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "approvalOpinions", value = "审批意见", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "approvalExplain", value = "意见说明", dataType = "String", paramType = "query"),
+    })
+    public MessageResult<Object> approved(String id, String approvalOpinions, String approvalExplain, int status, String token, @RequestAttribute String subject) {
+        MessageResult<Object> messageResult = new MessageResult<>();
+
+        try {
+            //  String[] sz= id.split(",");
+            //审核人
+            PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
+            PersonPopedom personPopedom = personPopedomService.get(personInfo.getPopedom());
+
+
+            if (org.apache.commons.lang3.StringUtils.isNotBlank(approvalOpinions)) {
+                approvalOpinions = StrUtil.replace(approvalOpinions, ",", ",");
+            }
+            if (org.apache.commons.lang3.StringUtils.isNotBlank(approvalExplain)) {
+                approvalExplain = StrUtil.replace(approvalExplain, ",", ",");
+            }
+
+            yearRequestForLeaveInfoService.approvalRequestForLeave(personInfo, id, approvalOpinions, approvalExplain, status);
+
+
+            messageResult.setResult(true);
+
+        } catch (Exception ex) {
+            logger.error(ex.getMessage(), ex);
+            messageResult.setResult(false);
+            messageResult.setMessage(ex.getMessage());
+        }
+
+        return messageResult;
+    }
+
+}