数据管理-出差报备数据

This commit is contained in:
lSun 2024-12-03 19:53:33 +08:00
parent ffad0d0136
commit 10055d6178
10 changed files with 519 additions and 14 deletions

View File

@ -26,7 +26,9 @@ import com.bonus.system.holiday.service.HolidayService;
import com.bonus.system.leaveReporting.entity.LeaveReportingBean;
import com.bonus.system.leaveReporting.service.LeaveReportingService;
import com.bonus.system.wechat.entity.WechatBean;
import com.bonus.system.wechat.entity.WechatEvectionBean;
import com.bonus.system.wechat.entity.WechatLeaveReportingBean;
import com.bonus.system.wechat.service.WechatEvectionService;
import com.bonus.system.wechat.service.WechatLeaveReportingService;
import com.bonus.system.wechat.service.WechatService;
import lombok.extern.slf4j.Slf4j;
@ -95,6 +97,14 @@ public class ExportFileController {
*/
@Resource(name = "EvectionService")
private EvectionService evectionService;
/**
* 数据管理-出差报备
*/
@Resource(name = "WechatEvectionService")
private WechatEvectionService wechatevectionService;
/**
* 考勤明细导出
*/
@ -542,14 +552,14 @@ public class ExportFileController {
vo.setId((i + 1));
//事件处理
if("1".equals(vo.getLeaveStartInterval())){
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" 上午");
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" ");
}else{
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" 下午");
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" ");
}
if("1".equals(vo.getLeaveEndInterval())){
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" 上午");
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" ");
}else{
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" 下午");
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" ");
}
// 创建一个 SimpleDateFormat 对象用于格式化日期
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -705,4 +715,43 @@ public class ExportFileController {
}
}
/**
* 数据管理-出差报备
* @param response
* @param bean
* @return void
*/
@GetMapping("/exportWechatEvection")
public void exportWechatEvection(HttpServletResponse response, WechatEvectionBean bean) {
try {
List<WechatEvectionBean> personExportVoList = new ArrayList<>();
List<WechatEvectionBean> personLists = wechatevectionService.getEvectionList(bean);
for (int i = 0; i < personLists.size(); i++) {
WechatEvectionBean vo = personLists.get(i);
vo.setId((i + 1));
//事件处理
if("1".equals(vo.getLeaveStartInterval())){
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" ");
}else{
vo.setLeaveStartInterval(vo.getLeaveStartDate()+" ");
}
if("1".equals(vo.getLeaveEndInterval())){
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" ");
}else{
vo.setLeaveEndInterval(vo.getLeaveEndDate()+" ");
}
// 创建一个 SimpleDateFormat 对象用于格式化日期
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// Date 转换为 String
String dateString = formatter.format(vo.getCreateTime());
vo.setLeaveDate(dateString);
personExportVoList.add(vo);
}
extracted(personExportVoList, WechatEvectionBean.class, "数据管理-出差报备导出", "数据管理-出差报备导出", "数据管理-出差报备导出", response);
} catch (Exception e) {
log.error(e.toString(), e);
}
}
}

View File

@ -0,0 +1,62 @@
package com.bonus.system.wechat.controller;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.log.annotation.Log;
import com.bonus.common.log.enums.BusinessType;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.system.evection.service.EvectionService;
import com.bonus.system.wechat.entity.WechatEvectionBean;
import com.bonus.system.wechat.service.WechatEvectionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
/**
* 数据管理->出差报备
*
* @author lsun
*/
@RestController
@RequestMapping("/wechatEvection")
@Slf4j
public class WechatEvectionController extends BaseController {
@Resource(name = "WechatEvectionService")
private WechatEvectionService wechatevectionService;
/**
* 获取数据管理出差报备列表(表格)
*/
@RequiresPermissions("flow:wechatEvection:list")
@GetMapping("/list")
@Log(title = "流程管理->数据管理->出差报备->列表查询", businessType = BusinessType.QUERY)
public TableDataInfo list(WechatEvectionBean bean) {
try{
startPage();
return getDataTable(wechatevectionService.getEvectionList(bean));
}catch (Exception e){
log.error(e.toString(),e);
}
return getDataTableError(new ArrayList<>());
}
/**
* 根据id获取详细信息
*/
@RequiresPermissions("flow:wechatEvection:list")
@GetMapping(value = "/{id}")
@Log(title = "流程管理->数据管理->出差报备->查询单个出差报备", businessType = BusinessType.QUERY)
public AjaxResult getInfo(@PathVariable String id) {
try{
return success(wechatevectionService.selectEvectionById(id));
}catch (Exception e){
log.error(e.toString(),e);
}
return error("系统异常");
}
}

View File

@ -15,7 +15,7 @@ import javax.annotation.Resource;
import java.util.ArrayList;
/**
* 休假报备
* 数据管理-休假报备
*
* @author lsun
*/
@ -48,7 +48,7 @@ public class WechatLeaveReportingController extends BaseController {
*/
@RequiresPermissions("flow:wechatLeaveReporting:list")
@GetMapping(value = "/{id}")
@Log(title = "流程管理->休假报备->查询单个休假报备", businessType = BusinessType.QUERY)
@Log(title = "流程管理->数据管理->休假报备->查询单个休假报备", businessType = BusinessType.QUERY)
public AjaxResult getInfo(@PathVariable Long id) {
try{
return success(wechatLeaveReportingService.selectLeaveReportingById(id));

View File

@ -0,0 +1,22 @@
package com.bonus.system.wechat.dao;
import com.bonus.system.evection.entity.EvectionBean;
import com.bonus.system.wechat.entity.WechatEvectionBean;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* 出差报备-数据访问层
* @author lsun
*/
@Repository("WechatEvectionDao")
public interface WechatEvectionDao {
List<WechatEvectionBean> getEvectionList(@Param("bean")WechatEvectionBean bean);
WechatEvectionBean selectEvectionById(String id);
}

View File

@ -0,0 +1,177 @@
package com.bonus.system.wechat.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.bonus.common.core.web.domain.BaseBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
/**
*
* @author lsun
*/
@Data
public class WechatEvectionBean extends BaseBean {
/**
* 编号
*/
@Excel(name = "序号", width = 10.0,height = 20.0, orderNum = "0")
private long id;
/**
* 所属部门编号
*/
private Long orgId;
/**
* 请假人用户编号
*/
private Long userId;
/**
* 请假人姓名
*/
@Excel(name = "姓名", width = 10.0,height = 20.0, orderNum = "1")
private String userName;
/**
* 职务
*/
@Excel(name = "职务", width = 20.0,height = 20.0, orderNum = "2")
private String postName;
/**
* 所属部门名称
*/
@Excel(name = "所属部门", width = 20.0,height = 20.0, orderNum = "3")
private String orgName;
/**
* 出差类型
*/
private String leaveType;
/**
* 出差开始时间1上午2下午
*/
@Excel(name = "出差开始时间", width = 20.0,height = 20.0, orderNum = "6")
private String leaveStartInterval;
/**
* 出差结束时间1上午2下午
*/
@Excel(name = "出差结束时间", width = 20.0,height = 20.0, orderNum = "7")
private String leaveEndInterval;
/**
* 出差时长
*/
@Excel(name = "出差时长(天)", width = 20.0,height = 20.0, orderNum = "8")
private Double leaveDuration;
/**
* 请假开始日期
*/
private LocalDate leaveStartDate;
/**
* 请假结束日期
*/
private LocalDate leaveEndDate;
/**
* 请假事由
*/
private String leaveReason;
/**
* 请假日期
*/
private String leaveDate;
/**
* 数据来源1新增2导入
*/
@Excel(name = "数据来源", width = 10.0,height = 20.0, orderNum = "4")
private String source;
/**
* 审批意见
*/
private String examineOpinion;
/**
* 审批状态0审核中1通过2不通过
*/
private String examineStatus;
/**
* 审批时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date examineTime;
/**
* 审批人编号
*/
private Long examineUserId;
/**
* 导出类型 1 查询 2 审批
*/
private String exportType;
/**
* 是否干部 1是 0不是
*/
private String isCadre;
/**
* 是否请示领导 1 0
*/
private String isAgree;
/**
* 备注
*/
private String remark;
/**
* 代理主持工作人员多个自动隔开
*/
private String hostUserId;
/**
* 地点
*/
private String location;
/**
* 出差类型
*/
private String type;
/**
* 请假单的uuid
*/
private String uuId;
/**
* 出行人Travelers
*/
private String travelers;
/**
* 出行人名称
*/
@Excel(name = "出行人", width = 10.0,height = 20.0, orderNum = "5")
private String travelersName;
/**
* 自己项目部所在分公司下的所有项目部id
*/
private List<String> orgList;
}

View File

@ -0,0 +1,29 @@
package com.bonus.system.wechat.service;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.system.evection.entity.EvectionBean;
import com.bonus.system.wechat.entity.WechatEvectionBean;
import java.util.List;
/**
* 出差报备-角色业务层
* @author lsun
*/
public interface WechatEvectionService {
/**
* 获取出差报备
* @param bean 参数
* @return list bean
*/
List<WechatEvectionBean> getEvectionList(WechatEvectionBean bean);
/**
* 查询出差报备
* @param id
* @return
*/
WechatEvectionBean selectEvectionById(String id);
}

View File

@ -0,0 +1,43 @@
package com.bonus.system.wechat.service;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.system.api.domain.MapVo;
import com.bonus.system.evection.dao.EvectionDao;
import com.bonus.system.evection.entity.EvectionBean;
import com.bonus.system.evection.service.EvectionService;
import com.bonus.system.wechat.dao.WechatEvectionDao;
import com.bonus.system.wechat.entity.WechatEvectionBean;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* 出差报备-业务层
*
* @author lsun
*/
@Service("WechatEvectionService")
@Log4j2
public class WechatEvectionServiceImpl implements WechatEvectionService {
@Resource(name = "WechatEvectionDao")
private WechatEvectionDao wechatEvectionDao;
@Override
public List<WechatEvectionBean> getEvectionList(WechatEvectionBean bean) {
return wechatEvectionDao.getEvectionList(bean);
}
@Override
public WechatEvectionBean selectEvectionById(String id) {
return wechatEvectionDao.selectEvectionById(id);
}
}

View File

@ -95,7 +95,7 @@
LEFT JOIN sys_user_post p ON p.user_id = l.user_id
LEFT JOIN sys_dict_data d on d.dict_code = p.post_id
WHERE
l.is_active = '1' AND l.leave_type = '出差报备'
l.is_active = '1' AND l.leave_type = '出差报备' AND l.source = '1'
<if test='bean.orgList != null and bean.orgList.size() > 0'>
and org_id in (
<foreach collection="bean.orgList" item="item" separator=",">

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.system.wechat.dao.WechatEvectionDao">
<select id="getEvectionList" resultType="com.bonus.system.wechat.entity.WechatEvectionBean">
SELECT a.*,
GROUP_CONCAT( CASE WHEN a.user_ids != su.user_id THEN a.user_ids END SEPARATOR ', ' ) AS travelers,
GROUP_CONCAT( CASE WHEN a.user_names != su.user_name THEN a.user_names END SEPARATOR ', ' ) AS travelersName,
su.user_id ,su.user_name
FROM (
SELECT
l.id,
l.user_id as user_ids,
l.user_name as user_names,
l.org_id,
l.org_name,
l.create_time,
l.leave_type,
l.type,
l.leave_reason,
l.leave_start_date,
l.leave_start_interval,
l.leave_end_date,
l.leave_end_interval,
l.leave_duration,
GROUP_CONCAT(d.dict_label SEPARATOR ', ') AS postName,
l.leave_form_id as uuId,
l.submit_id,
l.update_time,
CASE
WHEN l.source = '1' THEN '系统'
WHEN l.source = '3' THEN '小程序'
ELSE ''
END AS source
FROM
leave_apply l
LEFT JOIN sys_user_post p ON p.user_id = l.user_id
LEFT JOIN sys_dict_data d on d.dict_code = p.post_id
WHERE
l.is_active = '1' AND l.leave_type = '出差报备' AND (l.source = '1' OR l.source = '3')
<if test="bean.params.beginTime != null and bean.params.beginTime != ''">
and date_format(l.leave_start_date,'%y%m%d') &gt;= date_format(#{bean.params.beginTime},'%y%m%d')
</if>
<if test="bean.params.endTime != null and bean.params.endTime != ''">
and date_format(l.leave_end_date,'%y%m%d') &lt;= date_format(#{bean.params.endTime},'%y%m%d')
</if>
GROUP BY
l.id,
l.user_id,
l.user_name,
l.org_id,
l.org_name,
l.create_time,
l.leave_type,
l.leave_reason,
l.leave_start_date,
l.leave_start_interval,
l.leave_end_date,
l.leave_end_interval,
l.leave_duration,
l.examine_status,
l.submit_id
ORDER BY l.update_time DESC
) a
LEFT JOIN sys_user su ON su.user_id = a.submit_id
GROUP BY uuId
ORDER BY leave_start_date DESC
</select>
<select id="selectEvectionById"
resultType="com.bonus.system.wechat.entity.WechatEvectionBean">
SELECT a.*,
GROUP_CONCAT( CASE WHEN a.user_ids != su.user_id THEN a.user_ids END SEPARATOR ', ' ) AS travelers,
GROUP_CONCAT( CASE WHEN a.user_names != su.user_name THEN a.user_names END SEPARATOR ', ' ) AS travelersName,
su.user_id,
su.user_name
FROM (SELECT l.id,
l.user_id as user_ids,
l.user_name as user_names,
l.org_id,
l.org_name,
l.create_time,
l.leave_type,
l.type,
l.leave_reason,
l.leave_start_date,
l.leave_start_interval,
l.leave_end_date,
l.leave_end_interval,
l.leave_duration,
GROUP_CONCAT(d.dict_label SEPARATOR ', ') AS postName,
l.leave_form_id as uuId,
l.submit_id,
l.host_user_id,
l.is_agree,
l.location,
l.remark
FROM leave_apply l
LEFT JOIN sys_user_post p ON p.user_id = l.user_id
LEFT JOIN sys_dict_data d on d.dict_code = p.post_id
WHERE l.is_active = '1'
AND l.leave_type = '出差报备'
and l.leave_form_id = #{uuId}
GROUP BY l.id,
l.user_id,
l.user_name,
l.org_id,
l.org_name,
l.create_time,
l.leave_type,
l.leave_reason,
l.leave_start_date,
l.leave_start_interval,
l.leave_end_date,
l.leave_end_interval,
l.leave_duration,
l.examine_status,
l.submit_id,
l.host_user_id,
l.is_agree,
l.location,
l.remark
ORDER BY l.update_time DESC) a
LEFT JOIN sys_user su ON su.user_id = a.submit_id
GROUP BY uuId
</select>
</mapper>

View File

@ -32,13 +32,6 @@
LEFT JOIN sys_dict_data d on d.dict_code = p.post_id
WHERE
l.is_active = '1' AND l.leave_type = '休假报备' AND (l.source = '1' OR l.source = '3')
<if test='params.orgList != null and params.orgList.size() > 0'>
and org_id in (
<foreach collection="params.orgList" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="params.params.beginTime != null and params.params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(l.leave_start_date,'%y%m%d') &gt;= date_format(#{params.params.beginTime},'%y%m%d')
</if>