浏览代码

剩余假期导出

cs 2 年之前
父节点
当前提交
0bf7e66999

+ 66 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserYearleaveSettingController.java

@@ -13,9 +13,12 @@ import com.management.platform.entity.vo.SysRichFunction;
 import com.management.platform.mapper.*;
 import com.management.platform.service.CompanyDingdingService;
 import com.management.platform.service.DingDingService;
+import com.management.platform.service.ExcelExportService;
 import com.management.platform.service.UserYearleaveSettingService;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.ListUtil;
+import com.management.platform.util.MessageUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 
@@ -55,6 +58,8 @@ public class UserYearleaveSettingController {
     private LeaveTypeMapper leaveTypeMapper;
     @Resource
     private DepartmentMapper departmentMapper;
+    @Resource
+    private ExcelExportService excelExportService;
 
     @Resource
     private HttpServletRequest request;
@@ -62,6 +67,11 @@ public class UserYearleaveSettingController {
     private UserMapper userMapper;
     @Resource
     private SysFunctionMapper sysFunctionMapper;
+    @Resource
+    private WxCorpInfoMapper wxCorpInfoMapper;
+
+    @Value(value = "${upload.path}")
+    private String path;
 
     @RequestMapping("/save")
     public HttpRespMsg save(String userId, Integer companyId, Integer yearDays) {
@@ -182,6 +192,62 @@ public class UserYearleaveSettingController {
         return msg;
     }
 
+    //导出剩余假期
+    @RequestMapping("/exportDingDingLeaveQt")
+    public HttpRespMsg exportDingDingLeaveQt(String leaveCode, Integer companyId, Integer departmentId, String userId){
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",companyId));
+        List<String> headList = new ArrayList<>();
+        List<List<String>> allList = new ArrayList<>();
+        HttpRespMsg dingDingLeaveQt = getDingDingLeaveQt(leaveCode, companyId, departmentId, userId, 1);
+        HashMap map = (HashMap)dingDingLeaveQt.data;
+        List<LeaveQuotaNum> records = (List<LeaveQuotaNum>)map.get("records");
+        Long total = (Long) map.get("total");
+        Long j = 0L;
+        if (total!=0){
+            j = total / 50;
+            if (total % 50!=0){
+                j += 1;
+            }
+        }
+        //        headList.add("员工姓名");
+        //        headList.add("有效期");
+        //        headList.add("总额度");
+        //        headList.add("已使用");
+        //        headList.add("剩余额度");
+        headList.add(MessageUtils.message("entry.staffName"));
+        headList.add(MessageUtils.message("excel.validity"));
+        headList.add(MessageUtils.message("leave.totalAmount"));
+        headList.add(MessageUtils.message("leave.used"));
+        headList.add(MessageUtils.message("leave.remainingQuota"));
+        allList.add(headList);
+        for (int i = 2; i <= j+1; i++) {
+            if (records.size() == 0){
+                break;
+            }
+            for (LeaveQuotaNum record : records) {
+                ArrayList<String> data = new ArrayList<>();
+                data.add(record.getName());
+                data.add(record.getStartTime()+" - "+record.getEndTime());
+                data.add(record.getQuotaInHours()+"h");
+                data.add(record.getUsedInHours()+"h");
+                data.add(record.getLeftInHours()+"h");
+                allList.add(data);
+            }
+            dingDingLeaveQt = getDingDingLeaveQt(leaveCode, companyId, departmentId, userId, i);
+            map = (HashMap)dingDingLeaveQt.data;
+            records = (List<LeaveQuotaNum>)map.get("records");
+        }
+        //String fileName = "假期剩余表_"+System.currentTimeMillis();
+        String fileName = MessageUtils.message("fileName.leaveRemaining")+System.currentTimeMillis();
+        try {
+            return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName,allList,path);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return httpRespMsg;
+    }
+
 
     //递归获取子部门
     private List<Department> getSubDeptList(List<Department> allDeptList, Department department) {

+ 5 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/i18n/messages.properties

@@ -298,6 +298,9 @@ leave.compensatory=调休假
 leave.paternity=陪产假
 leave.notFill=未填写
 leave.clockIn=考勤打卡
+leave.totalAmount=总额度
+leave.used=已使用
+leave.remainingQuota=剩余额度
 #报销相关
 Reimbursement.nameNull=报销人名称不能为空
 Reimbursement.costTypeNull=费用类型不能为空
@@ -527,6 +530,7 @@ fileName.perNoFill=未填人员统计_
 fileName.laborHour=工时对比
 fileName.monthWork=月度工时表
 fileName.deptJoinPro=部门参与项目情况表
+fileName.leaveRemaining = 假期剩余表
 #excel
 excel.publicProject=是否为公共项目
 excel.projectName=项目名称必填
@@ -677,6 +681,7 @@ excel.joinProCount = 参与的项目的数量
 excel.deptName = 部门名称
 excel.joinPeopleCount= 参与人次
 excel.tripDays = 出差的天数
+excel.validity = 有效期
 #推送
 push.fillIn=您今天的工时填报还未完成
 push.name=屈跃庭

+ 6 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/i18n/messages_en_US.properties

@@ -298,6 +298,9 @@ leave.compensatory=Compensatory leave
 leave.paternity=Paternity leave
 leave.notFill=Not filled in
 leave.clockIn=Clock in
+leave.totalAmount=Total amount
+leave.used=Used
+leave.remainingQuota=Remaining quota
 #报销相关
 Reimbursement.nameNull=The name of the reimbursement applicant cannot be blank.
 Reimbursement.costTypeNull=Expense type cannot be empty
@@ -525,8 +528,9 @@ fileName.supStat=Supplier statistics_
 fileName.dailyManHour=Daily man hour statistics_ {0} to {1}
 fileName.perNoFill=Personnel statistics not filled_
 fileName.laborHour=Labor hour comparison
-fileName.monthWork=Monthly man hour table
+fileName.monthWork=Monthly man hour Table
 fileName.deptJoinPro=Department Participation in Projects
+fileName.leaveRemaining = Leave Remaining Table
 #excel
 excel.publicProject=Whether it is a public project
 excel.projectName=Project name is required
@@ -677,6 +681,7 @@ excel.joinProCount = Number of projects involved
 excel.deptName = Department name
 excel.joinPeopleCount= Number of participants
 excel.tripDays = Days of business trip
+excel.validity = term of validity
 #推送
 push.fillIn=Your work hour report for today has not been completed.
 push.name=Qu Yue ting