Browse Source

导出

master
HY 4 months ago
parent
commit
f2acca07f2
7 changed files with 168 additions and 32 deletions
  1. +1
    -1
      admin-hanhai-vue/.env.development
  2. +19
    -9
      admin-hanhai-vue/src/views/xcx/ClockinLogList.vue
  3. +3
    -1
      admin-hanhai-vue/src/views/xcx/modules/ClockInProjectForm.vue
  4. +109
    -21
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/controller/ClockinLogController.java
  5. +3
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/mapper/ClockinLogMapper.java
  6. +32
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/ressp/ClockInLogExportResp.java
  7. +1
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/ressp/ClockInLogResp.java

+ 1
- 1
admin-hanhai-vue/.env.development View File

@ -1,5 +1,5 @@
NODE_ENV=development
VUE_APP_API_BASE_URL=https://clockin.java996.icu/clockin-api/
VUE_APP_API_BASE_URL=http://dev.java996.icu/clockin-api
VUE_APP_CAS_BASE_URL=http://cas.example.org:8443/cas
VUE_APP_ONLINE_BASE_URL=http://fileview.jeecg.com/onlinePreview
VUE_APP_MAP_KEY=WPKBZ-OKICI-ZAIGE-U6TQ4-RPQIV-OXBJO


+ 19
- 9
admin-hanhai-vue/src/views/xcx/ClockinLogList.vue View File

@ -1,18 +1,28 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<!-- <div class="table-page-search-wrapper">-->
<!-- <a-form layout="inline" @keyup.enter.native="searchQuery">-->
<!-- <a-row :gutter="24">-->
<!-- </a-row>-->
<!-- </a-form>-->
<!-- </div>-->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="12">
<a-form-item label="日期">
<j-date placeholder="请选择时间" v-model="queryParam.clockStartTime" date-format="YYYY-MM" style="width: 100%" />
</a-form-item>
</a-col>
<a-col :md="6" :sm="12">
<a-form-item label="员工姓名">
<j-search-select-tag dict-code="clockin_auth,name,user_id" placeholder="请输入员工姓名" v-model="queryParam.userId"></j-search-select-tag>
</a-form-item>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- 操作按钮区域 -->
<div class="table-operator">
<!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
<!-- <a-button type="primary" icon="download" @click="handleExportXls('clockin_log')">导出</a-button>-->
<a-button type="primary" icon="download" @click="handleExportXls('clockin_log')">导出</a-button>
<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
<!-- <a-button type="primary" icon="import">导入</a-button>-->
<!-- </a-upload>-->
@ -166,9 +176,9 @@
list: "/clockinlog/clockinLog/list",
delete: "/clockinlog/clockinLog/delete",
deleteBatch: "/clockinlog/clockinLog/deleteBatch",
exportXlsUrl: "/clockinlog/clockinLog/exportXls",
exportXlsUrl: "/clockinlog/clockinLog/exportXls2",
importExcelUrl: "clockinlog/clockinLog/importExcel",
},
dictOptions:{},
superFieldList:[],


+ 3
- 1
admin-hanhai-vue/src/views/xcx/modules/ClockInProjectForm.vue View File

@ -83,6 +83,8 @@
return {
model:{
delFlag:0,
lon: '',
lat: ''
},
labelCol: {
xs: { span: 24 },
@ -153,7 +155,7 @@
that.confirmLoading = false;
})
}
})
},
}


+ 109
- 21
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/controller/ClockinLogController.java View File

@ -1,22 +1,31 @@
package org.jeecg.modules.clockinlog.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.time.YearMonth;
import java.util.*;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.DateUtils2;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.clockInproject.entity.ClockInProject;
import org.jeecg.modules.clockInproject.service.IClockInProjectService;
import org.jeecg.modules.clockinauth.entity.ClockinAuth;
import org.jeecg.modules.clockinauth.service.IClockinAuthService;
import org.jeecg.modules.clockinlog.entity.ClockinLog;
import org.jeecg.modules.clockinlog.mapper.ClockinLogMapper;
import org.jeecg.modules.clockinlog.ressp.ClockInLogExportResp;
import org.jeecg.modules.clockinlog.ressp.ClockInLogResp;
import org.jeecg.modules.clockinlog.service.IClockinLogService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -24,6 +33,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.clockinteamlog.entity.ClockinTeamLog;
import org.jeecg.modules.clockinteamlog.service.IClockinTeamLogService;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
@ -40,8 +51,9 @@ import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import reactor.core.publisher.Flux;
/**
/**
* @Description: clockin_log
* @Author: jeecg-boot
* @Date: 2024-10-24
@ -56,6 +68,14 @@ public class ClockinLogController extends JeecgController<ClockinLog, IClockinLo
private IClockinLogService clockinLogService;
@Value("${jeecg.path.upload}")
private String upLoadPath;
@Resource
private ClockinLogMapper clockinLogMapper;
@Resource
private IClockinTeamLogService clockinTeamLogService;
@Resource
private IClockinAuthService clockinAuthService;
@Resource
private IClockInProjectService clockInProjectService;
/**
* 分页列表查询
*
@ -77,7 +97,7 @@ public class ClockinLogController extends JeecgController<ClockinLog, IClockinLo
IPage<ClockinLog> pageList = clockinLogService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
* 添加
*
@ -91,7 +111,7 @@ public class ClockinLogController extends JeecgController<ClockinLog, IClockinLo
clockinLogService.save(clockinLog);
return Result.OK("添加成功!");
}
/**
* 编辑
*
@ -105,7 +125,7 @@ public class ClockinLogController extends JeecgController<ClockinLog, IClockinLo
clockinLogService.updateById(clockinLog);
return Result.OK("编辑成功!");
}
/**
* 通过id删除
*
@ -119,7 +139,7 @@ public class ClockinLogController extends JeecgController<ClockinLog, IClockinLo
clockinLogService.removeById(id);
return Result.OK("删除成功!");
}
/**
* 批量删除
*
@ -133,7 +153,7 @@ public class ClockinLogController extends JeecgController<ClockinLog, IClockinLo
this.clockinLogService.removeByIds(Arrays.asList(ids.split(",")));
return Result.OK("批量删除成功!");
}
/**
* 通过id查询
*
@ -159,27 +179,95 @@ public class ClockinLogController extends JeecgController<ClockinLog, IClockinLo
*/
@RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, ClockinLog clockinLog) {
return this.exportXls(request, clockinLog, ClockinLog.class, "clockin_log");
return super.exportXls(request, clockinLog, ClockinLog.class, "clockin_log");
}
protected ModelAndView exportXls(HttpServletRequest request, ClockinLog object, Class<ClockinLog> clazz, String title) {
@RequestMapping(value = "/exportXls2")
public ModelAndView exportXls3(HttpServletRequest request, ClockinLog clockinLog) {
return this.exportXls2(request, ClockInLogExportResp.class, "打卡");
}
// @RequestMapping(value = "/exportXls2")
protected ModelAndView exportXls2(HttpServletRequest request, Class<ClockInLogExportResp> clazz, String title) {
// Step.1 组装查询条件
QueryWrapper<ClockinLog> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
Map<String, String[]> parameterMap = request.getParameterMap();
String[] clockStartTimes = parameterMap.get("clockStartTime");
// QueryWrapper<ClockinLog> queryWrapper = QueryGenerator.initQueryWrapper(object, request.getParameterMap());
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<ClockinTeamLog> clockinTeamLogs = clockinTeamLogService.lambdaQuery()
.eq(ClockinTeamLog::getDelFlag, 0)
// .eq(ClockinTeamLog::getStatus,1)
.list();
// int day = Integer.parseInt(DateUtils2.getNowMonthMaxDay());
String nowYearMonth = clockStartTimes[0];
if(StringUtils.isBlank(clockStartTimes[0])){
nowYearMonth = DateUtils2.getNowYearMonth();
}
YearMonth yearMonth = YearMonth.parse(nowYearMonth);
int day = yearMonth.lengthOfMonth();
String yearMonthDay = "";
// Step.2 获取导出数据
List<ClockinLog> pageList = service.list(queryWrapper);
List<ClockinLog> exportList = null;
// List<ClockinLog> pageList = service.list(queryWrapper);
// List<ClockinLog> exportList = null;
List<Map<String, Object>> list = new ArrayList<>();
List<String> strings = null;
List<ClockInLogExportResp> exportList = new ArrayList<>();
for (ClockinTeamLog clockinTeamLog:clockinTeamLogs){
ClockInProject clockInProject = clockInProjectService.lambdaQuery()
.eq(ClockInProject::getDelFlag, 0)
.eq(ClockInProject::getTeamId, clockinTeamLog.getTeamId())
.one();
ClockinAuth clockinAuth = clockinAuthService.lambdaQuery()
.eq(ClockinAuth::getDelFlag, 0)
.eq(ClockinAuth::getUserId, clockinTeamLog.getUserId())
.one();
if(clockinAuth == null){
continue;
}
for (int n= 1;n<=day;n++){
ClockInLogExportResp clockInLogExportResp = new ClockInLogExportResp();
clockInLogExportResp.setName(clockinAuth.getName());
clockInLogExportResp.setDate(nowYearMonth);
clockInLogExportResp.setDay(n+"");
yearMonthDay = nowYearMonth+"-"+n;
List<ClockInLogResp> clockInLogExpeort = clockinLogMapper.getClockInLogExpeort(yearMonthDay, clockInProject.getId(), clockinTeamLog.getUserId());
String clockInTime = "";
for (ClockInLogResp clockInLogResp:clockInLogExpeort) {
if(StringUtils.isBlank(clockInLogResp.getTime())){
clockInLogResp.setClockStartTime("缺卡");
}
clockInTime = clockInTime+"\n"+clockInLogResp.getClockStartTime();
// strings.add(clockInLogResp.getClockStartTime());
}
clockInLogExportResp.setClockInTime(clockInTime);
exportList.add(clockInLogExportResp);
}
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
exportList = pageList.stream().filter(item -> selectionList.contains(getId(item))).collect(Collectors.toList());
} else {
exportList = pageList;
}
// 过滤选中数据
// String selections = request.getParameter("selections");
// if (oConvertUtils.isNotEmpty(selections)) {
// List<String> selectionList = Arrays.asList(selections.split(","));
// exportList = pageList.stream().filter(item -> selectionList.contains(getId(item))).collect(Collectors.toList());
// } else {
// exportList = pageList;
// }
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下


+ 3
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/mapper/ClockinLogMapper.java View File

@ -41,4 +41,7 @@ public interface ClockinLogMapper extends BaseMapper<ClockinLog> {
@Select("SELECT IFNULL(count(1),0) FROM clockin_log WHERE del_flag = 0 AND user_id = #{userId} AND clock_in_time like '%${date}%'")
Integer getClockInTotal(@Param("userId") String userId,@Param("date") String date);
@Select("select clock_start_time,(select clock_in_time from clockin_log where project_item_id = a.id and del_flag = 0 and user_id = #{userId} and clock_in_time like '%${date}%') time from clock_in_project_item a where project_id = #{projectId}\n")
List<ClockInLogResp> getClockInLogExpeort(@Param("date") String date,@Param("projectId") String projectId,@Param("userId") String userId);
}

+ 32
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/ressp/ClockInLogExportResp.java View File

@ -0,0 +1,32 @@
package org.jeecg.modules.clockinlog.ressp;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.util.List;
/**
* @author java996.icu
* @title: ClockInLogExperResp
* @projectName clockin-api
* @description: TODO
* @date 2024/11/29 11:53
* @Version V1.0
*/
@Data
public class ClockInLogExportResp {
/**年月*/
@Excel(name = "时间", width = 15,height = 30)
private String date;
/**姓名*/
@Excel(name = "姓名", width = 15,height = 30)
private String name;
/**日期*/
@Excel(name = "日期", width = 15,height = 30)
private String day;
/**打卡时间*/
@Excel(name = "打卡时间", width = 15,height = 30)
private String clockInTime;
}

+ 1
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/clockinlog/ressp/ClockInLogResp.java View File

@ -21,6 +21,7 @@ public class ClockInLogResp {
private String address;
/**是否打卡 0否 1是*/
private Integer clockInFlag;
private String time;
public String getPic(){


Loading…
Cancel
Save