Merge remote-tracking branch 'origin/master'

This commit is contained in:
liang.chao 2025-07-05 17:27:43 +08:00
commit 4375cbe920
16 changed files with 339 additions and 85 deletions

View File

@ -63,9 +63,10 @@ public class MaterialMachineController extends BaseController {
List<MaterialRetainedEquipmentInfo> pageList = materialMachineService.getRetainedEquipmentList(bean);
return AjaxResult.success(pageList);
}
startPage();
List<MaterialRetainedEquipmentInfo> pageList = materialMachineService.getRetainedEquipmentList(bean);
return AjaxResult.success(getDataTable(pageList));
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
List<MaterialRetainedEquipmentInfo> list = materialMachineService.getRetainedEquipmentList(bean);
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
}
/**

View File

@ -183,4 +183,7 @@ public class MaterialBackApplyInfo implements Serializable {
@ApiModelProperty(value = "身份证号码")
private String idCard;
@ApiModelProperty(value = "i8工程id")
private String externalId;
}

View File

@ -147,4 +147,7 @@ public class MaterialBackApplyTotalInfo implements Serializable {
@ApiModelProperty(value = "管理方式(0编号 1计数)")
private String manageType;
@ApiModelProperty(value = "i8工程id")
private String externalId;
}

View File

@ -281,4 +281,10 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
@ApiModelProperty(value = "协议id集合")
private List<Long> agreementIdList;
@ApiModelProperty(value = "i8工程id")
private String externalId;
@ApiModelProperty(value = "项目部id")
private Long departId;
}

View File

@ -69,4 +69,10 @@ public class MaterialStorageInfo {
@ApiModelProperty(value = "领料编码")
private String code;
@ApiModelProperty(value = "工程id")
private String proId;
@ApiModelProperty(value = "编码ID")
private String maId;
}

View File

@ -68,4 +68,10 @@ public class MaterialUseStorageInfo {
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "工程id")
private String proId;
@ApiModelProperty(value = "编码ID")
private String maId;
}

View File

@ -34,6 +34,13 @@ public class MaterialRetainedEquipmentInfo {
@ApiModelProperty(value = "仓库信息")
private String whHouseName;
@ApiModelProperty(value = "工程id")
private String proId;
@ApiModelProperty(value = "工程名称")
@Excel(name = "工程名称")
private String proName;
@ApiModelProperty(value = "施工类型")
@Excel(name = "施工类型")
private String constructionType;
@ -199,10 +206,6 @@ public class MaterialRetainedEquipmentInfo {
*/
private String teamLeaderIdCard;
@ApiModelProperty(value = "工程id")
private String proId;
@ApiModelProperty(value = "工程名称")
@Excel(name = "工程名称")
private String proName;
@ApiModelProperty(value = "i8工程id")
private String externalId;
}

View File

@ -87,4 +87,7 @@ public class LeaseTotalInfo {
@ApiModelProperty(value = "管理模式")
private String manageType;
@ApiModelProperty(value = "i8工程id")
private String externalId;
}

View File

@ -19,6 +19,7 @@ import com.bonus.material.back.domain.BackApplyInfo;
import com.bonus.material.back.domain.MaCodeDto;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo;
import com.bonus.material.common.mapper.SelectMapper;
import com.bonus.material.ma.mapper.MachineMapper;
import com.bonus.material.clz.domain.back.MaterialBackApplyDetails;
@ -81,30 +82,44 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
if (CollectionUtils.isEmpty(list)) {
return new ArrayList<>();
}
// 提取关键字
String keyWord = backApplyInfo.getKeyWord();
// 如果关键字不为空进行过滤
if (!StringUtils.isBlank(keyWord)) {
list = list.stream()
.filter(item -> containsKeyword(item, keyWord))
.collect(Collectors.toList());
}
// 如果需要导出
if (backApplyInfo.getIsExport()) {
for (MaterialBackApplyInfo applyInfo : list) {
applyInfo.setPrintStatus("0".equals(applyInfo.getPrintStatus()) ? "未打印" : "已打印");
switch (applyInfo.getStatus()) {
case "0":
applyInfo.setStatus("退料未完成");
break;
case "1":
applyInfo.setStatus("维修驳回");
break;
case "2":
applyInfo.setStatus("退料已完成");
break;
default:
break;
String username = SecurityUtils.getLoginUser().getUsername();
list.removeIf(info -> {
if (StringUtils.isBlank(info.getExternalId())) {
return true;
}
MaterialLeaseApplyInfo i8ProjectInfo = mapper.selectI8ProjectInfo(info.getExternalId());
if (i8ProjectInfo == null || i8ProjectInfo.getDepartId() == null) {
return true;
}
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return CollectionUtils.isEmpty(userNameList) || !userNameList.contains(username);
});
if (!CollectionUtils.isEmpty(list)) {
// 提取关键字
String keyWord = backApplyInfo.getKeyWord();
// 如果关键字不为空进行过滤
if (!StringUtils.isBlank(keyWord)) {
list = list.stream()
.filter(item -> containsKeyword(item, keyWord))
.collect(Collectors.toList());
}
// 如果需要导出
if (backApplyInfo.getIsExport()) {
for (MaterialBackApplyInfo applyInfo : list) {
applyInfo.setPrintStatus("0".equals(applyInfo.getPrintStatus()) ? "未打印" : "已打印");
switch (applyInfo.getStatus()) {
case "0":
applyInfo.setStatus("退料未完成");
break;
case "1":
applyInfo.setStatus("维修驳回");
break;
case "2":
applyInfo.setStatus("退料已完成");
break;
default:
break;
}
}
}
}
@ -119,6 +134,21 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
@Override
public List<MaterialBackApplyInfo> getTotalList(MaterialBackApplyInfo backApplyInfo) {
List<MaterialBackApplyInfo> list = materialBackInfoMapper.getTotalList(backApplyInfo);
// 安全过滤数据权限
if (!CollectionUtils.isEmpty(list)) {
String username = SecurityUtils.getLoginUser().getUsername();
list.removeIf(leaseTotalInfo -> {
if (StringUtils.isBlank(leaseTotalInfo.getExternalId())) {
return true;
}
MaterialLeaseApplyInfo i8ProjectInfo = mapper.selectI8ProjectInfo(leaseTotalInfo.getExternalId());
if (i8ProjectInfo == null || i8ProjectInfo.getDepartId() == null) {
return true;
}
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return org.springframework.util.CollectionUtils.isEmpty(userNameList) || !userNameList.contains(username);
});
}
if (!CollectionUtils.isEmpty(list)) {
// 如果关键字不为空进行过滤
if (!StringUtils.isBlank(backApplyInfo.getKeyWord())) {
@ -444,6 +474,20 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
public List<MaterialBackApplyTotalInfo> getBackInfoDetails(MaterialBackApplyTotalInfo info) {
BigDecimal backNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
List<MaterialBackApplyTotalInfo> list = materialBackInfoMapper.getBackInfoDetails(info);
if (CollectionUtils.isNotEmpty(list)) {
String username = SecurityUtils.getLoginUser().getUsername();
list.removeIf(b -> {
if (StringUtils.isBlank(b.getExternalId())) {
return true;
}
MaterialLeaseApplyInfo i8ProjectInfo = mapper.selectI8ProjectInfo(b.getExternalId());
if (i8ProjectInfo == null || i8ProjectInfo.getDepartId() == null) {
return true;
}
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return CollectionUtils.isEmpty(userNameList) || !userNameList.contains(username);
});
}
if (CollectionUtils.isNotEmpty(list)) {
for (MaterialBackApplyTotalInfo backApplyTotalInfo : list) {
backNum = backNum.add(backApplyTotalInfo.getBackNum());
@ -635,7 +679,7 @@ public class MaterialBackApplyInfoServiceImpl implements MaterialBackApplyInfoSe
/**
* 删除编码设备附件
* @param maCodeList
* @param id
* @param taskId
* @return
*/
private int deleteFileInfoForMaCodes(List<MaCodeVo> maCodeList, Long taskId) {

View File

@ -84,41 +84,32 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 查询领料任务列表
*
* @param leaseApplyInfo
* @return
*/
@Override
public List<MaterialLeaseApplyInfo> selectLeaseApplyInfoList(MaterialLeaseApplyInfo leaseApplyInfo) {
List<MaterialLeaseApplyInfo> list = materialLeaseInfoMapper.selectLeaseApplyInfoList(leaseApplyInfo);
// 使用 Stream API 进行降序排序
// 利用Stream API进行降序排序
List<MaterialLeaseApplyInfo> sortedList = list.stream()
.sorted(Comparator.comparing(MaterialLeaseApplyInfo::getCreateTime).reversed())
.collect(Collectors.toList());
// 数据权限划分
sortedList = filterByDataPermission(sortedList);
// 处理剩余数据
if (!CollectionUtils.isEmpty(sortedList)) {
for (MaterialLeaseApplyInfo applyInfo : sortedList) {
// 根据id查询已领料出库数据
BigDecimal num = materialLeaseInfoMapper.getNumList(applyInfo);
if (num == null) {
num = BigDecimal.ZERO;
}
applyInfo.setAlNum(num);
applyInfo.setWaitCountNum(applyInfo.getPreCountNum().subtract(num).compareTo(BigDecimal.ZERO) <= 0 ? BigDecimal.ZERO : applyInfo.getPreCountNum().subtract(num));
if (StringUtils.isNotBlank(applyInfo.getLeaseSignUrl())) {
applyInfo.setIsElectronicSign(0);
} else {
applyInfo.setIsElectronicSign(1);
}
}
processLeaseApplyInfo(sortedList);
// 关键字过滤
String keyWord = leaseApplyInfo.getKeyWord();
// 如果关键字不为空进行过滤
if (!StringUtils.isBlank(keyWord)) {
sortedList = sortedList.stream()
.filter(item -> containsKeyword(item, keyWord))
.collect(Collectors.toList());
}
// 判断状态
// 状态过滤
if (!CollectionUtils.isEmpty(leaseApplyInfo.getStatusList())) {
// 将集合sortedList中状态taskStatus包含在leaseApplyInfo.getStatusList()中的元素
sortedList = sortedList.stream()
.filter(item -> leaseApplyInfo.getStatusList().contains(item.getTaskStatus()))
.collect(Collectors.toList());
@ -127,8 +118,59 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
return sortedList;
}
/**
* 数据权限过滤
*
* @param list
* @return
*/
private List<MaterialLeaseApplyInfo> filterByDataPermission(List<MaterialLeaseApplyInfo> list) {
if (CollectionUtils.isEmpty(list)) {
return Collections.emptyList();
}
String username = SecurityUtils.getLoginUser().getUsername();
return list.stream()
.filter(info -> {
if (StringUtils.isBlank(info.getExternalId())) {
return false;
}
// 根据i8工程id查询项目部id
MaterialLeaseApplyInfo i8ProjectInfo = mapper.selectI8ProjectInfo(info.getExternalId());
if (i8ProjectInfo == null || i8ProjectInfo.getDepartId() == null) {
return false;
}
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return !CollectionUtils.isEmpty(userNameList) && userNameList.contains(username);
})
.collect(Collectors.toList());
}
/**
* 处理数据
*
* @param list
*/
private void processLeaseApplyInfo(List<MaterialLeaseApplyInfo> list) {
for (MaterialLeaseApplyInfo applyInfo : list) {
// 根据id查询已领料出库数据
BigDecimal num = materialLeaseInfoMapper.getNumList(applyInfo);
if (num == null) {
num = BigDecimal.ZERO;
}
applyInfo.setAlNum(num);
applyInfo.setWaitCountNum(applyInfo.getPreCountNum().subtract(num).compareTo(BigDecimal.ZERO) <= 0 ?
BigDecimal.ZERO : applyInfo.getPreCountNum().subtract(num));
if (StringUtils.isNotBlank(applyInfo.getLeaseSignUrl())) {
applyInfo.setIsElectronicSign(0);
} else {
applyInfo.setIsElectronicSign(1);
}
}
}
/**
* 关键字搜索
*
* @param item
* @param keyWord
* @return
@ -147,6 +189,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 查询总站点领料记录数据
*
* @param leaseApplyInfo
* @return
*/
@ -173,6 +216,21 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
.sorted(Comparator.comparing(MaterialLeaseApplyInfo::getCreateTime,
Comparator.nullsLast(Comparator.naturalOrder())).reversed())
.collect(Collectors.toList());
// 安全过滤数据权限
if (!CollectionUtils.isEmpty(sortedList)) {
String username = SecurityUtils.getLoginUser().getUsername();
sortedList.removeIf(leaseTotalInfo -> {
if (StringUtils.isBlank(leaseTotalInfo.getExternalId())) {
return true;
}
MaterialLeaseApplyInfo i8ProjectInfo = mapper.selectI8ProjectInfo(leaseTotalInfo.getExternalId());
if (i8ProjectInfo == null || i8ProjectInfo.getDepartId() == null) {
return true;
}
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return CollectionUtils.isEmpty(userNameList) || !userNameList.contains(username);
});
}
if (!CollectionUtils.isEmpty(sortedList)) {
// 如果关键字不为空进行过滤
if (!StringUtils.isBlank(leaseApplyInfo.getKeyWord())) {
@ -186,6 +244,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 查询总站点领料详情数据
*
* @param leaseApplyInfo
* @return
*/
@ -196,6 +255,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 获取领料任务详细信息
*
* @param id
* @param keyWord
* @param publishTask
@ -295,7 +355,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
}
msgBuilder.append("已被他人完成出库,请注意查看!");
String msg = msgBuilder.toString();
msg = msg.replaceAll("\n","");
msg = msg.replaceAll("\n", "");
ajaxResult.put("msg", msg);
}
return ajaxResult;
@ -308,6 +368,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 获取领料单详情
*
* @param leaseApplyDetails
* @return
*/
@ -315,7 +376,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
public List<MaterialLeaseApplyDetails> getOutNum(MaterialLeaseApplyDetails leaseApplyDetails) {
List<MaterialLeaseApplyDetails> list = materialLeaseInfoMapper.getOutNum(leaseApplyDetails);
// 根据id去出库表查询数据进行数据拼接
List<MaterialLeaseApplyDetails> outNumList = materialLeaseInfoMapper.getOutNumList(leaseApplyDetails);
List<MaterialLeaseApplyDetails> outNumList = materialLeaseInfoMapper.getOutNumList(leaseApplyDetails);
// 构建typeId到LeaseApplyDetails的映射用于快速查找
Map<Long, MaterialLeaseApplyDetails> outNumMap = outNumList.stream()
.collect(Collectors.toMap(MaterialLeaseApplyDetails::getTypeId, details -> details, (existing, replacement) -> existing));
@ -324,7 +385,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
list.forEach(applyDetails -> {
if (outNumMap.containsKey(applyDetails.getTypeId())) {
outNumMap.remove(applyDetails.getTypeId());// 移除已匹配的项
if (applyDetails.getOutNum().compareTo(BigDecimal.ZERO) == 0){
if (applyDetails.getOutNum().compareTo(BigDecimal.ZERO) == 0) {
applyDetails.setStatus("1");
}
}
@ -344,6 +405,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 获取领料单详情
*
* @param dto
* @return
*/
@ -378,6 +440,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 导出工器具领料出库详情
*
* @param leaseApplyInfo
* @return
*/
@ -404,6 +467,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 工器具领料记录数据
*
* @param dto
* @return
*/
@ -440,6 +504,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 添加工器具领料
*
* @param leaseApplyRequestVo
* @return
*/
@ -477,12 +542,12 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
if (leaseApplyRequestVo.getLeaseApplyInfo().getIsOut() == 1) {
tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId(),
LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus(),
leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(),thisMonthMaxOrder + 1, taskCode);
leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(), thisMonthMaxOrder + 1, taskCode);
} else {
tmTask = new TmTask(null, TmTaskTypeEnum.TM_TASK_MATERIAL_LEASE.getTaskTypeId(),
// 待出库
LeaseTaskStatusEnum.LEASE_TASK_TO_PUBLISHED.getStatus(),
leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(),thisMonthMaxOrder + 1, taskCode);
leaseApplyRequestVo.getLeaseApplyInfo().getCompanyId(), thisMonthMaxOrder + 1, taskCode);
}
tmTask.setCreateTime(DateUtils.getNowDate());
tmTask.setCreateBy(createBy);
@ -531,7 +596,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
});
}
if (count > 0) {
return insertPurchaseCheckDetails(createBy, tmTask.getTaskId(),leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyRequestVo.getLeaseApplyInfo().getId(), leaseApplyRequestVo.getLeaseApplyInfo().getIsOut());
return insertPurchaseCheckDetails(createBy, tmTask.getTaskId(), leaseApplyRequestVo.getLeaseApplyDetailsList(), leaseApplyRequestVo.getLeaseApplyInfo().getId(), leaseApplyRequestVo.getLeaseApplyInfo().getIsOut());
} else {
return AjaxResult.error("新增任务失败,lease_apply_info表插入0条");
}
@ -544,6 +609,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 获取协议编号
*
* @return
*/
private String getAgreementCode() {
@ -557,6 +623,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 修改领料任务
*
* @param leaseApplyRequestVo
* @return
*/
@ -642,6 +709,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 领料任务电子签名
*
* @param leaseApplyInfo
* @return
*/
@ -654,6 +722,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 二维码出库根据qrcode查询在库机具信息
*
* @param bmQrcodeInfo
* @return
*/
@ -668,7 +737,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
recordList = recordList.stream().filter(item -> item.getMaStatus().equals(MaMachineStatusEnum.IN_STORE.getStatus().toString())).collect(Collectors.toList());
if (recordList.size() > 0) {
msg = "监测到" + bmQrcodeInfo.getQrCode() + "符合出库条件,请确认是否出库!";
}else{
} else {
msg = "监测到" + bmQrcodeInfo.getQrCode() + "编码不符合出库条件,请检查后重新提交!";
}
} else {
@ -683,6 +752,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* app领料出库提交
*
* @param leaseApplyDetails
* @return
*/
@ -692,7 +762,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
if (leaseApplyDetails.getIsSubmit() != null && leaseApplyDetails.getIsSubmit() == 0) {
List<MaterialLeaseApplyDetails> list = materialLeaseInfoMapper.getOutNum(leaseApplyDetails);
// 根据id去出库表查询数据进行数据拼接
List<MaterialLeaseApplyDetails> outNumList = materialLeaseInfoMapper.getOutNumList(leaseApplyDetails);
List<MaterialLeaseApplyDetails> outNumList = materialLeaseInfoMapper.getOutNumList(leaseApplyDetails);
// 构建typeId到LeaseApplyDetails的映射用于快速查找
Map<Long, MaterialLeaseApplyDetails> outNumMap = outNumList.stream()
.collect(Collectors.toMap(MaterialLeaseApplyDetails::getTypeId, details -> details, (existing, replacement) -> existing));
@ -724,6 +794,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 删除领料任务
*
* @param ids
* @return
*/
@ -741,6 +812,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
/**
* 工器具领料记录
*
* @param info
* @return
*/
@ -750,25 +822,47 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
BigDecimal outNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal pendingNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
List<LeaseTotalInfo> list = materialLeaseInfoMapper.getLeaseInfoDetails(info);
// 安全过滤数据权限
if (!CollectionUtils.isEmpty(list)) {
String username = SecurityUtils.getLoginUser().getUsername();
list.removeIf(leaseTotalInfo -> {
if (StringUtils.isBlank(leaseTotalInfo.getExternalId())) {
return true;
}
MaterialLeaseApplyInfo i8ProjectInfo = mapper.selectI8ProjectInfo(leaseTotalInfo.getExternalId());
if (i8ProjectInfo == null || i8ProjectInfo.getDepartId() == null) {
return true;
}
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return CollectionUtils.isEmpty(userNameList) || !userNameList.contains(username);
});
}
// 处理数据并计算总和
if (!CollectionUtils.isEmpty(list)) {
for (LeaseTotalInfo leaseTotalInfo : list) {
// 根据typeId和parentId查询领料数量
LeaseTotalInfo totalInfo = materialLeaseInfoMapper.getTotalInfo(leaseTotalInfo);
if (totalInfo != null) {
leaseTotalInfo.setPreNum(totalInfo.getPreNum());
leaseTotalInfo.setPendingNum(leaseTotalInfo.getPreNum().subtract(leaseTotalInfo.getOutNum()));
// 安全计算pendingNum避免NPE
BigDecimal outNumValue = leaseTotalInfo.getOutNum() != null ? leaseTotalInfo.getOutNum() : BigDecimal.ZERO;
leaseTotalInfo.setPendingNum(leaseTotalInfo.getPreNum().subtract(outNumValue));
}
preNum = preNum.add(leaseTotalInfo.getPreNum());
outNum = outNum.add(leaseTotalInfo.getOutNum());
pendingNum = pendingNum.add(leaseTotalInfo.getPendingNum());
// 累加统计值确保不处理null值
preNum = preNum.add(leaseTotalInfo.getPreNum() != null ? leaseTotalInfo.getPreNum() : BigDecimal.ZERO);
outNum = outNum.add(leaseTotalInfo.getOutNum() != null ? leaseTotalInfo.getOutNum() : BigDecimal.ZERO);
pendingNum = pendingNum.add(leaseTotalInfo.getPendingNum() != null ? leaseTotalInfo.getPendingNum() : BigDecimal.ZERO);
}
// 添加合计行
if (info.getIsExport() == 0) {
LeaseTotalInfo info1 = new LeaseTotalInfo();
info1.setUnitName("合计");
info1.setPreNum(preNum);
info1.setOutNum(outNum);
info1.setPendingNum(pendingNum);
list.add(0, info1);
LeaseTotalInfo summary = new LeaseTotalInfo();
summary.setUnitName("合计");
summary.setPreNum(preNum.setScale(3, RoundingMode.HALF_UP));
summary.setOutNum(outNum.setScale(3, RoundingMode.HALF_UP));
summary.setPendingNum(pendingNum.setScale(3, RoundingMode.HALF_UP));
list.add(0, summary);
}
}
return list;

View File

@ -5,9 +5,10 @@ import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.StringUtils;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.UseStorageInfo;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo;
import com.bonus.material.clz.domain.machine.MaterialUseStorageInfo;
import com.bonus.material.clz.domain.vo.MaterialSltAgreementInfo;
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;
@ -41,6 +42,9 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
@Resource
private BmTeamMapper bmTeamMapper;
@Resource
private SelectMapper mapper;
/**
* 获取机具追溯管理数据
* @param machine
@ -100,6 +104,20 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
BigDecimal totalRepairInputNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
BigDecimal totalAllNum = BigDecimal.ZERO.setScale(3, RoundingMode.HALF_UP);
List<MaterialRetainedEquipmentInfo> recordList = materialMachineMapper.getRetainedEquipmentList(bean);
if (CollectionUtils.isNotEmpty(recordList)) {
String username = SecurityUtils.getLoginUser().getUsername();
recordList.removeIf(info -> {
if (com.bonus.common.core.utils.StringUtils.isBlank(info.getExternalId())) {
return true;
}
MaterialLeaseApplyInfo i8ProjectInfo = mapper.selectI8ProjectInfo(info.getExternalId());
if (i8ProjectInfo == null || i8ProjectInfo.getDepartId() == null) {
return true;
}
List<String> userNameList = mapper.getUserNameList(i8ProjectInfo);
return CollectionUtils.isEmpty(userNameList) || !userNameList.contains(username);
});
}
if (CollectionUtils.isNotEmpty(recordList)) {
for (MaterialRetainedEquipmentInfo retainedEquipmentInfo : recordList) {
totalStoreNum = totalStoreNum.add(retainedEquipmentInfo.getStoreNum());
@ -137,6 +155,22 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
try {
// 查询库管员
List<MaterialStorageInfo> list = materialMachineMapper.getMaCodeList(bean);
MaterialUseStorageInfo materialUseStorageInfo = new MaterialUseStorageInfo();
materialUseStorageInfo.setProId(StringUtils.isNotBlank(bean.getProId()) ? bean.getProId() : null);
materialUseStorageInfo.setTypeId(bean.getTypeId() != null ? bean.getTypeId() : null);
List<MaterialUseStorageInfo> userList = materialMachineMapper.getUserRecords(materialUseStorageInfo);
if (CollectionUtils.isNotEmpty(list)) {
if (CollectionUtils.isNotEmpty(userList)) {
list.removeIf(info -> {
for (MaterialUseStorageInfo useStorageInfo : userList) {
if (info.getMaId().equals(useStorageInfo.getMaId())) {
return true;
}
}
return false;
});
}
}
if (CollectionUtils.isNotEmpty(list)) {
for (MaterialStorageInfo useStorageInfo : list) {
// 查询出库信息

View File

@ -6,6 +6,7 @@ import com.bonus.common.biz.domain.TypeTreeNode;
import com.bonus.material.back.domain.BackApplyInfo;
import com.bonus.material.basic.domain.BmProject;
import com.bonus.material.basic.domain.BmUnit;
import com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo;
import com.bonus.material.common.domain.dto.SelectDto;
import com.bonus.material.common.domain.vo.AgreementVo;
import com.bonus.material.common.domain.vo.SelectVo;
@ -219,4 +220,18 @@ public interface SelectMapper {
* @return
*/
List<BmUnit> getUnitListLeasePerson(BmUnit bmUnit);
/**
* 根据i8工程id查询项目部id
* @param externalId
* @return
*/
MaterialLeaseApplyInfo selectI8ProjectInfo(String externalId);
/**
* 根据i8工程id查询用户名
* @param i8ProjectInfo
* @return
*/
List<String> getUserNameList(MaterialLeaseApplyInfo i8ProjectInfo);
}

View File

@ -220,7 +220,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP_CONCAT(DISTINCT mt2.type_name) AS typeName,
bai.`status` AS status,
bai.print_status as printStatus,
SUM(IFNULL(bad.pre_num, 0)) AS backNum
SUM(IFNULL(bad.pre_num, 0)) AS backNum,
bp.external_id AS externalId
FROM
clz_back_apply_info bai
LEFT JOIN clz_back_apply_details bad on bad.parent_id = bai.id
@ -551,7 +552,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.pro_name AS proName,
bai.back_person AS backPerson,
bai.create_by AS createBy,
bai.`code` AS code
bai.`code` AS code,
bp.external_id AS externalId
FROM
clz_back_check_details bcd
LEFT JOIN ma_type mt ON bcd.type_id = mt.type_id

View File

@ -37,6 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="leaseSignUrl" column="lease_sign_url" />
<result property="leaseSignType" column="lease_sign_type" />
<result property="agreementId" column="agreement_id" />
<result property="externalId" column="external_id" />
</resultMap>
<resultMap type="com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetails" id="LeaseApplyDetailsResult">
@ -76,7 +77,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames,
bp.contract_part as contractPart,
sd.dept_name as impUnitName,
tta.agreement_id
tta.agreement_id,
bp.external_id
from
clz_lease_apply_info lai
left join tm_task tt on lai.task_id = tt.task_id
@ -733,6 +735,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lai.create_time as leaseDate,
lod.create_time as outDate,
bt.unit_name as teamName,
bp.external_id as externalId,
bp.pro_name as projectName,
lai.lease_person as leasePerson,
lod.create_by as outPerson,

View File

@ -59,12 +59,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_name AS typeModelName,
mt.unit_name AS unit,
IFNULL(mt.lease_price, 0) AS buyPrice,
subquery3.proId AS proId,
subquery3.proName AS proName,
IFNULL(subquery1.usNum, 0) AS storeNum,
subquery1.proId AS proId,
subquery1.proName AS proName,
subquery1.externalId AS externalId,
IFNULL(subquery1.usNum, 0) - IFNULL(subquery3.usNum, 0) AS storeNum,
IFNULL(subquery3.usNum, 0) AS usNum,
IFNULL(subquery1.usNum, 0) + IFNULL(subquery3.usNum, 0)
AS allNum,
IFNULL(subquery1.usNum, 0) AS allNum,
CASE mt.manage_type
WHEN 0 THEN
'编码'
@ -84,7 +84,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS usNum,
bp.pro_name as proName,
bp.pro_id as proId
bp.pro_id as proId,
bp.external_id as externalId
FROM
slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
@ -112,7 +113,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS usNum,
bp.pro_name as proName,
bp.pro_id as proId
bp.pro_id as proId,
bp.external_id as externalId
FROM
clz_slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
@ -128,6 +130,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
GROUP BY mt.type_id, bp.pro_id
) AS subquery3
ON mt.type_id = subquery3.type_id
AND subquery1.proId = subquery3.proId
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
@ -145,7 +148,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt4.type_name like concat('%',#{keyWord},'%') or
mt3.type_name like concat('%',#{keyWord},'%') or
mt2.type_name like concat('%',#{keyWord},'%') or
mt.type_name like concat('%',#{keyWord},'%')
mt.type_name like concat('%',#{keyWord},'%') or
subquery1.proName like concat('%',#{keyWord},'%')
)
</if>
<if test="typeName != null and typeName != ''">
@ -156,7 +160,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
GROUP BY
mt.type_id,
subquery3.proId
subquery1.proId
</select>
<select id="getMaCodeList"
@ -170,7 +174,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bt.unit_name AS teamName,
sai.lease_id AS leaseId,
sai.type_id AS typeId,
lai.code AS code
lai.code AS code,
sai.ma_id AS maId
FROM
slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
@ -179,6 +184,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
WHERE
sai.status = '0'
AND sai.end_time IS NULL
@ -186,6 +192,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="typeId != null">
AND sai.type_id = #{typeId}
</if>
<if test="proId != null and proId != ''">
AND bp.pro_id = #{proId}
</if>
</select>
<select id="selectInFo" resultType="com.bonus.material.clz.domain.machine.MaterialStorageInfo">
@ -672,7 +681,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bt.unit_name AS teamName,
sai.lease_id AS leaseId,
sai.type_id AS typeId,
lai.code AS code
lai.code AS code,
sai.ma_id AS maId
FROM
clz_slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
@ -681,6 +691,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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
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
@ -688,6 +699,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="typeId != null">
AND sai.type_id = #{typeId}
</if>
<if test="proId != null and proId != ''">
AND bp.pro_id = #{proId}
</if>
</select>
<select id="selectUseInFo" resultType="com.bonus.material.clz.domain.machine.MaterialUseStorageInfo">

View File

@ -521,4 +521,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND pai.lease_id = #{leaseId}
and pai.team_id = #{teamId}
</select>
<select id="selectI8ProjectInfo" resultType="com.bonus.material.clz.domain.lease.MaterialLeaseApplyInfo">
SELECT
id as externalId,
project_dept_id as departId
FROM
`data_center`.dx_fb_son
WHERE id = #{externalId}
</select>
<select id="getUserNameList" resultType="java.lang.String">
SELECT
cno
FROM `sbd_audit`.sg_project_post_personnel
WHERE post_id = '3de0eb390f3611efa1940242ac130004'
AND depart_id = #{departId}
</select>
</mapper>