领料申请和管理数据导出功能

This commit is contained in:
liang.chao 2024-01-11 15:58:22 +08:00
parent 260f09af4d
commit 664c7e147d
3 changed files with 274 additions and 40 deletions

View File

@ -0,0 +1,222 @@
package com.bonus.sgzb.base.api.domain;
import com.bonus.sgzb.common.core.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* Description: 任务表tm_task
* @Author 阮世耀
* @Create 2023/12/13 15:14
* @Version 1.0
*/
@Data
public class TmTaskDto implements Serializable {
private static final long serialVersionUID = -4135112109792782142L;
private String id;
/**
* 任务ID
*/
@ApiModelProperty(value="任务ID")
private Long taskId;
/**
* 任务类型(定义数据字典)
*/
@ApiModelProperty(value="任务类型(数据字典)")
private Integer taskType;
/**
* 任务状态(定义数据字典)
*/
@ApiModelProperty(value="任务状态(数据字典)")
private Integer taskStatus;
/**
* 预领料合计数
*/
@ApiModelProperty(value="预领料合计数")
private int preCountNum;
/**
* 编号
*/
@ApiModelProperty(value="编号")
@Excel(name = "领料单号",sort = 1)
private String code;
/**
* 创建者
*/
@ApiModelProperty(value="创建者")
private String createBy;
/**
* 申请人手机号码
*/
@ApiModelProperty(value="手机号")
private String phoneNumber;
/**
* 部门名称 单位名称
*/
@ApiModelProperty(value="部门/单位名称")
private String deptName;
/**
* 工程名称
*/
@ApiModelProperty(value="工程名称")
@Excel(name = "领料工程",sort = 3)
private String proName;
/**
* 创建时间
*/
@ApiModelProperty(value="创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/**
* 更新者
*/
@ApiModelProperty(value="更新者")
private String updateBy;
/**
* 更新时间
*/
@ApiModelProperty(value="更新时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
/**
* 备注
*/
@ApiModelProperty(value="备注")
@Excel(name = "备注",sort = 11)
private String remark;
/**
* 数据所属组织
*/
@ApiModelProperty(value="数据所属组织")
private Integer companyId;
/**
* 领料任务实体
*/
@ApiModelProperty(value="领料任务实体")
private LeaseApplyInfo leaseApplyInfo;
/**
* 领料任务实体集合
*/
@ApiModelProperty(value="领料任务实体集合")
private List<LeaseApplyInfo> leaseApplyInfoList;
/**
* 领料任务详情集合
*/
@ApiModelProperty(value="领料任务详情集合")
private List<LeaseApplyDetails> leaseApplyDetails;
@ApiModelProperty(value="协议id")
private Integer agreementId;
@ApiModelProperty(value="退料人")
private String backPerson;
@ApiModelProperty(value="退料人联系电话")
private String phone;
@ApiModelProperty(value="退料申请时间")
private String backTime;
@ApiModelProperty(value="退料审核人 机具分公司审批人")
private String directAuditBy;
@ApiModelProperty(value="退料审核时间 机具分公司审批时间")
private String directAuditTime;
@ApiModelProperty(value="退料审核备注 机具分公司审批备注")
private String directAuditRemark;
@ApiModelProperty(value="往来单位id")
private Long unitId;
@ApiModelProperty(value="往来单位")
@Excel(name = "领料单位",sort = 2)
private String unitName;
@ApiModelProperty(value="工程id")
private Long projectId;
@ApiModelProperty(value="关键字")
private String keyWord;
@ApiModelProperty(value="开始时间")
private String startTime;
@ApiModelProperty(value="结束时间")
private String endTime;
@ApiModelProperty(value="类型")
private Integer types;
@ApiModelProperty(value="协议编号")
@Excel(name = "协议号",sort = 4)
private String agreementCode;
@ApiModelProperty(value="领料人")
@Excel(name = "领料人",sort = 5)
private String leasePerson;
@ApiModelProperty(value="领料人手机号")
@Excel(name = "联系电话",sort = 6)
private String leasePhone;
@ApiModelProperty(value="申请人")
@Excel(name = "申请人",sort = 7)
private String applyFor;
@ApiModelProperty(value="任务状态")
@Excel(name = "任务状态",sort = 9)
private String taskName;
@ApiModelProperty(value="审批状态id")
private String examineStatusId;
@ApiModelProperty(value="审批状态的备注")
private String examineStatus;
@ApiModelProperty(value="创建时间")
@Excel(name = "申请时间",sort = 8)
private String createTimes;
@ApiModelProperty(value="更新时间")
private String updateTimes;
@ApiModelProperty(value="公司审批人")
private String companyAuditBy;
@ApiModelProperty(value="公司审批时间")
private String companyAuditTime;
@ApiModelProperty(value="公司审批备注")
private String companyAuditRemark;
@ApiModelProperty(value="分管审批人")
private String deptAuditBy;
@ApiModelProperty(value="分管审批时间")
private String deptAuditTime;
@ApiModelProperty(value="分管审批备注")
private String deptAuditRemark;
}

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.app.controller;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import com.bonus.sgzb.app.service.LeaseApplyDetailsService;
import com.bonus.sgzb.app.service.LeaseApplyInfoService;
import com.bonus.sgzb.app.service.LeaseUserBookService;
@ -8,6 +9,7 @@ import com.bonus.sgzb.app.service.TmTaskService;
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.base.api.domain.TmTaskDto;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
import com.bonus.sgzb.common.core.web.controller.BaseController;
@ -16,6 +18,7 @@ import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import com.bonus.sgzb.common.log.annotation.Log;
import com.bonus.sgzb.common.log.enums.BusinessType;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@ -286,14 +289,21 @@ public class TmTaskController extends BaseController {
* 领料申请导出
* 注意备注字段到时要换
*/
@ApiOperation("领料申请导出")
@Log(title = "领料申请导出", businessType = BusinessType.EXPORT)
@ApiOperation("领料申请/管理导出")
@Log(title = "领料申请/管理导出", businessType = BusinessType.EXPORT)
@GetMapping("/applyExport")
public void applyExport(HttpServletResponse response, TmTask task) {
startPage();
List<TmTask> leaseAuditList = tmTaskService.getLeaseAuditList(task);
if (task.getTypes() == 1) {
//领料申请的数据
ExcelUtil<TmTask> util = new ExcelUtil<TmTask>(TmTask.class);
util.exportExcel(response, leaseAuditList, "领料申请数据");
} else {
//领料管理的数据
List<TmTaskDto> tmTaskDtos = Convert.toList(TmTaskDto.class, leaseAuditList);
ExcelUtil<TmTaskDto> util = new ExcelUtil<TmTaskDto>(TmTaskDto.class);
util.exportExcel(response, tmTaskDtos, "领料管理数据");
}
}

View File

@ -6,6 +6,7 @@ import com.bonus.sgzb.app.service.TmTaskService;
import com.bonus.sgzb.base.api.domain.LeaseApplyDetails;
import com.bonus.sgzb.base.api.domain.LeaseApplyInfo;
import com.bonus.sgzb.base.api.domain.TmTask;
import com.bonus.sgzb.base.api.domain.TmTaskDto;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
@ -15,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@ -31,6 +33,41 @@ public class TmTaskServiceImpl implements TmTaskService{
@Resource
private TmTaskMapper tmTaskMapper;
/**
* 领料任务审核状态
*
* @param record 审核数据及信息
*/
@Override
@Transactional
public int updateLeaseTaskAuditInfo(TmTask record) {
int result = 0;
if (StringUtils.isNotNull(record)) {
// 先审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
// 再审核领料任务信息表
if (CollUtil.isNotEmpty(record.getLeaseApplyInfoList())) {
for (LeaseApplyInfo leaseApplyInfo : record.getLeaseApplyInfoList()) {
if (leaseApplyInfo != null) {
//leaseApplyInfo.setExamineStatusId(record.getExamineStatusId());
result += tmTaskMapper.updateLeaseApplyInfoAuditInfo(leaseApplyInfo);
// 再审核领料任务详情表
if (CollUtil.isNotEmpty(leaseApplyInfo.getLeaseApplyDetails())) {
for (LeaseApplyDetails leaseApplyDetails : leaseApplyInfo.getLeaseApplyDetails()) {
if (StringUtils.isNotNull(leaseApplyDetails)) {
result += tmTaskMapper.updateLeaseApplyDetailsAuditInfo(leaseApplyDetails);
}
}
}
}
}
}
} else {
return 0;
}
return result;
}
/**
* 获取审核列表
*/
@ -70,41 +107,6 @@ public class TmTaskServiceImpl implements TmTaskService{
return tmTaskList;
}
/**
* 领料任务审核状态
*
* @param record 审核数据及信息
*/
@Override
@Transactional
public int updateLeaseTaskAuditInfo(TmTask record) {
int result = 0;
if (StringUtils.isNotNull(record)) {
// 先审核任务表
result += tmTaskMapper.updateTmTaskAuditStatus(record);
// 再审核领料任务信息表
if (CollUtil.isNotEmpty(record.getLeaseApplyInfoList())) {
for (LeaseApplyInfo leaseApplyInfo : record.getLeaseApplyInfoList()) {
if (leaseApplyInfo != null) {
//leaseApplyInfo.setExamineStatusId(record.getExamineStatusId());
result += tmTaskMapper.updateLeaseApplyInfoAuditInfo(leaseApplyInfo);
// 再审核领料任务详情表
if (CollUtil.isNotEmpty(leaseApplyInfo.getLeaseApplyDetails())) {
for (LeaseApplyDetails leaseApplyDetails : leaseApplyInfo.getLeaseApplyDetails()) {
if (StringUtils.isNotNull(leaseApplyDetails)) {
result += tmTaskMapper.updateLeaseApplyDetailsAuditInfo(leaseApplyDetails);
}
}
}
}
}
}
} else {
return 0;
}
return result;
}
/**
* 领料任务驳回
*