导出领料出库明细
This commit is contained in:
parent
76490ac8c7
commit
0b65c3639f
|
|
@ -250,6 +250,42 @@ public class PoiOutPage {
|
||||||
return workbook;
|
return workbook;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HSSFWorkbook excelForcheckLeaseOut(List<Map<String, Object>> result, List<String> list, String filename) {
|
||||||
|
// 创建工作簿和工作表
|
||||||
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||||
|
HSSFSheet sheet = workbook.createSheet();
|
||||||
|
sheet.setDefaultColumnWidth(15); // 设置列宽
|
||||||
|
|
||||||
|
// 创建样式
|
||||||
|
HSSFCellStyle titleStyle = createTitleStyle(workbook);
|
||||||
|
HSSFCellStyle headerStyle = createHeaderStyle(workbook);
|
||||||
|
HSSFCellStyle contentStyle = createCellStyleCost(workbook);
|
||||||
|
|
||||||
|
// 设置工作簿名称
|
||||||
|
workbook.setSheetName(0, filename);
|
||||||
|
|
||||||
|
// 填充标题行
|
||||||
|
int rowNum = 0;
|
||||||
|
rowNum = createTitleRowStyle(sheet, rowNum, filename, titleStyle, list.size());
|
||||||
|
|
||||||
|
// 填充表头
|
||||||
|
rowNum = createHeaderRow(sheet, rowNum, list, headerStyle);
|
||||||
|
|
||||||
|
// 填充数据行
|
||||||
|
if (result != null && !result.isEmpty()) {
|
||||||
|
rowNum = createDataRows(sheet, rowNum, result, contentStyle, list.size());
|
||||||
|
} else {
|
||||||
|
// 如果没有数据,则仅显示表头
|
||||||
|
// rowNum++;
|
||||||
|
// rowNum = createDataRows(sheet, rowNum, result, contentStyle, list.size());
|
||||||
|
HSSFRow row = sheet.createRow(rowNum++);
|
||||||
|
HSSFCell cell = row.createCell(0);
|
||||||
|
cell.setCellStyle(headerStyle);
|
||||||
|
cell.setCellValue("暂无数据");
|
||||||
|
}
|
||||||
|
return workbook;
|
||||||
|
}
|
||||||
|
|
||||||
public static HSSFWorkbook excelForcheckAll(List<Map<String, Object>> resultLease,List<Map<String, Object>> resultLose,List<Map<String, Object>> resultRepair,List<Map<String, Object>> resultScrap,List<Map<String, Object>> resultsReduction,
|
public static HSSFWorkbook excelForcheckAll(List<Map<String, Object>> resultLease,List<Map<String, Object>> resultLose,List<Map<String, Object>> resultRepair,List<Map<String, Object>> resultScrap,List<Map<String, Object>> resultsReduction,
|
||||||
List<String> listLease,List<String> listLose,List<String> listRepair,List<String> listScrap,List<String> listReduction, String filename, String projectName, String unit,
|
List<String> listLease,List<String> listLose,List<String> listRepair,List<String> listScrap,List<String> listReduction, String filename, String projectName, String unit,
|
||||||
BigDecimal totalCostLease, BigDecimal totalCostLose, BigDecimal totalCostRepair, BigDecimal totalCostScrap,BigDecimal totalCostReduction) {
|
BigDecimal totalCostLease, BigDecimal totalCostLose, BigDecimal totalCostRepair, BigDecimal totalCostScrap,BigDecimal totalCostReduction) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,120 @@
|
||||||
|
package com.bonus.common.biz.domain.lease;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.domain.BmFileInfo;
|
||||||
|
import com.bonus.common.core.annotation.Excel;
|
||||||
|
import com.bonus.common.core.web.domain.BaseEntity;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领料任务对象 lease_apply_info
|
||||||
|
*
|
||||||
|
* @author xsheng
|
||||||
|
* @date 2024-10-16
|
||||||
|
*/
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Data
|
||||||
|
@ToString
|
||||||
|
public class LeaseApplyDetailExport extends BaseEntity{
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private int number;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "登录用户id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "申请时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "发布时间", width = 20, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date releaseTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "实施单位")
|
||||||
|
@Excel(name = "实施单位")
|
||||||
|
private String impUnitName;
|
||||||
|
|
||||||
|
private String materialName;
|
||||||
|
|
||||||
|
private String typeModelName;
|
||||||
|
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
private String manageTypeName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "领料单位")
|
||||||
|
@Excel(name = "租赁单位")
|
||||||
|
private String leaseUnit;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租赁工程")
|
||||||
|
@Excel(name = "租赁工程")
|
||||||
|
private String leaseProject;
|
||||||
|
|
||||||
|
|
||||||
|
/** 任务编号: 领料单号 */
|
||||||
|
@ApiModelProperty(value = "领料单号")
|
||||||
|
@Excel(name = "租赁申请单号")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
|
||||||
|
/** 领料人 */
|
||||||
|
@Excel(name = "领料人")
|
||||||
|
@ApiModelProperty(value = "领料人")
|
||||||
|
private String leasePerson;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** 1机具分公司审核通过,2调试分公司审核通过3机具分公司审核驳回4调试分公司审核驳回5出库进行中5出库完成 */
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
|
||||||
|
/** 任务状态(定义数据字典) */
|
||||||
|
@ApiModelProperty(value = "任务状态(定义数据字典)")
|
||||||
|
private Integer taskStatus;
|
||||||
|
|
||||||
|
@Excel(name = "状态")
|
||||||
|
@ApiModelProperty(value = "任务状态(定义数据字典)")
|
||||||
|
private String taskStatusName;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "已出库数量")
|
||||||
|
private BigDecimal alNum;
|
||||||
|
|
||||||
|
private BigDecimal outNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "开始时间")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "结束时间")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "关键字")
|
||||||
|
private String keyWord;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
@Excel(name = "备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "任务状态列表")
|
||||||
|
private List<Integer> statusList;
|
||||||
|
|
||||||
|
private String businessCode;
|
||||||
|
}
|
||||||
|
|
@ -3,8 +3,8 @@ package com.bonus.material.lease.controller;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import com.bonus.common.biz.annotation.StoreLog;
|
import com.bonus.common.biz.annotation.StoreLog;
|
||||||
import com.bonus.common.biz.config.ListPagingUtil;
|
import com.bonus.common.biz.config.ListPagingUtil;
|
||||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfoExport;
|
import com.bonus.common.biz.config.PoiOutPage;
|
||||||
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
import com.bonus.common.biz.domain.lease.*;
|
||||||
import com.bonus.common.core.utils.ServletUtils;
|
import com.bonus.common.core.utils.ServletUtils;
|
||||||
import com.bonus.common.core.utils.bean.BeanUtils;
|
import com.bonus.common.core.utils.bean.BeanUtils;
|
||||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||||
|
|
@ -17,24 +17,30 @@ import com.bonus.material.basic.domain.BmQrcodeInfo;
|
||||||
import com.bonus.material.basic.domain.ProjUsingRecord;
|
import com.bonus.material.basic.domain.ProjUsingRecord;
|
||||||
import com.bonus.material.basic.domain.ProjUsingRecordExport;
|
import com.bonus.material.basic.domain.ProjUsingRecordExport;
|
||||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
|
||||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||||
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
|
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
|
||||||
import com.bonus.common.biz.domain.lease.LeaseOutRequestVo;
|
|
||||||
import com.bonus.material.lease.service.ILeaseApplyInfoService;
|
import com.bonus.material.lease.service.ILeaseApplyInfoService;
|
||||||
|
import com.bonus.material.settlement.domain.vo.SltLeaseInfo;
|
||||||
import com.bonus.system.api.RemoteFileService;
|
import com.bonus.system.api.RemoteFileService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import com.bonus.common.log.annotation.SysLog;
|
||||||
/**
|
/**
|
||||||
* 领料任务Controller
|
* 领料任务Controller
|
||||||
*
|
*
|
||||||
|
|
@ -169,6 +175,125 @@ public class LeaseApplyInfoController extends BaseController {
|
||||||
util.exportExcel(response, exportList, "领料出库数据");
|
util.exportExcel(response, exportList, "领料出库数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出领料明细
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "导出领料明细")
|
||||||
|
@PreventRepeatSubmit
|
||||||
|
//@RequiresPermissions("lease:info:export")
|
||||||
|
@SysLog(title = "领料出库", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出领料明细")
|
||||||
|
@PostMapping("/exportLeaseOutRecordDetail")
|
||||||
|
public void exportLeaseOutRecordDetail(HttpServletResponse response, LeaseApplyInfo leaseApplyInfo) {
|
||||||
|
try {
|
||||||
|
List<LeaseApplyDetailExport> list = leaseApplyInfoService.selectLeaseApplyDetailList(leaseApplyInfo);
|
||||||
|
String fileName = "领料记录";
|
||||||
|
if (leaseApplyInfo.getStartTime() != null && leaseApplyInfo.getEndTime() != null) {
|
||||||
|
fileName = "领料记录" + leaseApplyInfo.getStartTime() + "至" + leaseApplyInfo.getEndTime();
|
||||||
|
}
|
||||||
|
expOutExcel(response, list, fileName);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("导出领料明细失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出结算单
|
||||||
|
* @param response
|
||||||
|
* @param list
|
||||||
|
* @param filename
|
||||||
|
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void expOutExcel(HttpServletResponse response, List<LeaseApplyDetailExport> list, String filename)
|
||||||
|
throws Exception {
|
||||||
|
if (list != null) {
|
||||||
|
List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
|
||||||
|
int size = list.size();
|
||||||
|
for (int i = 0; i < size; i++) {
|
||||||
|
LeaseApplyDetailExport bean = list.get(i);
|
||||||
|
bean.setNumber(i + 1);
|
||||||
|
Map<String, Object> maps = outReceiveDetailsBeanToMap(bean);
|
||||||
|
results.add(maps);
|
||||||
|
}
|
||||||
|
List<String> headers = receiveDetailsHeader();
|
||||||
|
HSSFWorkbook workbook = PoiOutPage.excelForcheckLeaseOut(results, headers, filename);
|
||||||
|
OutputStream out = null;
|
||||||
|
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||||
|
response.addHeader("Content-Disposition",
|
||||||
|
"attachment;filename=" + URLEncoder.encode(filename, "UTF-8") + ".xls");
|
||||||
|
response.setHeader("Pragma", "No-cache");
|
||||||
|
out = response.getOutputStream();
|
||||||
|
workbook.write(out);
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
|
}else{
|
||||||
|
List<Map<String, Object>> results = new ArrayList<Map<String, Object>>();
|
||||||
|
List<String> headers = receiveDetailsHeader();
|
||||||
|
HSSFWorkbook workbook = PoiOutPage.excelForcheckLeaseOut(results, headers, filename);
|
||||||
|
OutputStream out = null;
|
||||||
|
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
|
||||||
|
response.addHeader("Content-Disposition",
|
||||||
|
"attachment;filename=" + URLEncoder.encode(filename, "UTF-8") + ".xls");
|
||||||
|
response.setHeader("Pragma", "No-cache");
|
||||||
|
out = response.getOutputStream();
|
||||||
|
workbook.write(out);
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领料记录数据转换
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Map<String, Object> outReceiveDetailsBeanToMap(LeaseApplyDetailExport bean) {
|
||||||
|
// 创建一个SimpleDateFormat对象,定义日期格式
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
Map<String, Object> maps = new LinkedHashMap<String, Object>();
|
||||||
|
|
||||||
|
maps.put("impUnitName", bean.getImpUnitName());
|
||||||
|
maps.put("leaseProject", bean.getLeaseProject());
|
||||||
|
maps.put("leaseUnit", bean.getLeaseUnit());
|
||||||
|
maps.put("code", bean.getCode());
|
||||||
|
maps.put("leasePerson", bean.getLeasePerson());
|
||||||
|
maps.put("taskStatusName", bean.getTaskStatusName());
|
||||||
|
maps.put("releaseTime", bean.getReleaseTime()==null ? null:dateFormat.format(bean.getReleaseTime()));
|
||||||
|
maps.put("materialName", bean.getMaterialName());
|
||||||
|
maps.put("typeModelName", bean.getTypeModelName());
|
||||||
|
maps.put("typeName", bean.getTypeName());
|
||||||
|
maps.put("unitName", bean.getUnitName());
|
||||||
|
maps.put("alNum", bean.getAlNum());
|
||||||
|
maps.put("outNum", bean.getOutNum());
|
||||||
|
maps.put("manageTypeName", bean.getManageTypeName());
|
||||||
|
|
||||||
|
return maps;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领料出库表头
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private List<String> receiveDetailsHeader() {
|
||||||
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
|
list.add("分公司");
|
||||||
|
list.add("工程名称");
|
||||||
|
list.add("领料单位");
|
||||||
|
list.add("领料单号");
|
||||||
|
list.add("领料人");
|
||||||
|
list.add("状态");
|
||||||
|
list.add("创建时间");
|
||||||
|
list.add("物资仓库");
|
||||||
|
list.add("物资名称");
|
||||||
|
list.add("物资型号");
|
||||||
|
list.add("单位");
|
||||||
|
list.add("领料数量");
|
||||||
|
list.add("出库数量");
|
||||||
|
list.add("出库方式");
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取领料任务详细信息
|
* 获取领料任务详细信息
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.lease.mapper;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.domain.lease.LeaseApplyDetailExport;
|
||||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||||
import com.bonus.material.back.domain.vo.MaCodeVo;
|
import com.bonus.material.back.domain.vo.MaCodeVo;
|
||||||
import com.bonus.material.basic.domain.BmQrcodeInfo;
|
import com.bonus.material.basic.domain.BmQrcodeInfo;
|
||||||
|
|
@ -235,4 +236,8 @@ public interface LeaseApplyDetailsMapper {
|
||||||
LeaseApplyDetails getPengNum(LeaseOutDetails leaseOutDetails);
|
LeaseApplyDetails getPengNum(LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
LeaseApplyDetails getPendLease(LeaseOutDetails leaseOutDetails);
|
LeaseApplyDetails getPendLease(LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
|
List<LeaseApplyDetailExport> selectLeaseApplyLL(LeaseApplyInfo bean);
|
||||||
|
|
||||||
|
List<LeaseApplyDetailExport> selectLeaseApplyLY(LeaseApplyInfo bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.bonus.material.lease.service;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.common.biz.domain.lease.LeaseApplyDetailExport;
|
||||||
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||||
|
|
@ -209,4 +210,6 @@ public interface ILeaseApplyInfoService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<LeaseApplyDetails> getOutInfo(LeaseApplyInfo bean);
|
List<LeaseApplyDetails> getOutInfo(LeaseApplyInfo bean);
|
||||||
|
|
||||||
|
List<LeaseApplyDetailExport> selectLeaseApplyDetailList(LeaseApplyInfo leaseApplyInfo);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1145,6 +1145,64 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取领料出库详细信息
|
||||||
|
* @param bean
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<LeaseApplyDetailExport> selectLeaseApplyDetailList(LeaseApplyInfo bean) {
|
||||||
|
List<LeaseApplyDetailExport> listAll = new ArrayList<>();
|
||||||
|
//领料
|
||||||
|
List<LeaseApplyDetailExport> listOne = leaseApplyDetailsMapper.selectLeaseApplyLL(bean);
|
||||||
|
if (!CollectionUtils.isEmpty(listOne)) {
|
||||||
|
String keyWord = bean.getKeyWord();
|
||||||
|
List<?> statusList = bean.getStatusList();
|
||||||
|
|
||||||
|
// 转换为HashSet提高contains操作的效率(O(1))
|
||||||
|
Set<?> statusSet = CollectionUtils.isEmpty(statusList) ?
|
||||||
|
Collections.emptySet() :
|
||||||
|
new HashSet<>(statusList);
|
||||||
|
|
||||||
|
listOne = listOne.stream()
|
||||||
|
.filter(item -> StringUtils.isBlank(keyWord) || containsKeywordDetail(item, keyWord))
|
||||||
|
.filter(item -> statusSet.isEmpty() || statusSet.contains(item.getTaskStatus()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
//领用
|
||||||
|
List<LeaseApplyDetailExport> listTwo = leaseApplyDetailsMapper.selectLeaseApplyLY(bean);
|
||||||
|
if (!CollectionUtils.isEmpty(listTwo)) {
|
||||||
|
String keyWord = bean.getKeyWord();
|
||||||
|
List<?> statusList = bean.getStatusList();
|
||||||
|
|
||||||
|
// 转换为HashSet提高contains操作的效率(O(1))
|
||||||
|
Set<?> statusSet = CollectionUtils.isEmpty(statusList) ?
|
||||||
|
Collections.emptySet() :
|
||||||
|
new HashSet<>(statusList);
|
||||||
|
|
||||||
|
listTwo = listTwo.stream()
|
||||||
|
.filter(item -> StringUtils.isBlank(keyWord) || containsKeywordDetail(item, keyWord))
|
||||||
|
.filter(item -> statusSet.isEmpty() || statusSet.contains(item.getTaskStatus()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CollectionUtils.isEmpty(listOne)) {
|
||||||
|
listAll.addAll(listOne);
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(listTwo)) {
|
||||||
|
listAll.addAll(listTwo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 对合并后的列表进行排序
|
||||||
|
if (!CollectionUtils.isEmpty(listAll)) {
|
||||||
|
listAll = listAll.stream()
|
||||||
|
.sorted(Comparator.comparing(LeaseApplyDetailExport::getCode)
|
||||||
|
.thenComparing(LeaseApplyDetailExport::getReleaseTime))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return listAll;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关键字搜索
|
* 关键字搜索
|
||||||
|
|
@ -1167,6 +1225,17 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
||||||
(item.getBusinessCode() != null && item.getBusinessCode().contains(keyWord));
|
(item.getBusinessCode() != null && item.getBusinessCode().contains(keyWord));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean containsKeywordDetail(LeaseApplyDetailExport item, String keyWord) {
|
||||||
|
return (item.getLeaseUnit() != null && item.getLeaseUnit().contains(keyWord)) ||
|
||||||
|
(item.getUnitName() != null && item.getUnitName().contains(keyWord)) ||
|
||||||
|
(item.getLeaseProject() != null && item.getLeaseProject().contains(keyWord)) ||
|
||||||
|
(item.getCode() != null && item.getCode().contains(keyWord)) ||
|
||||||
|
(item.getCreateBy() != null && item.getCreateBy().contains(keyWord)) ||
|
||||||
|
(item.getLeasePerson() != null && item.getLeasePerson().contains(keyWord)) ||
|
||||||
|
(item.getImpUnitName() != null && item.getImpUnitName().contains(keyWord)) ||
|
||||||
|
(item.getBusinessCode() != null && item.getBusinessCode().contains(keyWord));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增领料任务
|
* 新增领料任务
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -774,5 +774,101 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
parent_id = #{parentId}
|
parent_id = #{parentId}
|
||||||
and type_id = #{typeId}
|
and type_id = #{typeId}
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectLeaseApplyLL" resultType="com.bonus.common.biz.domain.lease.LeaseApplyDetailExport">
|
||||||
|
select
|
||||||
|
lod.id as id,
|
||||||
|
mt2.type_name as materialName,
|
||||||
|
mt1.type_name as typeModelName,
|
||||||
|
mt.type_name as typeName,
|
||||||
|
mt.unit_name as unitName,
|
||||||
|
lai.code,
|
||||||
|
lai.lease_person as leasePerson,
|
||||||
|
tt.task_status as taskStatus,
|
||||||
|
COALESCE(lai.release_time, lai.create_time) as releaseTime,
|
||||||
|
bu.unit_name as leaseUnit ,
|
||||||
|
bp.pro_name as leaseProject,
|
||||||
|
IFNULL(sum(lod.out_num),0) as alNum,
|
||||||
|
IFNULL(sum(lod.out_num),0) as outNum,
|
||||||
|
sda.dict_label as taskStatusName,
|
||||||
|
sd.dept_name as impUnitName,
|
||||||
|
CASE
|
||||||
|
WHEN mt.manage_type = 0 THEN '编码出库'
|
||||||
|
ELSE '数量出库'
|
||||||
|
END as manageTypeName
|
||||||
|
from
|
||||||
|
lease_out_details lod
|
||||||
|
left join lease_apply_info lai on lai.id = lod.parent_id
|
||||||
|
left join tm_task tt on lai.task_id = tt.task_id
|
||||||
|
left join tm_task_agreement tta on lai.task_id = tta.task_id
|
||||||
|
left join bm_agreement_info bai on tta.agreement_id = bai.agreement_id
|
||||||
|
left join bm_unit bu on bu.unit_id = bai.unit_id
|
||||||
|
left join bm_project bp on bp.pro_id = bai.project_id
|
||||||
|
left join sys_dept sd on sd.dept_id = bp.imp_unit
|
||||||
|
left join sys_dict_data sda on tt.task_status = sda.dict_value
|
||||||
|
and sda.dict_type = 'lease_task_status'
|
||||||
|
left join ma_type mt on lod.type_id = mt.type_id and mt.del_flag = '0'
|
||||||
|
left join ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0'
|
||||||
|
left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0'
|
||||||
|
left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0'
|
||||||
|
<if test="userId != null">
|
||||||
|
JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id =#{userId}
|
||||||
|
</if>
|
||||||
|
where
|
||||||
|
tt.task_type = '2'
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
and COALESCE(lai.release_time, lai.create_time) BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||||
|
</if>
|
||||||
|
GROUP BY lai.id,lod.type_id
|
||||||
|
order by lai.id
|
||||||
|
</select>
|
||||||
|
<select id="selectLeaseApplyLY" resultType="com.bonus.common.biz.domain.lease.LeaseApplyDetailExport">
|
||||||
|
select
|
||||||
|
lod.id as id,
|
||||||
|
mt2.type_name as materialName,
|
||||||
|
mt1.type_name as typeModelName,
|
||||||
|
mt.type_name as typeName,
|
||||||
|
mt.unit_name as unitName,
|
||||||
|
lpd.publish_task as code,
|
||||||
|
lpd.code as businessCode,
|
||||||
|
lpd.lease_person AS leasePerson,
|
||||||
|
tt.task_status as taskStatus,
|
||||||
|
lpd.create_time AS releaseTime,
|
||||||
|
bu.unit_name as leaseUnit ,
|
||||||
|
bp.pro_name as leaseProject,
|
||||||
|
IFNULL(sum(lod.out_num),0) as alNum,
|
||||||
|
IFNULL(sum(lod.out_num),0) as outNum,
|
||||||
|
sda.dict_label as taskStatusName,
|
||||||
|
sd.dept_name as impUnitName,
|
||||||
|
CASE
|
||||||
|
WHEN mt.manage_type = 0 THEN '编码出库'
|
||||||
|
ELSE '数量出库'
|
||||||
|
END as manageTypeName
|
||||||
|
|
||||||
|
|
||||||
|
from
|
||||||
|
lease_out_details lod
|
||||||
|
left join lease_publish_details lpd on lod.parent_id = lpd.parent_id
|
||||||
|
left join tm_task tt on tt.code = lpd.publish_task and tt.task_type = 19
|
||||||
|
left join bm_unit bu on bu.unit_id = lpd.unit_id
|
||||||
|
left join bm_project bp on bp.pro_id = lpd.project_id
|
||||||
|
left join sys_dept sd on sd.dept_id = bp.imp_unit
|
||||||
|
left join sys_dict_data sda on tt.task_status = sda.dict_value
|
||||||
|
and sda.dict_type = 'lease_task_status'
|
||||||
|
left join ma_type mt on lod.type_id = mt.type_id and mt.del_flag = '0'
|
||||||
|
left join ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0'
|
||||||
|
left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0'
|
||||||
|
left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0'
|
||||||
|
|
||||||
|
<if test="userId != null">
|
||||||
|
JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id =#{userId}
|
||||||
|
</if>
|
||||||
|
where
|
||||||
|
tt.task_type = '19'
|
||||||
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
and DATE_FORMAT( lpd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime}
|
||||||
|
</if>
|
||||||
|
GROUP BY lpd.publish_task,lod.type_id
|
||||||
|
order by lpd.id
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue