This commit is contained in:
parent
2338d1c89e
commit
e592719669
|
|
@ -7,6 +7,7 @@ import lombok.ToString;
|
|||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -119,6 +120,15 @@ public class LeaseOutDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "是否退回 (0:未退回,1:退回)")
|
||||
private Integer isBack;
|
||||
|
||||
@ApiModelProperty("机具类型(1机具,2安全工器具)")
|
||||
private int jiJuType;
|
||||
|
||||
@ApiModelProperty(value = "本次检验日期")
|
||||
private Date thisCheckTime;
|
||||
|
||||
@ApiModelProperty(value = "下次检验日期")
|
||||
private Date nextCheckTime;
|
||||
|
||||
/**
|
||||
* 领料出库机具编码集合
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -10,11 +10,8 @@ import javax.validation.constraints.NotNull;
|
|||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.bonus.common.biz.config.ListPagingUtil;
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.common.biz.domain.lease.LeasePublishInfo;
|
||||
import com.bonus.common.core.utils.ServletUtils;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.archives.service.ArchivesService;
|
||||
import com.bonus.material.back.domain.BackApplyDetails;
|
||||
import com.bonus.material.back.domain.HandlingOrder;
|
||||
|
|
@ -72,6 +69,46 @@ public class BackApplyInfoController extends BaseController {
|
|||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未签字退料任务列表
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询未签字退料任务列表")
|
||||
@GetMapping("/getNoSignList")
|
||||
public AjaxResult getNoSignList(BackApplyInfo backApplyInfo) {
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<BackApplyInfo> list = backApplyInfoService.getNoSignList(backApplyInfo);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询材料员待确认的任务
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询材料员待确认的任务")
|
||||
@GetMapping("/getCompleteBackTaskList")
|
||||
public AjaxResult getCompleteBackTaskList(BackApplyInfo backApplyInfo) {
|
||||
Integer pageIndex = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
||||
Integer pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
||||
List<BackApplyInfo> list = backApplyInfoService.getCompleteBackTaskList(backApplyInfo);
|
||||
return AjaxResult.success(ListPagingUtil.paging(pageIndex, pageSize, list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 材料员确认接口
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "材料员确认接口")
|
||||
@PostMapping("/confirmMaterial")
|
||||
public AjaxResult confirmMaterial(@RequestBody BackApplyInfo backApplyInfo) {
|
||||
int confirmResult = backApplyInfoService.confirmMaterial(backApplyInfo);
|
||||
return confirmResult > 0 ? success("确认成功") : error("确认失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传退料单PDF文件
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -188,4 +188,19 @@ public class BackApplyInfo implements Serializable {
|
|||
|
||||
@ApiModelProperty(value = "一级类型id集合")
|
||||
private String firstId;
|
||||
|
||||
@ApiModelProperty(value = "i8工程id")
|
||||
private String externalId;
|
||||
|
||||
@ApiModelProperty(value = "材料员确认账号")
|
||||
private String materialMan;
|
||||
|
||||
@ApiModelProperty(value = "材料员确认时间")
|
||||
private String confirmTime;
|
||||
|
||||
@ApiModelProperty(value = "是否确认 0不需要确认,1未确认 2已确认")
|
||||
private Integer isConfirm;
|
||||
|
||||
@ApiModelProperty(value = "材料员确认备注")
|
||||
private String confirmRemark;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,5 +190,27 @@ public interface IBackApplyInfoService {
|
|||
* @return
|
||||
*/
|
||||
AjaxResult uploadSort(HandlingOrder bean);
|
||||
|
||||
/**
|
||||
* 查询未签字退料任务列表
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<BackApplyInfo> getNoSignList(BackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* 查询材料员待确认的任务
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
List<BackApplyInfo> getCompleteBackTaskList(BackApplyInfo backApplyInfo);
|
||||
|
||||
/**
|
||||
* 材料员确认接口
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
int confirmMaterial(BackApplyInfo backApplyInfo);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import cn.hutool.core.util.PhoneUtil;
|
|||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
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.enums.*;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
|
|
@ -24,6 +23,7 @@ import com.bonus.material.basic.mapper.BmFileInfoMapper;
|
|||
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.lease.mapper.LeaseApplyInfoMapper;
|
||||
import com.bonus.material.ma.mapper.MachineMapper;
|
||||
import com.bonus.material.purchase.config.RemoteConfig;
|
||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||
|
|
@ -74,6 +74,9 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
@Resource
|
||||
private SelectMapper mapper;
|
||||
|
||||
@Resource
|
||||
private LeaseApplyInfoMapper leaseApplyInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询退料任务 - 性能优化版
|
||||
*
|
||||
|
|
@ -425,27 +428,27 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
backApplyInfo.setUserId(userId == 0 ? null : userId);
|
||||
}
|
||||
list = backApplyInfoMapper.selectBackApplyInfoList(backApplyInfo);
|
||||
for (BackApplyInfo applyInfo : list) {
|
||||
if (!CollectionUtils.isEmpty(typeIdList)) {
|
||||
// 使用流过滤符合条件的元素
|
||||
list = list.stream()
|
||||
.filter(item -> {
|
||||
String firstIdStr = item.getFirstId();
|
||||
if (firstIdStr == null) {
|
||||
return false;
|
||||
}
|
||||
// 将逗号分隔的字符串转为集合
|
||||
Set<Long> firstIds = Arrays.stream(firstIdStr.split(","))
|
||||
.map(String::trim)
|
||||
.filter(s -> !s.isEmpty())
|
||||
.map(Long::parseLong)
|
||||
.collect(Collectors.toSet());
|
||||
if (!CollectionUtils.isEmpty(typeIdList)) {
|
||||
// 使用流过滤符合条件的元素
|
||||
list = list.stream()
|
||||
.filter(item -> {
|
||||
String firstIdStr = item.getFirstId();
|
||||
if (firstIdStr == null) {
|
||||
return false;
|
||||
}
|
||||
// 将逗号分隔的字符串转为集合
|
||||
Set<Long> firstIds = Arrays.stream(firstIdStr.split(","))
|
||||
.map(String::trim)
|
||||
.filter(s -> !s.isEmpty())
|
||||
.map(Long::parseLong)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 判断两个集合是否有交集
|
||||
return firstIds.stream().anyMatch(typeIdList::contains);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// 判断两个集合是否有交集
|
||||
return firstIds.stream().anyMatch(typeIdList::contains);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
for (BackApplyInfo applyInfo : list) {
|
||||
if (StringUtils.isNotBlank(applyInfo.getBackSignUrl())) {
|
||||
applyInfo.setBackSignUrl("data:image/png;base64," + applyInfo.getBackSignUrl());
|
||||
}
|
||||
|
|
@ -1701,6 +1704,94 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询未签字退料任务列表
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BackApplyInfo> getNoSignList(BackApplyInfo backApplyInfo) {
|
||||
backApplyInfo.setIsSign(1);
|
||||
Long userId = SecurityUtils.getLoginUser().getUserid();
|
||||
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
|
||||
List<Long> typeIdList = backApplyInfoMapper.selectTypeIdList(userId);
|
||||
if (CollectionUtils.isEmpty(typeIdList)) {
|
||||
backApplyInfo.setUserId(userId == 0 ? null : userId);
|
||||
}
|
||||
List<BackApplyInfo> list = backApplyInfoMapper.selectBackApplyInfoList(backApplyInfo);
|
||||
if (!CollectionUtils.isEmpty(typeIdList)) {
|
||||
// 使用流过滤符合条件的元素
|
||||
list = list.stream()
|
||||
.filter(item -> {
|
||||
String firstIdStr = item.getFirstId();
|
||||
if (firstIdStr == null) {
|
||||
return false;
|
||||
}
|
||||
// 将逗号分隔的字符串转为集合
|
||||
Set<Long> firstIds = Arrays.stream(firstIdStr.split(","))
|
||||
.map(String::trim)
|
||||
.filter(s -> !s.isEmpty())
|
||||
.map(Long::parseLong)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 判断两个集合是否有交集
|
||||
return firstIds.stream().anyMatch(typeIdList::contains);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// 提取关键字
|
||||
String keyWord = backApplyInfo.getKeyWord();
|
||||
// 如果关键字不为空,进行过滤
|
||||
if (!StringUtils.isBlank(keyWord)) {
|
||||
list = list.stream()
|
||||
.filter(item -> containsKeyword(item, keyWord))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询材料员待确认的任务
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BackApplyInfo> getCompleteBackTaskList(BackApplyInfo backApplyInfo) {
|
||||
// 查询已签名数据
|
||||
backApplyInfo.setIsSign(2);
|
||||
List<BackApplyInfo> list = backApplyInfoMapper.selectBackApplyInfoList(backApplyInfo);
|
||||
//材料站权限过滤
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
if(!CollectionUtils.isEmpty(list)) {
|
||||
list = list.stream()
|
||||
.filter(info -> {
|
||||
// 调用 mapper 方法检查是否有符合条件的数据
|
||||
int count = leaseApplyInfoMapper.checkPermission(info.getExternalId(), username);
|
||||
return count > 0;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
// 提取关键字
|
||||
String keyWord = backApplyInfo.getKeyWord();
|
||||
// 如果关键字不为空,进行过滤
|
||||
if (!StringUtils.isBlank(keyWord)) {
|
||||
list = list.stream()
|
||||
.filter(item -> containsKeyword(item, keyWord))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 材料员确认接口
|
||||
* @param backApplyInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int confirmMaterial(BackApplyInfo backApplyInfo) {
|
||||
return backApplyInfoMapper.updateBackApplyInfo(backApplyInfo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 关键字搜索
|
||||
|
|
|
|||
|
|
@ -702,105 +702,27 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
// 获取工器具领料出库详情
|
||||
List<MaterialLeaseApplyDetails> details = materialLeaseInfoMapper.getOutDetailsById(dto);
|
||||
if (!CollectionUtils.isEmpty(details)) {
|
||||
leaseApplyRequestVo.setLeaseApplyDetailsList(details);
|
||||
// 步骤4.1: 收集所有typeId,进行批量查询
|
||||
List<Long> typeIds = details.stream()
|
||||
.map(MaterialLeaseApplyDetails::getTypeId)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
SelectDto selectDto = new SelectDto();
|
||||
selectDto.setProId(info.getProId());
|
||||
List<AgreementVo> agreementList = mapper.getAgreementInfoBy(selectDto);
|
||||
Map<Long, BigDecimal> storageNumMap = preCalculateStorageNums(info, agreementList, typeIds);
|
||||
for (MaterialLeaseApplyDetails detail : details) {
|
||||
SelectDto selectDto = new SelectDto();
|
||||
selectDto.setProId(info.getProId());
|
||||
List<AgreementVo> list = mapper.getAgreementInfoBy(selectDto);
|
||||
// 先查第四层类型
|
||||
List<TypeTreeNode> listL4 = new ArrayList<>();
|
||||
List<TypeTreeNode> listL5 = new ArrayList<>();
|
||||
List<TypeTreeNode> list7 = new ArrayList<>();
|
||||
BackApplyInfo backApplyInfo = new BackApplyInfo();
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
for (AgreementVo agreementVo : list) {
|
||||
backApplyInfo.setAgreementId(Long.valueOf(agreementVo.getAgreementId()));
|
||||
listL4 = mapper.getUseTypeTreeL4(backApplyInfo);
|
||||
if (!CollectionUtils.isEmpty(listL4)) {
|
||||
listL4 = listL4.stream()
|
||||
.filter(item -> StringUtils.isNotBlank(item.getMaterialName()) && StringUtils.isNotBlank(item.getTypeName()))
|
||||
.collect(Collectors.toList());
|
||||
// 将listL5中typeId相同的数据进行num相加
|
||||
for (TypeTreeNode node : listL4) {
|
||||
// 根据node中的typeId查询listL5中相同数据,如果在listL5中存在,则将num相加,反之将node添加到list5中
|
||||
TypeTreeNode node1 = listL5.stream()
|
||||
.filter(item -> item.getTypeId() == (node.getTypeId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (node1 != null) {
|
||||
node1.setNum(node1.getNum().add(node.getNum()));
|
||||
}
|
||||
if (node1 == null) {
|
||||
listL5.add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 根据工程id去协议表中查询协议id
|
||||
MaterialLeaseApplyInfo bean = new MaterialLeaseApplyInfo();
|
||||
bean.setProId(info.getProId());
|
||||
List<BmAgreementInfo> listAgreement = materialLeaseInfoMapper.getAgreementIdByProId(bean);
|
||||
if (!CollectionUtils.isEmpty(listAgreement)) {
|
||||
for (BmAgreementInfo agreementInfo : listAgreement) {
|
||||
bean.setAgreementId(agreementInfo.getAgreementId());
|
||||
List<TypeTreeNode> list6 = materialLeaseInfoMapper.getUseTypeTree(bean);
|
||||
if (!CollectionUtils.isEmpty(list6)) {
|
||||
for (TypeTreeNode node : list6) {
|
||||
// 根据node中的typeId查询listL7中相同数据,如果在listL7中存在,则将num相加,反之将node添加到list7中
|
||||
TypeTreeNode node1 = list7.stream()
|
||||
.filter(item -> item.getTypeId() == (node.getTypeId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
if (node1 != null) {
|
||||
node1.setNum(node1.getNum().add(node.getNum()));
|
||||
}
|
||||
if (node1 == null) {
|
||||
list7.add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 根据协议id去clz_slt_agreement_info材料站协议表中查询在用设备,进行数据筛选去除
|
||||
if (!CollectionUtils.isEmpty(listL5)) {
|
||||
if (!CollectionUtils.isEmpty(list7)) {
|
||||
// 将list5中typeId和list7中相同数据进行num相减,并剔除相减后为0的数据
|
||||
Map<Long, BigDecimal> typeIdToNum = list7.stream()
|
||||
.collect(Collectors.toMap(
|
||||
TypeTreeNode::getTypeId,
|
||||
TypeTreeNode::getNum,
|
||||
BigDecimal::add
|
||||
));
|
||||
Iterator<TypeTreeNode> iterator = listL5.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
TypeTreeNode node = iterator.next();
|
||||
Long typeId = node.getTypeId();
|
||||
// 获取要减去的值,默认值为BigDecimal.ZERO
|
||||
BigDecimal subtractNum = typeIdToNum.getOrDefault(typeId, BigDecimal.ZERO);
|
||||
// 计算新值,处理num为null的情况(若业务允许)
|
||||
BigDecimal currentNum = Optional.ofNullable(node.getNum())
|
||||
.orElse(BigDecimal.ZERO);
|
||||
BigDecimal newNum = currentNum.subtract(subtractNum);
|
||||
if (newNum.compareTo(BigDecimal.ZERO) == 0) {
|
||||
iterator.remove();
|
||||
} else {
|
||||
node.setNum(newNum);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 根据details中的typeId去list5中获取库存
|
||||
listL5.stream()
|
||||
.filter(node -> detail.getTypeId().equals(node.getTypeId()))
|
||||
.findFirst()
|
||||
.ifPresent(node -> detail.setStorageNum(node.getNum()));
|
||||
}
|
||||
// 获取编码详情
|
||||
List<MaterialLeaseMaCodeDto> maCodeVoList = materialLeaseInfoMapper.getCodeList(dto.getId(), detail.getTypeId());
|
||||
if (!CollectionUtils.isEmpty(maCodeVoList)) {
|
||||
detail.setMaCodeList(maCodeVoList);
|
||||
}
|
||||
// 直接从预计算的Map中获取库存数据,避免复杂的嵌套循环
|
||||
BigDecimal storageNum = storageNumMap.getOrDefault(detail.getTypeId(), BigDecimal.ZERO);
|
||||
detail.setStorageNum(storageNum);
|
||||
// 获取编码详情
|
||||
List<MaterialLeaseMaCodeDto> maCodeVoList = materialLeaseInfoMapper.getCodeList(dto.getId(), detail.getTypeId());
|
||||
if (!CollectionUtils.isEmpty(maCodeVoList)) {
|
||||
detail.setMaCodeList(maCodeVoList);
|
||||
}
|
||||
}
|
||||
leaseApplyRequestVo.setLeaseApplyDetailsList(details);
|
||||
}
|
||||
});
|
||||
return leaseApplyRequestVo;
|
||||
|
|
@ -1503,17 +1425,17 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
|
|||
list.addAll(listL3);
|
||||
list.addAll(listL21);
|
||||
}
|
||||
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) {
|
||||
/*if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(list)) {
|
||||
// 创建树形结构(数据集合作为参数)
|
||||
TypeTreeBuild treeBuild = new TypeTreeBuild(list);
|
||||
// 原查询结果转换树形结构
|
||||
groupList = treeBuild.buildTree();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
} catch (Exception e) {
|
||||
AjaxResult.error("类型树-查询失败", e);
|
||||
}
|
||||
return AjaxResult.success(groupList);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -552,6 +552,9 @@ public class MaterialMachineServiceImpl implements MaterialMachineService {
|
|||
if (teamData == null) {
|
||||
// 根据用户名查询项目部信息
|
||||
String departId = mapper.getDepartId(username);
|
||||
if (StringUtils.isBlank(departId)) {
|
||||
return new MaterialRetainedEquipmentInfo();
|
||||
}
|
||||
// 根据项目部id查询工程信息
|
||||
List<String> projectIdList = mapper.getProjectId(departId);
|
||||
if (!org.springframework.util.CollectionUtils.isEmpty(projectIdList)) {
|
||||
|
|
|
|||
|
|
@ -586,7 +586,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
// 领用数据
|
||||
List<LeaseApplyInfo> leaseApplyOutList = leaseApplyInfoMapper.selectPublish(leaseApplyInfo);
|
||||
if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
|
||||
for (LeaseApplyInfo applyInfo : leaseApplyOutList) {
|
||||
list.addAll(leaseApplyOutList);
|
||||
for (LeaseApplyInfo applyInfo : list) {
|
||||
// 根据id去查询出库数量
|
||||
LeaseApplyInfo outList = leaseApplyInfoMapper.getOutList(applyInfo);
|
||||
if (outList != null) {
|
||||
|
|
@ -599,7 +600,6 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
applyInfo.setIsConfirm(1);
|
||||
}
|
||||
}
|
||||
list.addAll(leaseApplyOutList);
|
||||
}
|
||||
//材料站权限过滤
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
|
|
@ -686,7 +686,8 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
// 领用数据
|
||||
List<LeaseApplyInfo> leaseApplyOutList = leaseApplyInfoMapper.selectPublish(leaseApplyInfo);
|
||||
if (!CollectionUtils.isEmpty(leaseApplyOutList)) {
|
||||
for (LeaseApplyInfo applyInfo : leaseApplyOutList) {
|
||||
list.addAll(leaseApplyOutList);
|
||||
for (LeaseApplyInfo applyInfo : list) {
|
||||
// 根据id去查询出库数量
|
||||
LeaseApplyInfo outList = leaseApplyInfoMapper.getOutList(applyInfo);
|
||||
if (outList != null) {
|
||||
|
|
@ -699,7 +700,6 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
applyInfo.setIsConfirm(1);
|
||||
}
|
||||
}
|
||||
list.addAll(leaseApplyOutList);
|
||||
}
|
||||
|
||||
if (leaseApplyInfo.getIsConfirm()!=null) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.material.lease.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
|
|
@ -517,8 +518,17 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
|||
if (res > 0) {
|
||||
// 普通机具减少 (ma_type 设备规格表)的库存数量
|
||||
res = typeMapper.updateMaTypeStockNum(record);
|
||||
// 更新 (ma_machine 设备表)的状态
|
||||
machineMapper.updateMaMachineStatus(record, MaMachineStatusEnum.IN_USE.getStatus());
|
||||
if (record.getMaId() != null) {
|
||||
if (record.getJiJuType() == 1) {
|
||||
record.setThisCheckTime(DateUtils.getNowDate());
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
// 计算下一次检验日期:当前日期加一年减一天
|
||||
LocalDate nextCheckDate = currentDate.plusYears(1).minusDays(1);
|
||||
record.setNextCheckTime(DateUtils.toDate(nextCheckDate));
|
||||
}
|
||||
// 更新 (ma_machine 设备表)的状态
|
||||
res = machineMapper.updateMaMachineStatus(record, MaMachineStatusEnum.IN_USE.getStatus());
|
||||
}
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,13 @@ 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,
|
||||
GROUP_CONCAT(DISTINCT mt4.type_id) as firstId
|
||||
GROUP_CONCAT(DISTINCT mt4.type_id) as firstId,
|
||||
bp.external_id as externalId,
|
||||
su.nick_name as materialMan,
|
||||
bai.confirm_time as confirmTime,
|
||||
bai.is_confirm as isConfirm,
|
||||
bai.confirm_remark as confirmRemark,
|
||||
SUM(bad.pre_num) as backNum
|
||||
FROM
|
||||
back_apply_info bai
|
||||
LEFT JOIN back_apply_details bad on bad.parent_id = bai.id
|
||||
|
|
@ -65,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt1.parent_id AND mt2.del_flag = '0'
|
||||
left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0'
|
||||
left join ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.del_flag = '0'
|
||||
left join sys_user su on su.user_id = bai.material_man
|
||||
<if test="userId != null">
|
||||
JOIN ma_type_repair mtr ON mtr.type_id = bad.type_id AND mtr.user_id = #{userId}
|
||||
</if>
|
||||
|
|
@ -663,6 +670,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="status != null">`status` = #{status},</if>
|
||||
<if test="directId != null">direct_id = #{directId},</if>
|
||||
<if test="printStatus != null">print_status = #{printStatus},</if>
|
||||
<if test="material_man != null and material_man != ''">material_man = #{materialMan},</if>
|
||||
<if test="confirmTime != null and confirmTime != ''">confirm_time = #{confirmTime},</if>
|
||||
<if test="isConfirm != null">is_confirm = #{isConfirm},</if>
|
||||
<if test="confirmRemark != null and confirmRemark != ''">confirm_remark = #{confirmRemark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{typeId}
|
||||
</foreach>
|
||||
</if>
|
||||
ORDER BY mt.type_id, mm.ma_code
|
||||
ORDER BY mt.type_id, mm.ma_id
|
||||
</select>
|
||||
|
||||
<!-- 批量查询设备是否已被领料 -->
|
||||
|
|
|
|||
|
|
@ -86,29 +86,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<sql id="selectLeaseApplyInfoVoTwo">
|
||||
select
|
||||
lai.id, lai.code, lai.task_id, lai.lease_person as leasePerson, lai.phone, lai.type, lai.company_audit_by,
|
||||
lai.company_audit_time, lai.company_audit_remark, lai.dept_audit_by, lai.dept_audit_time,
|
||||
lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark,
|
||||
lai.create_by, lai.create_time, lai.update_by, lai.update_time, lai.remark, lai.company_id,
|
||||
lai.direct_id, lai.lease_type, lai.estimate_lease_time, lai.cost_bearing_party, lai.lease_sign_url, lai.lease_sign_type,
|
||||
lai.material_man, lai.confirm_time, lai.is_confirm, lai.confirm_remark,
|
||||
bai.unit_id,bai.project_id,bu.unit_name as unitName, bp.pro_name as projectName,bp.external_id as externalId, bai.agreement_code as agreementCode, tt.task_status as taskStatus,
|
||||
sda.dict_label as taskStatusName,
|
||||
IFNULL(sum(lad.pre_num),0) as preCountNum,
|
||||
IFNULL(sum(lod.out_num),0) as alNum,
|
||||
CASE
|
||||
WHEN IFNULL(sum(lad.pre_num),0) = SUM(CASE WHEN lod.is_confirm = 2 THEN lod.out_num ELSE 0 END) THEN 2
|
||||
ELSE 1
|
||||
END as isConfirm,
|
||||
GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames,
|
||||
bp.contract_part as contractPart,
|
||||
sd.dept_name as impUnitName,
|
||||
tt.task_type as taskType
|
||||
lai.id, lai.code, lai.task_id, lai.lease_person as leasePerson, lai.phone, lai.type, lai.company_audit_by,
|
||||
lai.company_audit_time, lai.company_audit_remark, lai.dept_audit_by, lai.dept_audit_time,
|
||||
lai.dept_audit_remark, lai.direct_audit_by, lai.direct_audit_time, lai.direct_audit_remark,
|
||||
lai.create_by, lai.create_time as createTime, lai.update_by, lai.update_time, lai.remark, lai.company_id,
|
||||
lai.direct_id, lai.lease_type, lai.estimate_lease_time, lai.cost_bearing_party, lai.lease_sign_url, lai.lease_sign_type,
|
||||
lai.material_man, lai.confirm_time, lai.is_confirm, lai.confirm_remark,
|
||||
bai.unit_id,bai.project_id,bu.unit_name as unitName, bp.pro_name as projectName,bp.external_id as externalId, bai.agreement_code as agreementCode, tt.task_status as taskStatus,
|
||||
sda.dict_label as taskStatusName,
|
||||
IFNULL(sum(lad.pre_num),0) as preCountNum,
|
||||
IFNULL(lod.num,0) as alNum,
|
||||
GROUP_CONCAT(DISTINCT mt1.type_name) as maTypeNames,
|
||||
bp.contract_part as contractPart,
|
||||
sd.dept_name as impUnitName,
|
||||
tt.task_type as taskType
|
||||
from
|
||||
lease_apply_info lai
|
||||
lease_apply_info lai
|
||||
left join tm_task tt on lai.task_id = tt.task_id
|
||||
left join lease_apply_details lad on lai.id = lad.parent_id
|
||||
left join lease_out_details lod on lai.id = lod.parent_id
|
||||
LEFT JOIN (SELECT IFNULL( sum(out_num ), 0) AS num, parent_id, publish_task, is_confirm, confirm_remark, confirm_time, lease_sign_id from lease_out_details
|
||||
GROUP BY parent_id) lod ON lai.id = lod.parent_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
|
||||
|
|
@ -404,7 +401,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectCompleteOutList" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||
<include refid="selectLeaseApplyInfoVoTwo"/>
|
||||
where
|
||||
lod.out_num >0 and lod.lease_sign_id is not null and bp.external_id is not null
|
||||
lod.num >0 and lod.lease_sign_id is not null and bp.external_id is not null
|
||||
and tt.task_type = 2
|
||||
<if test="code != null and code != ''"> and lai.code = #{code}</if>
|
||||
<if test="taskId != null "> and lai.task_id = #{taskId}</if>
|
||||
|
|
@ -435,7 +432,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="estimateLeaseTime != null "> and lai.estimate_lease_time = #{estimateLeaseTime}</if>
|
||||
<if test="costBearingParty != null and costBearingParty != ''"> and lai.cost_bearing_party = #{costBearingParty}</if>
|
||||
GROUP BY lai.id
|
||||
ORDER BY tt.task_status,tt.create_time desc
|
||||
ORDER BY tt.task_status,lai.create_time desc
|
||||
</select>
|
||||
<select id="checkPermission" resultType="java.lang.Integer">
|
||||
SELECT COUNT(1)
|
||||
|
|
@ -730,7 +727,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
lod.confirm_remark AS confirmRemark,
|
||||
mt3.type_id AS firstId,
|
||||
lpd.create_time AS releaseTime,
|
||||
bp.external_id as externalId
|
||||
bp.external_id as externalId,
|
||||
lai.create_time as createTime
|
||||
FROM
|
||||
lease_apply_info lai
|
||||
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
|
||||
|
|
|
|||
|
|
@ -342,9 +342,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<update id="updateMaMachineStatus">
|
||||
UPDATE
|
||||
ma_machine
|
||||
ma_machine
|
||||
SET
|
||||
ma_status = #{status},create_time = NOW()
|
||||
ma_status = #{status},create_time = NOW()
|
||||
<if test="record.thisCheckTime != null">
|
||||
,this_check_time = #{record.thisCheckTime}
|
||||
</if>
|
||||
<if test="record.nextCheckTime != null">
|
||||
,next_check_time = #{record.nextCheckTime}
|
||||
</if>
|
||||
<where>
|
||||
type_id = #{record.typeId}
|
||||
<if test="record.maId != null and record.maId != ''">
|
||||
|
|
|
|||
Loading…
Reference in New Issue