|
@@ -13,9 +13,12 @@ import com.management.platform.entity.vo.SysRichFunction;
|
|
import com.management.platform.mapper.*;
|
|
import com.management.platform.mapper.*;
|
|
import com.management.platform.service.CompanyDingdingService;
|
|
import com.management.platform.service.CompanyDingdingService;
|
|
import com.management.platform.service.DingDingService;
|
|
import com.management.platform.service.DingDingService;
|
|
|
|
+import com.management.platform.service.ExcelExportService;
|
|
import com.management.platform.service.UserYearleaveSettingService;
|
|
import com.management.platform.service.UserYearleaveSettingService;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.HttpRespMsg;
|
|
import com.management.platform.util.ListUtil;
|
|
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.util.StringUtils;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
|
@@ -55,6 +58,8 @@ public class UserYearleaveSettingController {
|
|
private LeaveTypeMapper leaveTypeMapper;
|
|
private LeaveTypeMapper leaveTypeMapper;
|
|
@Resource
|
|
@Resource
|
|
private DepartmentMapper departmentMapper;
|
|
private DepartmentMapper departmentMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private ExcelExportService excelExportService;
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private HttpServletRequest request;
|
|
private HttpServletRequest request;
|
|
@@ -62,6 +67,11 @@ public class UserYearleaveSettingController {
|
|
private UserMapper userMapper;
|
|
private UserMapper userMapper;
|
|
@Resource
|
|
@Resource
|
|
private SysFunctionMapper sysFunctionMapper;
|
|
private SysFunctionMapper sysFunctionMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private WxCorpInfoMapper wxCorpInfoMapper;
|
|
|
|
+
|
|
|
|
+ @Value(value = "${upload.path}")
|
|
|
|
+ private String path;
|
|
|
|
|
|
@RequestMapping("/save")
|
|
@RequestMapping("/save")
|
|
public HttpRespMsg save(String userId, Integer companyId, Integer yearDays) {
|
|
public HttpRespMsg save(String userId, Integer companyId, Integer yearDays) {
|
|
@@ -182,6 +192,62 @@ public class UserYearleaveSettingController {
|
|
return msg;
|
|
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) {
|
|
private List<Department> getSubDeptList(List<Department> allDeptList, Department department) {
|