This commit is contained in:
parent
c8791ea360
commit
7ea92579a6
|
|
@ -110,4 +110,7 @@ public class BmUnit extends BaseEntity
|
|||
*/
|
||||
private boolean enableFilterTeam;
|
||||
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
private String projectName;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.bonus.common.core.web.controller.BaseController;
|
|||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.clz.domain.TeamVo;
|
||||
import com.bonus.material.clz.domain.machine.MaterialStorageDto;
|
||||
import com.bonus.material.clz.domain.machine.MaterialStorageExportInfo;
|
||||
import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo;
|
||||
import com.bonus.material.clz.domain.vo.*;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
|
|
@ -25,7 +26,6 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -106,6 +106,25 @@ public class MaterialMachineController extends BaseController {
|
|||
util.exportExcel(response, list, "工器具台账", title);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工期具台账明细
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "综合查询--导出工期具台账明细")
|
||||
@PostMapping("/exportRetainedEquipmentDetails")
|
||||
public void exportRetainedEquipmentDetails(HttpServletResponse response, MaterialRetainedEquipmentInfo bean) {
|
||||
List<MaterialStorageExportInfo> list = materialMachineService.getRetainedEquipmentDetails(bean);
|
||||
// 根据list集合数,去填充序号
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setSeq(i + 1);
|
||||
}
|
||||
ExcelUtil<MaterialStorageExportInfo> util = new ExcelUtil<>(MaterialStorageExportInfo.class);
|
||||
// 获取当前年月日时分秒导出时间,用括号拼接在后面
|
||||
String title = "工器具台账明细" + "(" + "导出时间:" + DateUtils.getTime() + ")";
|
||||
util.exportExcel(response, list, "工器具台账明细", title);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询在库机具设备详情
|
||||
* @param bean
|
||||
|
|
|
|||
|
|
@ -0,0 +1,126 @@
|
|||
package com.bonus.material.clz.domain.machine;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 机具入库查询详情
|
||||
* @Author ma_sh
|
||||
* @create 2024/12/19 9:50
|
||||
*/
|
||||
@Data
|
||||
public class MaterialStorageExportInfo {
|
||||
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "序号")
|
||||
@Excel(name = "序号", width = 5, cellType = Excel.ColumnType.NUMERIC)
|
||||
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 = "班组id")
|
||||
private String teamId;
|
||||
|
||||
@ApiModelProperty(value = "班组名称")
|
||||
@Excel(name = "班组名称")
|
||||
private String teamName;
|
||||
|
||||
@ApiModelProperty(value = "分包单位")
|
||||
@Excel(name = "分包单位", width = 25)
|
||||
private String subUnitName;
|
||||
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
@Excel(name = "工程名称", width = 60)
|
||||
private String proName;
|
||||
|
||||
@ApiModelProperty(value = "机具名称")
|
||||
@Excel(name = "机具名称")
|
||||
private String typeName;
|
||||
|
||||
@ApiModelProperty(value = "规格ID")
|
||||
private Integer typeId;
|
||||
|
||||
@ApiModelProperty(value = "规格型号")
|
||||
@Excel(name = "规格型号")
|
||||
private String typeModelName;
|
||||
|
||||
@ApiModelProperty(value = "入库数量")
|
||||
@Excel(name = "数量", cellType = Excel.ColumnType.NUMERIC)
|
||||
private BigDecimal storeNum;
|
||||
|
||||
@ApiModelProperty(value = "购置单价")
|
||||
//@Excel(name = "租赁价(元)")
|
||||
private BigDecimal buyPrice;
|
||||
|
||||
@ApiModelProperty(value = "设备编码")
|
||||
@Excel(name = "设备编码")
|
||||
private String maCode;
|
||||
|
||||
@ApiModelProperty(value = "库管员")
|
||||
private String maKeeper;
|
||||
|
||||
@ApiModelProperty(value = "操作人")
|
||||
//@Excel(name = "操作人")
|
||||
private String inputUser;
|
||||
|
||||
@ApiModelProperty(value = "操作人")
|
||||
//@Excel(name = "操作人")
|
||||
private String creator;
|
||||
|
||||
@ApiModelProperty(value = "出库时间")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
//@Excel(name = "出库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date outTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
//@Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date inputTime;
|
||||
|
||||
@ApiModelProperty(value = "入库方式")
|
||||
private String inputType;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
private String keyWord;
|
||||
|
||||
@ApiModelProperty(value = "领料id")
|
||||
private String leaseId;
|
||||
|
||||
@ApiModelProperty(value = "领料编码")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "工程id")
|
||||
private String proId;
|
||||
|
||||
@ApiModelProperty(value = "编码ID")
|
||||
private String maId;
|
||||
|
||||
@ApiModelProperty(value = "管理方式(0编号 1计数)")
|
||||
private String manageType;
|
||||
|
||||
@ApiModelProperty(value = "是否分包直领标志(0 是 1 否)")
|
||||
private String subFlag;
|
||||
|
||||
@ApiModelProperty(value = "是否直转标志(0 是 1 否)")
|
||||
@Excel(name = "是否直转", width = 10, readConverterExp = "0=是,1=否")
|
||||
private String directFlag;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.bonus.material.clz.domain.machine;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2025/11/17 16:47
|
||||
*/
|
||||
@Data
|
||||
public class StockExportParam {
|
||||
private String proId;
|
||||
private Integer typeId;
|
||||
private BigDecimal allNum;
|
||||
|
||||
public StockExportParam(String proId, Integer typeId, BigDecimal allNum) {
|
||||
this.proId = proId;
|
||||
this.typeId = typeId;
|
||||
this.allNum = allNum;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.material.clz.domain.machine;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @create 2025/11/17 16:49
|
||||
*/
|
||||
@Data
|
||||
public class StockKey {
|
||||
|
||||
private String proId;
|
||||
private Integer typeId;
|
||||
|
||||
public StockKey(String proId, Integer typeId) {
|
||||
this.proId = proId;
|
||||
this.typeId = typeId;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,9 @@ package com.bonus.material.clz.mapper;
|
|||
import com.bonus.material.back.domain.vo.MaCodeVo;
|
||||
import com.bonus.material.basic.domain.BmQrcodeInfo;
|
||||
import com.bonus.material.clz.domain.TeamVo;
|
||||
import com.bonus.material.clz.domain.machine.MaterialStorageExportInfo;
|
||||
import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo;
|
||||
import com.bonus.material.clz.domain.machine.StockExportParam;
|
||||
import com.bonus.material.clz.domain.vo.*;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.clz.domain.BmTeam;
|
||||
|
|
@ -349,4 +351,33 @@ public interface MaterialMachineMapper {
|
|||
* @return
|
||||
*/
|
||||
int updateMachine(BmQrcodeInfo bmQrcodeInfo);
|
||||
|
||||
/**
|
||||
* 批量查询领用数据
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialStorageExportInfo> getUseDetailsList(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 分包领用明细
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialStorageExportInfo> getSubInfoDetailsList(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
|
||||
/**
|
||||
* 批量查询库存量
|
||||
* @param queryParams
|
||||
* @return
|
||||
*/
|
||||
List<MaterialStorageExportInfo> batchGetMaCodeExportList(List<StockExportParam> queryParams);
|
||||
|
||||
/**
|
||||
* 批量查询在用量
|
||||
* @param queryParams
|
||||
* @return
|
||||
*/
|
||||
List<MaterialStorageInfo> batchGetMaCodeDetails(List<StockExportParam> queryParams);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.clz.service;
|
|||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.clz.domain.TeamVo;
|
||||
import com.bonus.material.clz.domain.machine.MaterialStorageExportInfo;
|
||||
import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo;
|
||||
import com.bonus.material.clz.domain.vo.*;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
|
|
@ -198,4 +199,11 @@ public interface MaterialMachineService {
|
|||
* @return
|
||||
*/
|
||||
List<MaterialSecondInfo> getUseDemandAndSupply(MaterialRetainedEquipmentInfo bean);
|
||||
|
||||
/**
|
||||
* 导出工期具台账明细
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
List<MaterialStorageExportInfo> getRetainedEquipmentDetails(MaterialRetainedEquipmentInfo bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,15 +8,13 @@ import com.bonus.common.security.utils.SecurityUtils;
|
|||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.clz.domain.TeamVo;
|
||||
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo;
|
||||
import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo;
|
||||
import com.bonus.material.clz.domain.machine.*;
|
||||
import com.bonus.material.clz.domain.vo.*;
|
||||
import com.bonus.material.clz.mapper.IwsTeamUserMapper;
|
||||
import com.bonus.material.common.domain.dto.SelectDto;
|
||||
import com.bonus.material.common.domain.vo.AgreementVo;
|
||||
import com.bonus.material.common.mapper.SelectMapper;
|
||||
import com.bonus.material.ma.domain.Machine;
|
||||
import com.bonus.material.clz.domain.BmTeam;
|
||||
import com.bonus.material.clz.domain.machine.MaterialStorageInfo;
|
||||
import com.bonus.material.clz.mapper.MaterialMachineMapper;
|
||||
import com.bonus.material.clz.service.MaterialMachineService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -1610,6 +1608,102 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
return totalList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出工期具台账明细
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<MaterialStorageExportInfo> getRetainedEquipmentDetails(MaterialRetainedEquipmentInfo bean) {
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
// 根据用户名判断用户是否为班组长
|
||||
BmTeam teamData = materialMachineMapper.getTeamData(username);
|
||||
Set<String> userRoles = SecurityUtils.getLoginUser().getRoles();
|
||||
// 检查用户是否具有特殊角色
|
||||
boolean hasSpecialRole = hasSpecialRole(userRoles);
|
||||
if (!hasSpecialRole) {
|
||||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
List<String> departId = mapper.getDepartId(username);
|
||||
if (CollectionUtils.isNotEmpty(departId)) {
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
bean.setProjectIdList(projectIdList);
|
||||
}
|
||||
}
|
||||
// 部门查询赋值
|
||||
extractedDept(bean);
|
||||
}
|
||||
}
|
||||
ArrayList<MaterialStorageExportInfo> resultList = new ArrayList<>();
|
||||
// 2. 批量查询三类设备原始数据
|
||||
// 在用明细
|
||||
List<MaterialStorageExportInfo> usingEquipList = materialMachineMapper.getUseDetailsList(bean);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(usingEquipList)) {
|
||||
resultList.addAll(usingEquipList);
|
||||
}
|
||||
// 站内库存明细
|
||||
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainInfoList(bean);
|
||||
if (CollectionUtils.isNotEmpty(recordList)) {
|
||||
// 1. 批量收集查询参数(proId+typeId+allNum)
|
||||
List<StockExportParam> queryParams = recordList.stream()
|
||||
.map(equip -> new StockExportParam(
|
||||
equip.getProId(),
|
||||
equip.getTypeId(),
|
||||
equip.getAllNum()
|
||||
))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 2. 批量查询:库存列表 + 已使用列表
|
||||
List<MaterialStorageExportInfo> allStockList = materialMachineMapper.batchGetMaCodeExportList(queryParams);
|
||||
List<MaterialStorageInfo> allUsedList = materialMachineMapper.batchGetMaCodeDetails(queryParams);
|
||||
|
||||
// 3. 分组:按 (proId+typeId) 分组,便于快速匹配
|
||||
Map<StockKey, List<MaterialStorageExportInfo>> stockGroupMap = allStockList.stream()
|
||||
.collect(Collectors.groupingBy(stock -> new StockKey(stock.getProId(), stock.getTypeId())));
|
||||
|
||||
Map<StockKey, Set<String>> usedMaIdGroupMap = allUsedList.stream()
|
||||
// 过滤有效maId
|
||||
.filter(used -> StringUtils.hasText(used.getMaId()))
|
||||
.collect(Collectors.groupingBy(
|
||||
used -> new StockKey(used.getProId(), used.getTypeId()),
|
||||
// 每组已使用设备只保留maId集合(用于过滤)
|
||||
Collectors.mapping(MaterialStorageInfo::getMaId, Collectors.toSet())
|
||||
));
|
||||
|
||||
// 4. 统一处理:赋值库存数量 + 过滤已使用设备(无循环)
|
||||
List<MaterialStorageExportInfo> processedStockList = queryParams.stream()
|
||||
// 按参数的proId+typeId获取对应库存列表
|
||||
.flatMap(param -> {
|
||||
StockKey key = new StockKey(param.getProId(), param.getTypeId());
|
||||
List<MaterialStorageExportInfo> stockList = stockGroupMap.getOrDefault(key, Collections.emptyList());
|
||||
Set<String> usedMaIds = usedMaIdGroupMap.getOrDefault(key, Collections.emptySet());
|
||||
|
||||
// 处理单组库存:赋值数量 + 过滤已使用
|
||||
return stockList.stream()
|
||||
// 赋值库存数量(按manageType判断)
|
||||
.peek(item -> {
|
||||
item.setStoreNum("0".equals(item.getManageType()) ? BigDecimal.ONE : param.getAllNum());
|
||||
item.setTeamName("站内库存");
|
||||
})
|
||||
// 过滤已使用的设备(maId不在已使用集合中)
|
||||
.filter(item -> !usedMaIds.contains(item.getMaId()));
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 5. 结果整合
|
||||
resultList.addAll(processedStockList);
|
||||
}
|
||||
// 分包领用明细
|
||||
List<MaterialStorageExportInfo> subEquipList = materialMachineMapper.getSubInfoDetailsList(bean);
|
||||
if (CollectionUtils.isNotEmpty(subEquipList)) {
|
||||
resultList.addAll(subEquipList);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置分公司名称(如果有)
|
||||
* @param impUnit
|
||||
|
|
|
|||
|
|
@ -43,6 +43,18 @@ public class SelectController {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据工程名称查询所属项目部下拉选")
|
||||
@PostMapping("getDepartList")
|
||||
public AjaxResult getDepartList(@RequestBody BmUnit bmUnit) {
|
||||
return service.getDepartList(bmUnit);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "协议往来单位下拉选")
|
||||
@PostMapping("getAgreementUnitList")
|
||||
public AjaxResult getAgreementUnitList(@RequestBody BmUnit bmUnit) {
|
||||
return service.getAgreementUnitList(bmUnit);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "往来单位下拉选")
|
||||
@PostMapping("getUnitList")
|
||||
public AjaxResult getUnitList(@RequestBody BmUnit bmUnit) {
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ public interface SelectMapper {
|
|||
* 获取班组下拉选
|
||||
* @return
|
||||
*/
|
||||
List<ProjectTreeNode> getTeam();
|
||||
List<ProjectTreeNode> getTeam(List<Long> teamIds);
|
||||
|
||||
/**
|
||||
* 获取领用申请单位下拉
|
||||
|
|
@ -478,4 +478,25 @@ public interface SelectMapper {
|
|||
* @return
|
||||
*/
|
||||
List<ProjectTreeNode> getMaterialUnitList(BmUnit bmUnit);
|
||||
|
||||
/**
|
||||
* 根据工程id想查询已授权班组id
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
List<Long> getTeamIds(Long projectId);
|
||||
|
||||
/**
|
||||
* 获取项目部下拉选
|
||||
* @param bmUnit
|
||||
* @return
|
||||
*/
|
||||
List<ProjectTreeNode> getDepartInfo(BmUnit bmUnit);
|
||||
|
||||
/**
|
||||
* 根据工程名称查询所属项目部
|
||||
* @param bmUnit
|
||||
* @return
|
||||
*/
|
||||
String getDepartName(BmUnit bmUnit);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -311,4 +311,18 @@ public interface SelectService {
|
|||
* @return
|
||||
*/
|
||||
AjaxResult getMaterialUnitList(BmUnit bmUnit);
|
||||
|
||||
/**
|
||||
* 根据工程名称查询所属项目部下拉选
|
||||
* @param bmUnit
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getDepartList(BmUnit bmUnit);
|
||||
|
||||
/**
|
||||
* 协议往来单位下拉选
|
||||
* @param bmUnit
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getAgreementUnitList(BmUnit bmUnit);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ public class SelectServiceImpl implements SelectService {
|
|||
// 步骤7: 获取班组数据(可选)
|
||||
if (bmUnit.getDeptId() == null) {
|
||||
long teamStart = System.currentTimeMillis();
|
||||
List<ProjectTreeNode> newList = mapper.getTeam();
|
||||
List<ProjectTreeNode> newList = mapper.getTeam(new ArrayList<>());
|
||||
stepTimes.put("获取班组数据", System.currentTimeMillis() - teamStart);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(newList) && !bmUnit.isEnableFilterTeam()) {
|
||||
|
|
@ -703,7 +703,7 @@ public class SelectServiceImpl implements SelectService {
|
|||
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
groupList = buildTreeEfficiently(list);
|
||||
List<ProjectTreeNode> newList = mapper.getTeam();
|
||||
List<ProjectTreeNode> newList = mapper.getTeam(new ArrayList<>());
|
||||
if (CollectionUtils.isNotEmpty(newList) && !bmUnit.isEnableFilterTeam()) {
|
||||
groupList.addAll(newList);
|
||||
}
|
||||
|
|
@ -715,6 +715,68 @@ public class SelectServiceImpl implements SelectService {
|
|||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据工程名称查询所属项目部下拉选
|
||||
* @param bmUnit
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getDepartList(BmUnit bmUnit) {
|
||||
// 根据工程名称查询所属项目部
|
||||
String departName = mapper.getDepartName(bmUnit);
|
||||
List<ProjectTreeNode> groupList = new ArrayList<>();
|
||||
List<ProjectTreeNode> list;
|
||||
try {
|
||||
bmUnit.setUnitName(departName);
|
||||
list = mapper.getDepartInfo(bmUnit);
|
||||
if (list != null) {
|
||||
list = list.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(unit -> unit.getId() != null && unit.getParentId() != null)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
groupList = buildTreeEfficiently(list);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("单位类型树-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 协议往来单位下拉选
|
||||
* @param bmUnit
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getAgreementUnitList(BmUnit bmUnit) {
|
||||
List<ProjectTreeNode> groupList = new ArrayList<>();
|
||||
List<ProjectTreeNode> list;
|
||||
try {
|
||||
list = mapper.getUnitList(bmUnit);
|
||||
if (list != null) {
|
||||
list = list.stream()
|
||||
.filter(Objects::nonNull)
|
||||
.filter(unit -> unit.getId() != null && unit.getParentId() != null)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
groupList = buildTreeEfficiently(list);
|
||||
List<Long> teamIds = new ArrayList<>();
|
||||
// 根据工程id想查询已授权班组id
|
||||
if (bmUnit.getProjectId() != null) {
|
||||
teamIds = mapper.getTeamIds(bmUnit.getProjectId());
|
||||
}
|
||||
List<ProjectTreeNode> newList = mapper.getTeam(teamIds);
|
||||
groupList.addAll(newList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("单位类型树-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getDeviceTypeTree(SelectDto dto) {
|
||||
List<TreeNode> groupList = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -246,7 +246,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
CASE WHEN
|
||||
lai.direct_id IS NULL
|
||||
THEN '1' ELSE '0'
|
||||
END AS directFlag
|
||||
END AS directFlag,
|
||||
mt.manage_type AS manageType
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
|
|
@ -1359,7 +1360,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND sd.dept_name = #{impUnitName}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name = #{proName}
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center = #{departName}
|
||||
|
|
@ -1432,7 +1433,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND sd.dept_name = #{impUnitName}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name = #{proName}
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center = #{departName}
|
||||
|
|
@ -1528,7 +1529,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND sd.dept_name = #{impUnitName}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name = #{proName}
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center = #{departName}
|
||||
|
|
@ -1558,7 +1559,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND mt.jiju_type = #{jiJuType}
|
||||
</if>
|
||||
GROUP BY
|
||||
mt.type_id, bu.unit_name, bp.pro_name
|
||||
mt.type_id, bu.unit_id, bp.pro_id
|
||||
</select>
|
||||
<select id="getMaCodeDetails" resultType="com.bonus.material.clz.domain.machine.MaterialStorageInfo">
|
||||
SELECT mt2.type_name AS typeName,
|
||||
|
|
@ -2415,7 +2416,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
AND sd.dept_name = #{impUnitName}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name = #{proName}
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center = #{departName}
|
||||
|
|
@ -2446,7 +2447,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
GROUP BY
|
||||
mt.type_id,
|
||||
bp.pro_id
|
||||
bp.pro_id,
|
||||
bu.unit_id
|
||||
</select>
|
||||
|
||||
<select id="getSubDemandAndSupply" resultType="com.bonus.material.clz.domain.vo.MaterialSecondInfo">
|
||||
|
|
@ -2789,4 +2791,267 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
GROUP BY mt.type_id,
|
||||
bp.pro_id
|
||||
</select>
|
||||
|
||||
<select id="getUseDetailsList" resultType="com.bonus.material.clz.domain.machine.MaterialStorageExportInfo">
|
||||
SELECT mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.lease_price AS buyPrice,
|
||||
SUM(IFNULL( sai.num, 0 )) AS storeNum,
|
||||
mm.ma_code AS maCode,
|
||||
bu.unit_name AS teamName,
|
||||
sai.lease_id AS leaseId,
|
||||
sai.type_id AS typeId,
|
||||
lai.code AS code,
|
||||
sai.ma_id AS maId,
|
||||
bp.pro_name AS proName,
|
||||
CASE WHEN
|
||||
lai.direct_id IS NULL
|
||||
THEN '1' ELSE '0'
|
||||
END AS directFlag,
|
||||
df.project_dept AS departName,
|
||||
sd.dept_name AS impUnitName,
|
||||
bz.ssfbdw AS subUnitName
|
||||
FROM clz_slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
|
||||
LEFT JOIN clz_lease_apply_info lai ON lai.id = sai.lease_id
|
||||
LEFT JOIN clz_bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id AND bu.del_flag = '0'
|
||||
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
|
||||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
||||
WHERE
|
||||
sai.`status` = '0'
|
||||
AND sai.end_time IS NULL
|
||||
AND sai.back_id IS NULL
|
||||
AND bu.unit_name is not null
|
||||
AND bp.external_id is not NULL
|
||||
and sd.dept_id not in (342,345,347,348,101,344)
|
||||
and bp.pro_id not in (3414,1192,3321,3595)
|
||||
and bp.pro_center IS NOT NULL
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name = #{impUnitName}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center = #{departName}
|
||||
</if>
|
||||
<if test="teamName != null and teamName != ''">
|
||||
AND bu.unit_name = #{teamName}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
AND mt2.type_name = #{typeName}
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName != ''">
|
||||
AND mt.type_name = #{typeModelName}
|
||||
</if>
|
||||
<if test="subUnitName != null and subUnitName != ''">
|
||||
AND bz.ssfbdw = #{subUnitName}
|
||||
</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="impUnit != null and impUnit != ''">
|
||||
AND bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
<if test="jiJuType != null and jiJuType != ''">
|
||||
AND mt.jiju_type = #{jiJuType}
|
||||
</if>
|
||||
GROUP BY
|
||||
sai.type_id,
|
||||
sai.ma_id,
|
||||
bu.unit_id
|
||||
</select>
|
||||
|
||||
<select id="getSubInfoDetailsList" resultType="com.bonus.material.clz.domain.machine.MaterialStorageExportInfo">
|
||||
SELECT
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.lease_price AS buyPrice,
|
||||
SUM(IFNULL( sai.num, 0 )) AS storeNum,
|
||||
mm.ma_code AS maCode,
|
||||
bu.unit_name AS teamName,
|
||||
sai.lease_id AS leaseId,
|
||||
sai.type_id AS typeId,
|
||||
lai.code AS code,
|
||||
sai.ma_id AS maId,
|
||||
bp.pro_name AS proName,
|
||||
CASE WHEN
|
||||
lai.direct_id IS NULL
|
||||
THEN '1' ELSE '0'
|
||||
END AS directFlag,
|
||||
df.project_dept AS departName,
|
||||
sd.dept_name AS impUnitName
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.parent_id
|
||||
LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
|
||||
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||
LEFT JOIN bm_agreement_info bai ON sai.agreement_id = bai.agreement_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
|
||||
AND bu.del_flag = '0'
|
||||
LEFT JOIN sys_dept sd ON sd.dept_id = bp.imp_unit
|
||||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
||||
WHERE
|
||||
sai.`status` = '0'
|
||||
AND sai.is_slt = '0'
|
||||
AND sai.end_time IS NULL
|
||||
AND sai.back_id IS NULL
|
||||
AND bp.external_id IS NOT NULL
|
||||
AND bu.type_id in(32,33)
|
||||
and bp.pro_id not in (3414,1192,3321,3595)
|
||||
and bp.pro_center IS NOT NULL
|
||||
<if test="impUnitName != null and impUnitName != ''">
|
||||
AND sd.dept_name = #{impUnitName}
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
AND bp.pro_name LIKE CONCAT('%', #{proName}, '%')
|
||||
</if>
|
||||
<if test="departName != null and departName != ''">
|
||||
AND bp.pro_center = #{departName}
|
||||
</if>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
AND mt2.type_name = #{typeName}
|
||||
</if>
|
||||
<if test="typeModelName != null and typeModelName != ''">
|
||||
AND mt.type_name = #{typeModelName}
|
||||
</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="impUnit != null and impUnit != ''">
|
||||
and bp.imp_unit = #{impUnit}
|
||||
</if>
|
||||
<if test="jiJuType != null and jiJuType != ''">
|
||||
AND mt.jiju_type = #{jiJuType}
|
||||
</if>
|
||||
<if test="subUnitName != null and subUnitName != ''">
|
||||
AND '分包直领' like concat('%',#{subUnitName},'%')
|
||||
</if>
|
||||
<if test="teamName != null and teamName != ''">
|
||||
AND bu.unit_name = #{teamName}
|
||||
</if>
|
||||
GROUP BY
|
||||
sai.type_id,
|
||||
sai.ma_id,
|
||||
bp.pro_id,
|
||||
bu.unit_id
|
||||
</select>
|
||||
|
||||
<select id="batchGetMaCodeExportList"
|
||||
resultType="com.bonus.material.clz.domain.machine.MaterialStorageExportInfo">
|
||||
SELECT
|
||||
mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.lease_price AS buyPrice,
|
||||
SUM(IFNULL( sai.num, 0 )) AS storeNum,
|
||||
mm.ma_code AS maCode,
|
||||
bt.unit_name AS teamName,
|
||||
sai.lease_id AS leaseId,
|
||||
sai.type_id AS typeId,
|
||||
lai.code AS code,
|
||||
sai.ma_id AS maId,
|
||||
bp.pro_name AS proName,
|
||||
CASE WHEN
|
||||
lai.direct_id IS NULL
|
||||
THEN '1' ELSE '0'
|
||||
END AS directFlag,
|
||||
mt.manage_type AS manageType,
|
||||
bp.pro_id AS proId,
|
||||
df.project_dept AS departName,
|
||||
sd.dept_name AS impUnitName
|
||||
FROM
|
||||
slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
|
||||
LEFT JOIN bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
|
||||
LEFT JOIN bm_unit bt ON bai.unit_id = bt.unit_id
|
||||
LEFT JOIN lease_apply_info lai ON lai.id = sai.lease_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_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 = bt.unit_name
|
||||
LEFT JOIN data_center.dx_fb_son df ON bp.external_id = df.id
|
||||
WHERE
|
||||
sai.status = '0'
|
||||
AND sai.end_time IS NULL
|
||||
AND sai.back_id IS NULL
|
||||
AND bt.type_id = 36
|
||||
<if test="list != null and list.size() > 0">
|
||||
AND (
|
||||
<foreach collection="list" item="param" separator="OR">
|
||||
<!-- 关键修改在这里 -->
|
||||
<trim prefix="(" suffix=")" prefixOverrides="AND" suffixOverrides="AND">
|
||||
<if test="param.proId != null">AND bp.pro_id = #{param.proId}</if>
|
||||
<if test="param.typeId != null">AND sai.type_id = #{param.typeId}</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
GROUP BY
|
||||
sai.type_id,
|
||||
sai.ma_id,
|
||||
lai.direct_id
|
||||
</select>
|
||||
|
||||
<select id="batchGetMaCodeDetails" resultType="com.bonus.material.clz.domain.machine.MaterialStorageInfo">
|
||||
SELECT mt2.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mt.lease_price AS buyPrice,
|
||||
SUM(IFNULL( sai.num, 0 )) AS storeNum,
|
||||
mm.ma_code AS maCode,
|
||||
bt.unit_name AS teamName,
|
||||
sai.lease_id AS leaseId,
|
||||
sai.type_id AS typeId,
|
||||
lai.code AS code,
|
||||
sai.ma_id AS maId,
|
||||
bp.pro_name AS proName,
|
||||
CASE WHEN
|
||||
lai.direct_id IS NULL
|
||||
THEN '1' ELSE '0'
|
||||
END AS directFlag,
|
||||
bp.pro_id AS proId
|
||||
FROM clz_slt_agreement_info sai
|
||||
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
|
||||
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id
|
||||
LEFT JOIN ma_machine mm ON mm.ma_id = sai.ma_id
|
||||
LEFT JOIN clz_bm_agreement_info bai ON bai.agreement_id = sai.agreement_id
|
||||
LEFT JOIN bm_unit bt ON bai.unit_id = bt.unit_id AND bt.del_flag = '0'
|
||||
LEFT JOIN clz_lease_apply_info lai ON lai.id = sai.lease_id
|
||||
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
|
||||
WHERE sai.status = '0'
|
||||
AND sai.end_time IS NULL
|
||||
AND sai.back_id IS NULL
|
||||
<if test="list != null and list.size() > 0">
|
||||
AND (
|
||||
<foreach collection="list" item="param" separator="OR">
|
||||
<!-- 关键修改在这里 -->
|
||||
<trim prefix="(" suffix=")" prefixOverrides="AND" suffixOverrides="AND">
|
||||
<if test="param.proId != null">AND bp.pro_id = #{param.proId}</if>
|
||||
<if test="param.typeId != null">AND sai.type_id = #{param.typeId}</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
GROUP BY
|
||||
sai.type_id,
|
||||
sai.ma_id,
|
||||
lai.direct_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -565,6 +565,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
bu.del_flag = '0'
|
||||
AND bu.type_id = 1731
|
||||
<if test="list != null and list.size() >0">
|
||||
AND bu.unit_id IN
|
||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getTeamLeaseList" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
|
||||
|
|
@ -1545,4 +1551,92 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ORDER BY
|
||||
LEVEL
|
||||
</select>
|
||||
|
||||
<select id="getTeamIds" resultType="java.lang.Long">
|
||||
SELECT
|
||||
pai.team_id
|
||||
FROM
|
||||
pro_authorize_info pai
|
||||
LEFT JOIN lease_apply_info lai ON pai.lease_id = lai.id
|
||||
WHERE
|
||||
lai.project_id = #{projectId}
|
||||
GROUP BY
|
||||
pai.team_id
|
||||
</select>
|
||||
|
||||
<select id="getDepartInfo" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
|
||||
/*根据标段工程名称关联协议查询往来单位*/
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
CONCAT( 'dw', sd.dept_id ) AS id,
|
||||
sd.dept_name AS NAME,
|
||||
0 AS parentId,
|
||||
1 AS LEVEL,
|
||||
null AS typeKey
|
||||
FROM
|
||||
sys_dept sd
|
||||
LEFT JOIN bm_unit bu ON sd.dept_id = bu.dept_id
|
||||
WHERE
|
||||
bu.del_flag = '0'
|
||||
AND sd.del_flag = '0'
|
||||
AND sd.`status` = '0'
|
||||
AND bu.type_id != 1731
|
||||
<if test="unitName != null and unitName != ''">
|
||||
AND bu.unit_name = #{unitName}
|
||||
</if>
|
||||
|
||||
UNION
|
||||
|
||||
SELECT DISTINCT
|
||||
CONCAT( 'lx', bu.dept_id, '-', sda.dict_code ) AS id,
|
||||
sda.dict_label AS NAME,
|
||||
CONCAT( 'dw', bu.dept_id ) AS parentId,
|
||||
2 AS LEVEL,
|
||||
sda.dict_value AS typeKey
|
||||
FROM
|
||||
bm_unit bu
|
||||
LEFT JOIN sys_dict_data sda ON bu.type_id = sda.dict_code
|
||||
AND sda.dict_type = 'bm_unit_type'
|
||||
WHERE
|
||||
bu.del_flag = '0'
|
||||
AND sda.STATUS = '0'
|
||||
AND bu.type_id != 1731
|
||||
<if test="unitName != null and unitName != ''">
|
||||
AND bu.unit_name = #{unitName}
|
||||
</if>
|
||||
|
||||
UNION
|
||||
|
||||
SELECT
|
||||
bu.unit_id AS id,
|
||||
bu.unit_name AS NAME,
|
||||
CONCAT( 'lx', bu.dept_id, '-', sda.dict_code ) AS parentId,
|
||||
3 AS LEVEL,
|
||||
sda.dict_value AS typeKey
|
||||
FROM
|
||||
bm_unit bu
|
||||
LEFT JOIN sys_dict_data sda ON bu.type_id = sda.dict_code
|
||||
AND sda.dict_type = 'bm_unit_type'
|
||||
WHERE
|
||||
bu.del_flag = '0'
|
||||
AND sda.STATUS = '0'
|
||||
AND bu.type_id != 1731
|
||||
<if test="unitName != null and unitName != ''">
|
||||
AND bu.unit_name = #{unitName}
|
||||
</if>
|
||||
) ff
|
||||
ORDER BY
|
||||
LEVEL
|
||||
</select>
|
||||
|
||||
<select id="getDepartName" resultType="java.lang.String">
|
||||
SELECT
|
||||
project_dept
|
||||
FROM
|
||||
data_center.dx_fb_son
|
||||
WHERE name = #{projectName}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue