Merge remote-tracking branch 'origin/master'

This commit is contained in:
hongchao 2025-10-10 12:14:35 +08:00
commit bc8822fc1f
13 changed files with 739 additions and 64 deletions

View File

@ -3,6 +3,7 @@ package com.bonus.material.clz.controller;
import cn.hutool.core.convert.Convert;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.bonus.common.biz.config.ListPagingUtil;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
@ -11,11 +12,8 @@ import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.BmQrcodeInfo;
import com.bonus.material.clz.domain.lease.*;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.clz.domain.lease.LeaseApplyDetailsInfo;
import com.bonus.material.clz.domain.lease.LeaseOutDetailsInfo;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetails;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo;
import com.bonus.material.clz.domain.vo.lease.LeaseTotalInfo;
import com.bonus.material.clz.domain.vo.lease.MaterialLeaseApplyRequestVo;
import com.bonus.material.clz.service.MaterialLeaseInfoService;
@ -66,6 +64,29 @@ public class MaterialLeaseInfoController extends BaseController {
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
/**
* 综合查询--导出材料站领料记录
* @param response
* @param bean
*/
@ApiOperation(value = "综合查询--导出材料站领料记录")
@PostMapping("/exportTotalList")
public void exportSafeDetailsList(HttpServletResponse response, MaterialLeaseApplyInfo bean) {
String fileName = "领料记录";
if (bean.getStartTime() != null && bean.getEndTime() != null) {
fileName = "领料记录"+ "(领料时间" +bean.getStartTime() + "" + bean.getEndTime()+ "";
}
List<MaterialLeaseApplyDetailExport> list = materialLeaseInfoService.getTotalDetailsList(bean);
// 根据list集合数去填充序号
for (int i = 0; i < list.size(); i++) {
list.get(i).setSeq(i + 1);
}
ExcelUtil<MaterialLeaseApplyDetailExport> util = new ExcelUtil<>(MaterialLeaseApplyDetailExport.class);
// 获取当前年月日时分秒导出时间用括号拼接在后面
String title = "材料站领料记录" + "" + DateUtils.getTime() + "";
util.exportExcel(response, list, fileName, title);
}
/**
* 领料任务添加备注
* @param leaseApplyInfo
@ -343,7 +364,7 @@ public class MaterialLeaseInfoController extends BaseController {
bean.setIsExport(0);
List<LeaseTotalInfo> list = materialLeaseInfoService.getLeaseInfoDetails(bean);
ExcelUtil<LeaseTotalInfo> util = new ExcelUtil<>(LeaseTotalInfo.class);
util.exportExcel(response, list, "综合查询--工器具领料记录查询");
util.exportExcel(response, list, "综合查询--工器具领料记录查询", "工器具领料记录查询");
}
/**

View File

@ -3,6 +3,7 @@ package com.bonus.material.clz.controller;
import cn.hutool.core.convert.Convert;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.bonus.common.biz.config.ListPagingUtil;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.ServletUtils;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
@ -256,10 +257,33 @@ public class MaterialMachineController extends BaseController {
@GetMapping("/getSafeDetailsList")
public AjaxResult getSafeDetailsList(MaterialRetainedEquipmentInfo bean) {
startPage();
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getSafeDetailsList(bean);
List<SafeMaterialEquipmentInfo> list = materialMachineService.getSafeDetailsList(bean);
return AjaxResult.success(getDataTable(list));
}
/**
* 导出工器具预警页面查询
* @param response
* @param bean
*/
@ApiOperation(value = "综合查询--导出工器具预警页面查询")
@PostMapping("/exportSafeDetailsList")
public void exportSafeDetailsList(HttpServletResponse response, MaterialRetainedEquipmentInfo bean) {
String fileName = "预警记录";
if (bean.getStartTime() != null && bean.getEndTime() != null) {
fileName = "预警记录"+ "(检验时间" +bean.getStartTime() + "" + bean.getEndTime()+ "";
}
List<SafeMaterialEquipmentInfo> list = materialMachineService.getSafeDetailsList(bean);
// 根据list集合数去填充序号
for (int i = 0; i < list.size(); i++) {
list.get(i).setSeq(i + 1);
}
ExcelUtil<SafeMaterialEquipmentInfo> util = new ExcelUtil<>(SafeMaterialEquipmentInfo.class);
// 获取当前年月日导出时间用括号拼接在后面
String title = "工器具预警记录" + "" + DateUtils.getTime() + "";
util.exportExcel(response, list, fileName, title);
}
/**
* 安全工器具预警页面查询获取协议id
* @param bean

View File

@ -0,0 +1,131 @@
package com.bonus.material.clz.domain.lease;
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 MaterialLeaseApplyDetailExport extends BaseEntity{
private static final long serialVersionUID = 1L;
/** ID */
private Long id;
private int number;
@ApiModelProperty(value = "登录用户id")
private Long userId;
@ApiModelProperty(value = "序号")
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, width = 5)
private Integer seq;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date releaseTime;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
@ApiModelProperty(value = "领料单位")
@Excel(name = "领料单位", width = 30)
private String leaseUnit;
@ApiModelProperty(value = "工程名称")
@Excel(name = "领料工程", width = 30)
private String leaseProject;
@ApiModelProperty(value = "物资仓库")
private String materialName;
@ApiModelProperty(value = "物资名称")
@Excel(name = "物资名称")
private String typeModelName;
@ApiModelProperty(value = "物资型号")
@Excel(name = "物资型号")
private String typeName;
@ApiModelProperty(value = "单位")
@Excel(name = "单位")
private String unitName;
@ApiModelProperty(value = "领料数量")
@Excel(name = "领料数量", cellType = Excel.ColumnType.NUMERIC)
private BigDecimal alNum;
@ApiModelProperty(value = "出库数量")
@Excel(name = "出库数量", cellType = Excel.ColumnType.NUMERIC)
private BigDecimal outNum;
@ApiModelProperty(value = "出库时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出库时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date outTime;
@ApiModelProperty(value = "出库方式")
@Excel(name = "出库方式")
private String manageTypeName;
/** 任务编号: 领料单号 */
@ApiModelProperty(value = "领料单号")
@Excel(name = "领料单号")
private String code;
/** 领料人 */
@Excel(name = "领料人")
@ApiModelProperty(value = "领料人")
private String leasePerson;
/** 任务状态(定义数据字典) */
@ApiModelProperty(value = "任务状态(定义数据字典)")
private Integer taskStatus;
@ApiModelProperty(value = "任务状态(定义数据字典)")
private String taskStatusName;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "任务状态列表")
private List<Integer> statusList;
private String businessCode;
@ApiModelProperty(value = "实施单位")
private String impUnit;
@ApiModelProperty(value = "身份证号码")
private String idCard;
@ApiModelProperty(value="工程id")
private Long proId;
}

View File

@ -0,0 +1,245 @@
package com.bonus.material.clz.domain.vo;
import com.bonus.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.apache.poi.ss.usermodel.HorizontalAlignment;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* @description 综合查询--保有设备总量查询
* @author ma_sh
* @date 2024/2/26 14:51
*/
@ApiModel(description = "保有设备总量查询")
@Data
public class SafeMaterialEquipmentInfo {
private static final long serialVersionUID = 2227217051604273598L;
@ApiModelProperty(value = "是否app 0 是1 否")
private Integer isApp;
@ApiModelProperty(value = "是否导出 0 是1 否")
private Integer isExport;
@ApiModelProperty(value = "主键id")
private Integer id;
@ApiModelProperty(value = "仓库信息")
private String whHouseName;
@ApiModelProperty(value = "工程id")
private String proId;
@ApiModelProperty(value = "序号")
@Excel(name = "序号", cellType = Excel.ColumnType.NUMERIC, width = 5)
private Integer seq;
@ApiModelProperty(value = "分公司")
@Excel(name = "分公司")
private String impUnitName;
@ApiModelProperty(value = "项目部")
@Excel(name = "项目部", width = 25)
private String departName;
@ApiModelProperty(value = "项目部id")
private String departId;
@ApiModelProperty(value = "工程名称")
@Excel(name = "工程名称", width = 60)
private String proName;
@ApiModelProperty(value = "分包单位")
@Excel(name = "分包单位", width = 25)
private String subUnitName;
@ApiModelProperty(value = "班组名称")
@Excel(name = "班组名称")
private String teamName;
@ApiModelProperty(value = "物资类型")
@Excel(name = "物资类型")
private String materialName;
@ApiModelProperty(value = "物资名称")
@Excel(name = "物资名称")
private String typeName;
@ApiModelProperty(value = "规格ID")
private Integer typeId;
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号")
private String typeModelName;
@Excel(name = "设备编号")
private String maCode;
/** 本次检验日期 */
@ApiModelProperty(value = "本次检验日期")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "本次检验时间", width = 20, align = HorizontalAlignment.CENTER, dateFormat = "yyyy-MM-dd")
private Date thisCheckTime;
/** 下次检验日期 */
@ApiModelProperty(value = "下次检验日期")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "下次检验时间", width = 20, align = HorizontalAlignment.CENTER, dateFormat = "yyyy-MM-dd")
private Date nextCheckTime;
@ApiModelProperty(value = "二维码code")
@Excel(name = "二维码")
private String qrCode;
/**
* 状态(0 =正常1= 3个月检测到期2= 1个月检测到期3= 已过期)
*/
@Excel(name = "状态", width = 20, readConverterExp = "0=正常,1=3个月检测到期,2=1个月检测到期,3=已过期")
private String status;
@ApiModelProperty("机具类型1机具2安全工器具")
private String jiJuType;
@ApiModelProperty(value = "计量单位")
private String unit;
@ApiModelProperty(value = "在库数量")
private BigDecimal storeNum;
@ApiModelProperty(value = "在用数量")
private BigDecimal usNum;
@ApiModelProperty(value = "数量")
private BigDecimal allNum;
@ApiModelProperty(value = "管理模式")
private String manageType;
@ApiModelProperty(value = "创建者")
private String createBy;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
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")
private Date updateTime;
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "数据所属组织")
private Integer companyId;
/** 1.机具仓储 2.调试仓储 */
private String maType;
private String maTypeName;
/**
* 是否伸展APP
*/
private boolean expanded = false;
/**
* 检验状态
*/
private String checkStatus;
/** 正常设备数量 */
private long normalNum;
/** 3个月检测到期设备数量 */
private long threeMonthNum;
/** 1个月检测到期设备数量 */
private long oneMonthNum;
/** 已过期设备数量 */
private long expiredNum;
@ApiModelProperty(value = "班组id")
private String teamId;
/**
* 班组长账号
*/
private String teamLeaderIdCard;
@ApiModelProperty(value = "i8工程id")
private String externalId;
@ApiModelProperty(value = "身份证号码")
private String idCard;
@ApiModelProperty(value = "实施单位id")
private String impUnit;
/**
* i8工程id集合
*/
private List<String> projectIdList;
@ApiModelProperty(value = "协议id集合")
private List<Integer> agreementIdList;
private Long maId;
@ApiModelProperty(value = "领料人")
private String code;
@ApiModelProperty(value = "领料人")
private String leasePerson;
@ApiModelProperty(value = "协议id")
private Long agreementId;
private Long deptId;
@ApiModelProperty(value = "项目部名称")
private String proCenter;
@ApiModelProperty(value = "开始时间")
private String startTime;
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "0整型 1小数")
private String unitValue;
private String unitType;
@ApiModelProperty(value = "报告编码")
private String reportCode;
@ApiModelProperty(value = "报告路径")
private String reportUrl;
@ApiModelProperty(value = "协议id")
private String agreementIds;
}

View File

@ -7,6 +7,7 @@ import com.bonus.material.basic.domain.BmAgreementInfo;
import com.bonus.material.basic.domain.BmQrcodeInfo;
import com.bonus.material.clz.domain.TeamVo;
import com.bonus.material.clz.domain.direct.ClzDirectApplyDetails;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetailExport;
import com.bonus.material.clz.domain.vo.MaterialMaCodeVo;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.clz.domain.lease.LeaseApplyDetailsInfo;
@ -461,4 +462,18 @@ public interface MaterialLeaseInfoMapper {
* @return
*/
List<TeamVo> getJcTeamInfo(MaterialLeaseApplyDetails materialLeaseApplyDetails);
/**
* 领料列表查询
* @param bean
* @return
*/
List<MaterialLeaseApplyDetailExport> selectLeaseApplyLL(MaterialLeaseApplyInfo bean);
/**
* 领用列表查询
* @param bean
* @return
*/
List<MaterialLeaseApplyDetailExport> selectLeaseApplyLY(MaterialLeaseApplyInfo bean);
}

View File

@ -128,7 +128,7 @@ public interface MaterialMachineMapper {
* @param bean
* @return
*/
List<MaterialRetainedEquipmentInfo> getTotalList(MaterialRetainedEquipmentInfo bean);
List<SafeMaterialEquipmentInfo> getTotalList(MaterialRetainedEquipmentInfo bean);
/**
* 班组库存查询

View File

@ -3,10 +3,7 @@ package com.bonus.material.clz.service;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.BmQrcodeInfo;
import com.bonus.material.clz.domain.lease.LeaseApplyDetailsInfo;
import com.bonus.material.clz.domain.lease.LeaseOutDetailsInfo;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetails;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo;
import com.bonus.material.clz.domain.lease.*;
import com.bonus.material.clz.domain.vo.lease.LeaseTotalInfo;
import com.bonus.material.clz.domain.vo.lease.MaterialLeaseApplyRequestVo;
@ -167,4 +164,11 @@ public interface MaterialLeaseInfoService {
* @return
*/
AjaxResult getLeaseDataByCode(LeaseTotalInfo info);
/**
* 导出材料站领料记录
* @param bean
* @return
*/
List<MaterialLeaseApplyDetailExport> getTotalDetailsList(MaterialLeaseApplyInfo bean);
}

View File

@ -83,7 +83,7 @@ public interface MaterialMachineService {
* @param bean
* @return
*/
List<MaterialRetainedEquipmentInfo> getSafeDetailsList(MaterialRetainedEquipmentInfo bean);
List<SafeMaterialEquipmentInfo> getSafeDetailsList(MaterialRetainedEquipmentInfo bean);
/**
* 后台班组在用库存查询
@ -111,7 +111,7 @@ public interface MaterialMachineService {
* @param bean
* @return
*/
MaterialRetainedEquipmentInfo getSafeNumList(MaterialRetainedEquipmentInfo bean);
SafeMaterialEquipmentInfo getSafeNumList(MaterialRetainedEquipmentInfo bean);
/**
* 安全工器具预警页面查询获取协议id

View File

@ -739,7 +739,8 @@ public class ClzDirectServiceImpl implements ClzDirectService {
if (history.getNextNodeId() != null && history.getNextNodeId() == 43) {
userList = directAuditMapper.getProjectId(directApplyInfo.getLeaseTeamId());
}
if (history.getNextNodeId() != null && history.getNextNodeId() == 44) {
// 项目经理审核
/*if (history.getNextNodeId() != null && history.getNextNodeId() == 44) {
//根据project_id获取external_id
String externalId = directAuditMapper.getExternalId(Integer.parseInt(directApplyInfo.getLeaseProId()));
if (externalId != null && !externalId.isEmpty()) {
@ -751,7 +752,7 @@ public class ClzDirectServiceImpl implements ClzDirectService {
userList = directAuditMapper.getUserIdByUserName(leaderAccount);
}
}
}
}*/
String userIds = userList.stream().map(WorkPeopleInfo::getUserId).map(String::valueOf).collect(Collectors.joining(","));
history.setDirectUserIds(userIds);
history.setRemark(directApplyInfo.getRemark());

View File

@ -6,7 +6,6 @@ import com.bonus.common.biz.constant.MaterialConstants;
import com.bonus.common.biz.domain.BmFileInfo;
import com.bonus.common.biz.domain.TypeTreeBuild;
import com.bonus.common.biz.domain.TypeTreeNode;
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
import com.bonus.common.biz.domain.lease.LeaseOutSign;
import com.bonus.common.biz.domain.lease.MaterialLeaseMaCodeDto;
@ -18,16 +17,14 @@ import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.back.domain.BackApplyInfo;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.BmAgreementInfo;
import com.bonus.material.basic.domain.BmQrcodeInfo;
import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.clz.domain.BmTeam;
import com.bonus.material.clz.domain.lease.*;
import com.bonus.material.clz.domain.vo.MaterialMaCodeVo;
import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo;
import com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo;
import com.bonus.material.clz.mapper.BmTeamMapper;
import com.bonus.material.clz.mapper.IwsTeamUserMapper;
import com.bonus.material.clz.mapper.MaterialMachineMapper;
@ -36,10 +33,6 @@ import com.bonus.material.common.domain.vo.AgreementVo;
import com.bonus.material.common.mapper.SelectMapper;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.mapper.TypeMapper;
import com.bonus.material.clz.domain.lease.LeaseApplyDetailsInfo;
import com.bonus.material.clz.domain.lease.LeaseOutDetailsInfo;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetails;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo;
import com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo;
import com.bonus.material.clz.domain.vo.lease.LeaseTotalInfo;
import com.bonus.material.clz.domain.vo.lease.MaterialLeaseApplyRequestVo;
@ -265,10 +258,12 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
if (teamData == null) {
// 根据用户名查询项目部信息
List<String> departId = mapper.getDepartId(username);
// 根据项目部id查询工程信息
List<String> projectIdList = mapper.getAllProjectList(departId);
if (!CollectionUtils.isEmpty(projectIdList)) {
leaseApplyInfo.setProjectIdList(projectIdList);
if (!CollectionUtils.isEmpty(departId)) {
// 根据项目部id查询工程信息
List<String> projectIdList = mapper.getAllProjectList(departId);
if (!CollectionUtils.isEmpty(projectIdList)) {
leaseApplyInfo.setProjectIdList(projectIdList);
}
}
}
}
@ -295,14 +290,16 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
}
// 使用 Stream API 进行降序排序
List<MaterialLeaseApplyInfo> sortedList = list.stream()
.sorted(Comparator.comparing(MaterialLeaseApplyInfo::getCreateTime,
.sorted(Comparator.comparing(MaterialLeaseApplyInfo::getLeaseTime,
Comparator.nullsLast(Comparator.naturalOrder())).reversed())
.collect(Collectors.toList());
if (!hasSpecialRole) {
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(sortedList) && deptId != null) {
// 删除元素
sortedList.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
if (teamData == null) {
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(sortedList) && deptId != null) {
// 删除元素
sortedList.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
}
}
}
if (!CollectionUtils.isEmpty(sortedList)) {
@ -433,6 +430,84 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
}
}
/**
* 获取总站点领料详情列表
* @param bean
* @return
*/
@Override
public List<MaterialLeaseApplyDetailExport> getTotalDetailsList(MaterialLeaseApplyInfo bean) {
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
String username = SecurityUtils.getLoginUser().getUsername();
BmTeam teamData = new BmTeam();
// 检查用户是否具有特殊角色
boolean hasSpecialRole = hasSpecialRole(userRoles);
if (!hasSpecialRole) {
// 根据用户名判断用户是否为班组长
teamData = materialMachineMapper.getTeamData(username);
if (teamData == null) {
// 根据用户名查询项目部信息
List<String> departId = mapper.getDepartId(username);
if (!CollectionUtils.isEmpty(departId)) {
// 根据项目部id查询工程信息
List<String> projectIdList = mapper.getAllProjectList(departId);
if (!CollectionUtils.isEmpty(projectIdList)) {
bean.setProjectIdList(projectIdList);
}
}
}
}
// 领料数据
List<MaterialLeaseApplyDetailExport> list = materialLeaseInfoMapper.selectLeaseApplyLL(bean);
// 查询领用数据
List<MaterialLeaseApplyDetailExport> leaseApplyOutList = materialLeaseInfoMapper.selectLeaseApplyLY(bean);
if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
list.addAll(leaseApplyOutList);
}
// 使用 Stream API 进行降序排序
List<MaterialLeaseApplyDetailExport> sortedList = list.stream()
.sorted(Comparator.comparing(MaterialLeaseApplyDetailExport::getCreateTime,
Comparator.nullsLast(Comparator.naturalOrder())).reversed())
.collect(Collectors.toList());
if (!hasSpecialRole) {
if (teamData == null) {
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
if (!CollectionUtils.isEmpty(sortedList) && deptId != null) {
// 删除元素
sortedList.removeIf(info -> !deptId.toString().equals(info.getImpUnit()));
}
}
}
if (!CollectionUtils.isEmpty(sortedList)) {
// 班组数据权限
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
sortedList = sortedList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.collect(Collectors.toList());
}
}
if (!CollectionUtils.isEmpty(sortedList)) {
// 查询所有未结算的工程
List<String> projectIdList = mapper.getUnsettledProId();
// 使用 HashSet 来加速查找过程
Set<String> unsettledProjectIds = new HashSet<>(projectIdList);
// 过滤掉不在未结算工程集合内的设备
Iterator<MaterialLeaseApplyDetailExport> iterator = sortedList.iterator();
while (iterator.hasNext()) {
MaterialLeaseApplyDetailExport info = iterator.next();
String proId = info.getProId() != null ?
info.getProId().toString() : null;
if (proId == null || !unsettledProjectIds.contains(proId)) {
iterator.remove();
}
}
}
return sortedList;
}
private List<MaterialMaCodeVo> getMachineByProIdAndTypeId(Long proId,Long typeId){
MaterialLeaseApplyInfo dto = new MaterialLeaseApplyInfo();
dto.setProId(proId);

View File

@ -43,9 +43,6 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
@Resource
private SelectMapper mapper;
@Resource
private IwsTeamUserMapper iwsTeamUserMapper;
/**
* 获取机具追溯管理数据
* @param machine
@ -603,35 +600,45 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
* @return
*/
@Override
public List<MaterialRetainedEquipmentInfo> getSafeDetailsList(MaterialRetainedEquipmentInfo bean) {
bean.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
List<MaterialRetainedEquipmentInfo> usList = materialMachineMapper.getTotalList(bean);
for (MaterialRetainedEquipmentInfo materialRetainedEquipmentInfo : usList) {
// 根据班组名称查询分包单位
String subUnitName = iwsTeamUserMapper.getTeamName(materialRetainedEquipmentInfo.getTeamName());
materialRetainedEquipmentInfo.setSubUnitName(subUnitName);
}
if(bean.getSubUnitName()!=null && !"".equals(bean.getSubUnitName()) && !usList.isEmpty()){
// 根据传入的SubUnitName过滤列表
usList = usList.stream()
.filter(item -> StringUtils.equals(item.getSubUnitName(), bean.getSubUnitName()))
.collect(Collectors.toList());
public List<SafeMaterialEquipmentInfo> getSafeDetailsList(MaterialRetainedEquipmentInfo bean) {
List<SafeMaterialEquipmentInfo> usList = materialMachineMapper.getTotalList(bean);
/*if(CollectionUtils.isNotEmpty(usList)) {
// 查询所有未结算的工程
List<String> projectIdList = mapper.getUnsettledProId();
// 使用 HashSet 来加速查找过程
Set<String> unsettledProjectIds = new HashSet<>(projectIdList);
// 过滤掉不在未结算工程集合内的工程
Iterator<MaterialRetainedEquipmentInfo> iterator = usList.iterator();
Iterator<SafeMaterialEquipmentInfo> iterator = usList.iterator();
while (iterator.hasNext()) {
MaterialRetainedEquipmentInfo info = iterator.next();
SafeMaterialEquipmentInfo info = iterator.next();
String proId = info.getProId() != null ?
info.getProId().toString() : null;
info.getProId() : null;
if (proId == null || !unsettledProjectIds.contains(proId)) {
iterator.remove();
}
}
}*/
String username = SecurityUtils.getLoginUser().getUsername();
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
BmTeam teamData = new BmTeam();
// 检查用户是否具有特殊角色
boolean hasSpecialRole = hasSpecialRole(userRoles);
if (!hasSpecialRole) {
// 根据用户名判断用户是否为班组长
teamData = materialMachineMapper.getTeamData(username);
if (teamData == null) {
//将deptId和usList对应删除元素
Long deptId = SecurityUtils.getLoginUser().getSysUser().getDeptId();
usList.removeIf(m -> !deptId.toString().equals(m.getImpUnit()));
}
}
if (!hasSpecialRole) {
if (teamData != null) {
return usList.stream().filter(item -> {
return StringUtils.isNotBlank(item.getIdCard()) && item.getIdCard().equals(username);
}).collect(Collectors.toList());
}
}
return usList;
}
@ -642,7 +649,7 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
* @param keyWord
* @return
*/
private boolean containsNumKeyword(MaterialRetainedEquipmentInfo item, String keyWord) {
private boolean containsNumKeyword(SafeMaterialEquipmentInfo item, String keyWord) {
return (item.getTypeName() != null && item.getTypeName().contains(keyWord)) ||
(item.getTypeModelName() != null && item.getTypeModelName().contains(keyWord)) ||
(item.getProName() != null && item.getProName().contains(keyWord)) ||
@ -738,10 +745,21 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
* @return
*/
@Override
public MaterialRetainedEquipmentInfo getSafeNumList(MaterialRetainedEquipmentInfo bean) {
MaterialRetainedEquipmentInfo retainedEquipmentInfo = new MaterialRetainedEquipmentInfo();
bean.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
List<MaterialRetainedEquipmentInfo> totalList = materialMachineMapper.getTotalList(bean);
public SafeMaterialEquipmentInfo getSafeNumList(MaterialRetainedEquipmentInfo bean) {
String username = SecurityUtils.getLoginUser().getUsername();
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
BmTeam teamData = new BmTeam();
// 检查用户是否具有特殊角色
boolean hasSpecialRole = hasSpecialRole(userRoles);
if (!hasSpecialRole) {
// 根据用户名判断用户是否为班组长
teamData = materialMachineMapper.getTeamData(username);
if (teamData == null) {
bean.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId());
}
}
SafeMaterialEquipmentInfo retainedEquipmentInfo = new SafeMaterialEquipmentInfo();
List<SafeMaterialEquipmentInfo> totalList = materialMachineMapper.getTotalList(bean);
if (!CollectionUtil.isEmpty(totalList)) {
if (StringUtils.isNotBlank(bean.getStatus())) {
totalList = totalList.stream().filter(item -> StringUtils.isNotBlank(item.getStatus()) && item.getStatus().equals(bean.getStatus())).collect(Collectors.toList());

View File

@ -607,7 +607,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
and tt.task_type = '2'
GROUP BY lai.id
ORDER BY tt.create_time desc
ORDER BY lai.create_time desc
</select>
<select id="getDetailsList" resultType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo">
@ -1188,7 +1188,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lai.id AS id,
lpd.code AS code,
lai.create_by AS createBy,
lai.create_time AS createTime,
lpd.create_time AS leaseTime,
sd.dept_name AS impUnitName,
bp.contract_part AS contractPart,
lpd.lease_person AS leasePerson,
@ -1264,7 +1264,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
<![CDATA[ AND DATE_FORMAT( lpd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
<if test="id != null ">
AND lai.id = #{id}
@ -1596,4 +1596,137 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND project_id = #{externalId}
AND bzmc = #{unitName}
</select>
<select id="selectLeaseApplyLL" resultType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetailExport">
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 as 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,
sd.dept_name as impUnitName,
CASE
WHEN mt.manage_type = 0 THEN '编码出库'
ELSE '数量出库'
END as manageTypeName,
bp.imp_unit as impUnit,
bu.bzz_idcard as idcard,
bp.pro_id as proId,
lod.create_time as outTime
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 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'
where
tt.task_type = '2'
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="leasePerson != null and leasePerson != ''">
AND lai.lease_person LIKE CONCAT('%', #{leasePerson}, '%')
</if>
<if test="code != null and code != ''">
AND lai.code LIKE CONCAT('%', #{code}, '%')
</if>
<if test="leaseUnit != null and leaseUnit != ''">
AND bu.unit_name LIKE CONCAT('%', #{leaseUnit}, '%')
</if>
<if test="leaseProject != null and leaseProject != ''">
AND bp.pro_name LIKE CONCAT('%', #{leaseProject}, '%')
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
AND bp.external_id in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( lai.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
GROUP BY
lai.id,lod.type_id
ORDER BY
lai.create_time desc
</select>
<select id="selectLeaseApplyLY" resultType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetailExport">
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.code as code,
lpd.lease_person AS leasePerson,
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,
sd.dept_name as impUnitName,
CASE
WHEN mt.manage_type = 0 THEN '编码出库'
ELSE '数量出库'
END as manageTypeName,
bp.imp_unit as impUnit,
bu.bzz_idcard as idcard,
bp.pro_id as proId,
lod.create_time as outTime
from
lease_out_details lod
left join lease_publish_details lpd on lod.parent_id = lpd.parent_id
and lod.publish_task = lpd.publish_task
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 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'
where
1 = 1
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name LIKE CONCAT('%', #{impUnitName}, '%')
</if>
<if test="leasePerson != null and leasePerson != ''">
AND lpd.lease_person LIKE CONCAT('%', #{leasePerson}, '%')
</if>
<if test="code != null and code != ''">
AND lpd.code LIKE CONCAT('%', #{code}, '%')
</if>
<if test="leaseUnit != null and leaseUnit != ''">
AND bu.unit_name LIKE CONCAT('%', #{leaseUnit}, '%')
</if>
<if test="leaseProject != null and leaseProject != ''">
AND bp.pro_name LIKE CONCAT('%', #{leaseProject}, '%')
</if>
<if test="projectIdList != null and projectIdList.size() > 0">
AND bp.external_id in
<foreach item="item" collection="projectIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
<![CDATA[ AND DATE_FORMAT( lpd.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
</if>
GROUP BY lod.publish_task,lod.type_id
ORDER BY lpd.create_time
</select>
</mapper>

View File

@ -733,7 +733,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LIMIT 1
</select>
<select id="getTotalList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo">
<select id="getTotalList" resultType="com.bonus.material.clz.domain.vo.SafeMaterialEquipmentInfo">
SELECT * FROM (
-- 原查询包含status计算
SELECT
@ -759,7 +759,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
END AS status,
bp.pro_id AS proId,
bp.pro_name AS proName,
bu.unit_name AS teamName
bu.unit_name AS teamName,
bu.bzz_idcard AS idCard,
mm.qr_code AS qrCode,
bz.ssfbdw AS subUnitName
FROM
slt_agreement_info sai
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
@ -772,10 +775,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN clz_bm_agreement_info cba ON csi.agreement_id = cba.agreement_id
LEFT JOIN bm_unit bu ON cba.unit_id = bu.unit_id
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
LEFT JOIN `micro-tool`.bzgl_bz bz ON bp.external_id = bz.project_id
AND bz.bzmc = bu.unit_name
WHERE
sai.`status` = '0'
AND sai.is_slt = '0'
AND mm.ma_status = 2
AND mt.jiju_type = 2
AND sai.ma_id IS NOT NULL
AND mt2.type_id not in (6032,6008,6270,6012,6761)
<if test="impUnitName != null and impUnitName != ''">
@ -805,6 +810,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="deptId != null">
AND bp.imp_unit = #{deptId}
</if>
<if test="subUnitName != null and subUnitName != ''">
AND bz.ssfbdw LIKE CONCAT('%', #{subUnitName}, '%')
</if>
<if test="keyWord != null and keyWord != ''">
and (
bu.unit_name like concat('%',#{keyWord},'%') or
@ -829,7 +837,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ELSE 1 -- 其他情况排在后面
END ASC,
-- 可根据需要添加其他排序字段(如原顺序或时间)
temp.maId ASC -- 示例按maId升序排列可选
temp.nextCheckTime ASC -- 示例按maId升序排列可选
</select>
<select id="getTeamNumList" resultType="com.bonus.material.clz.domain.vo.MaterialRetainedTeamTotalVo">