材料站

This commit is contained in:
mashuai 2025-07-11 16:33:19 +08:00
parent 4fbaa07ccf
commit 218fff6e46
20 changed files with 312 additions and 100 deletions

View File

@ -47,4 +47,7 @@ public class MaterialLeaseMaCodeDto {
@ApiModelProperty(value = "协议id")
private Long agreementId;
@ApiModelProperty(value = "规格型号")
private String typeName;
}

View File

@ -454,7 +454,7 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
if (backApplyInfo.getUnitId() != null && backApplyInfo.getProId() != null) {
SelectDto selectDto = new SelectDto();
selectDto.setUnitId(backApplyInfo.getUnitId().intValue());
selectDto.setProjectId(backApplyInfo.getProId().intValue());
selectDto.setProjectId(backApplyInfo.getProId().toString());
List<AgreementVo> list = mapper.getAgreementInfoById(selectDto);
if (CollectionUtils.isNotEmpty(list)) {
backApplyInfo.setAgreementId(Long.valueOf(list.get(0).getAgreementId()));

View File

@ -37,7 +37,7 @@ public class BmTeamController extends BaseController {
public AjaxResult queryByPage(BmTeam tbTeam) {
try {
if (tbTeam.getIsAll() != null && tbTeam.getIsAll() == 0) {
return AjaxResult.success(bmTeamService.getList(tbTeam));
return bmTeamService.getList(tbTeam);
}
startPage();
List<BmTeam> list = bmTeamService.queryByPage(tbTeam);
@ -48,6 +48,17 @@ public class BmTeamController extends BaseController {
}
}
@ApiOperation(value = "分页查询班组信息")
@GetMapping("/getTeamList")
public AjaxResult getTeamList(BmTeam tbTeam) {
try {
return bmTeamService.getTeamList(tbTeam);
} catch (Exception e) {
log.error("查询班组数据失败", e);
return AjaxResult.error("班组数据查询失败");
}
}
/**
* 新增班组信息
* @param tbTeam

View File

@ -11,7 +11,6 @@ import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.BmQrcodeInfo;
import com.bonus.material.clz.domain.back.MaterialBackApplyInfo;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.clz.domain.lease.LeaseApplyDetailsInfo;
import com.bonus.material.clz.domain.lease.LeaseOutDetailsInfo;

View File

@ -101,7 +101,7 @@ public class BmTeam {
private String projectName;
/**
* 工程id
* i8工程id
*/
private String projectId;
@ -114,4 +114,14 @@ public class BmTeam {
* 单位类型id
*/
private Long typeId;
/**
* 工程id
*/
private String proId;
/**
* 班组id
*/
private String bzId;
}

View File

@ -140,7 +140,7 @@ public class MaterialLeaseApplyDetails extends BaseEntity {
private Long userId;
@ApiModelProperty(value = "编码类型集合")
private List<MaCodeVo> maCodeVoList;
private List<MaterialLeaseMaCodeDto> maCodeVoList;
@ApiModelProperty(value = "领料出库编码类型集合")
private List<MaCodeVo> outMaCodeVoList;

View File

@ -57,7 +57,7 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
private Integer leaseUnitId;
@ApiModelProperty(value = "班组id")
private Long teamId;
private String teamId;
@ApiModelProperty(value = "班组名称")
@Excel(name = "领料班组")
@ -66,15 +66,15 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
@ApiModelProperty(value = "租赁工程")
private String leaseProject;
@ApiModelProperty(value = "工程id")
private Long projectId;
@ApiModelProperty(value = "i8工程id")
private String projectId;
@ApiModelProperty(value = "工程名称")
@Excel(name = "租赁工程")
private String projectName;
@ApiModelProperty(value = "领料工程id")
private Integer leaseProjectId;
private Long leaseProjectId;
@ApiModelProperty(value = "领料人签名URL")
private String leaseSignUrl;
@ -290,4 +290,19 @@ public class MaterialLeaseApplyInfo extends BaseEntity {
@ApiModelProperty(value = "实施单位id")
private String impUnit;
/**
* 班组长姓名
*/
private String relName;
/**
* 班组长手机号
*/
private String relPhone;
/**
* 班组长身份证号
*/
private String teamLeaderIdCard;
}

View File

@ -44,12 +44,12 @@ public class IwsTeamUserVo extends IwsUserBean {
/**
* 班组长姓名
*/
private String teamLeaderName;
private String relName;
/**
* 班组长手机号
*/
private String teamLeaderPhone;
private String relPhone;
/**
* 工程id

View File

@ -44,4 +44,11 @@ public interface BmTeamMapper {
* @return
*/
int deleteById(BmTeam tbTeam);
/**
* 查询班组数据
* @param tbTeam
* @return
*/
List<BmTeam> getTeamList(BmTeam tbTeam);
}

View File

@ -39,5 +39,17 @@ public interface BmTeamService {
*/
AjaxResult deleteById(BmTeam tbTeam);
List<BmTeam> getList(BmTeam tbTeam);
/**
* 查询
* @param tbTeam
* @return
*/
AjaxResult getList(BmTeam tbTeam);
/**
* 查询班组信息
* @param tbTeam
* @return
*/
AjaxResult getTeamList(BmTeam tbTeam);
}

View File

@ -8,11 +8,14 @@ import com.bonus.common.core.utils.encryption.Sm4Utils;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.clz.domain.BmTeam;
import com.bonus.material.clz.domain.vo.IwsTeamUserVo;
import com.bonus.material.clz.mapper.BmTeamMapper;
import com.bonus.material.clz.mapper.IwsTeamUserMapper;
import com.bonus.material.clz.service.BmTeamService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@ -27,6 +30,9 @@ public class BmTeamServiceImpl implements BmTeamService {
@Resource
private BmTeamMapper bmTeamMapper;
@Resource
private IwsTeamUserMapper iwsTeamUserMapper;
/**
* 查询班组信息
* @param tbTeam
@ -120,25 +126,25 @@ public class BmTeamServiceImpl implements BmTeamService {
}
@Override
public List<BmTeam> getList(BmTeam tbTeam) {
List<BmTeam> list = bmTeamMapper.queryByPage(tbTeam);
// 第一次查询结果为空尝试第二次查询
if (CollectionUtil.isEmpty(list)) {
tbTeam.setIdCard(null);
list = bmTeamMapper.queryByPage(tbTeam);
public AjaxResult getList(BmTeam tbTeam) {
List<IwsTeamUserVo> iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByIdCard(tbTeam.getIdCard());
if (CollectionUtil.isNotEmpty(iwsTeamUserVos)) {
return AjaxResult.success(iwsTeamUserVos);
}
// 处理查询结果解密手机号
if (CollectionUtil.isNotEmpty(list)) {
for (BmTeam bmTeam : list) {
if (StringUtils.isNotBlank(bmTeam.getRelPhone())) {
if (bmTeam.getRelPhone().length() > 11) {
//进行解密
bmTeam.setRelPhone(Sm4Utils.decrypt(bmTeam.getRelPhone()));
}
}
}
}
return list;
// 根据i8工程id查询班组信息
List<String> ids = Collections.singletonList(tbTeam.getProjectId());
iwsTeamUserVos = iwsTeamUserMapper.selectProjectTeamInfoByProjectIds(ids);
return AjaxResult.success(iwsTeamUserVos);
}
/**
* 查询班组信息
* @param tbTeam
* @return
*/
@Override
public AjaxResult getTeamList(BmTeam tbTeam) {
return AjaxResult.success(bmTeamMapper.getTeamList(tbTeam));
}
/**

View File

@ -111,10 +111,10 @@ public class IwsTeamUserServiceImpl implements IwsTeamUserService {
BmTeam bmTeam = new BmTeam();
bmTeam.setTeamName(StringUtils.isNotBlank(iwsTeamUserVo.getTeamName()) ? iwsTeamUserVo.getTeamName() : null);
bmTeam.setCreateUser(SecurityUtils.getLoginUser().getUserid().toString());
bmTeam.setRelName(StringUtils.isNotBlank(iwsTeamUserVo.getTeamLeaderName()) ? iwsTeamUserVo.getTeamLeaderName() : null);
bmTeam.setRelName(StringUtils.isNotBlank(iwsTeamUserVo.getRelName()) ? iwsTeamUserVo.getRelName() : null);
bmTeam.setIdCard(StringUtils.isNotBlank(iwsTeamUserVo.getTeamLeaderIdCard()) ? iwsTeamUserVo.getTeamLeaderIdCard() : null);
bmTeam.setProjectId(StringUtils.isNotBlank(iwsTeamUserVo.getProjectId()) ? iwsTeamUserVo.getProjectId() : null);
bmTeam.setRelPhone(StringUtils.isNotBlank(iwsTeamUserVo.getTeamLeaderPhone()) ? iwsTeamUserVo.getTeamLeaderPhone() : null);
bmTeam.setRelPhone(StringUtils.isNotBlank(iwsTeamUserVo.getRelPhone()) ? iwsTeamUserVo.getRelPhone() : null);
// 班组类型固定传值
bmTeam.setTypeId(1731L);
// 根据班组名称去bm_unit表查询班组信息

View File

@ -23,6 +23,7 @@ import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
import com.bonus.material.basic.mapper.BmFileInfoMapper;
import com.bonus.material.clz.domain.BmTeam;
import com.bonus.material.clz.domain.vo.MaterialMaCodeVo;
import com.bonus.material.clz.mapper.BmTeamMapper;
import com.bonus.material.clz.mapper.MaterialMachineMapper;
import com.bonus.material.common.domain.dto.SelectDto;
import com.bonus.material.common.domain.vo.AgreementVo;
@ -45,6 +46,7 @@ import com.bonus.material.task.mapper.TmTaskMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
@ -86,6 +88,9 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
@Resource
private MaterialMachineMapper materialMachineMapper;
@Resource
private BmTeamMapper bmTeamMapper;
/**
* 查询领料任务列表
*
@ -112,7 +117,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
if (teamData != null) {
// 将sortedList中班组身份证号与username相同的元素过滤处理
sortedList = sortedList.stream()
.filter(item -> StringUtils.isBlank(item.getIdCard()) || username.equals(item.getIdCard()))
.filter(item -> StringUtils.isBlank(item.getTeamLeaderIdCard()) || username.equals(item.getTeamLeaderIdCard()))
.collect(Collectors.toList());
} else {
sortedList = filterByDataPermission(sortedList);
@ -331,7 +336,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
detail.setUseNum(BigDecimal.ZERO);
}
SelectDto selectDto = new SelectDto();
selectDto.setProjectId(info.getProjectId().intValue());
selectDto.setProId(info.getProId());
List<AgreementVo> list = mapper.getAgreementInfoBy(selectDto);
// 先查第四层类型
List<TypeTreeNode> listL4 = new ArrayList<>();
@ -364,7 +369,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
}
// 根据工程id去协议表中查询协议id
MaterialLeaseApplyInfo bean = new MaterialLeaseApplyInfo();
bean.setProId(info.getProjectId());
bean.setProId(info.getProId());
List<BmAgreementInfo> listAgreement = materialLeaseInfoMapper.getAgreementIdByProId(bean);
if (!CollectionUtils.isEmpty(listAgreement)) {
for (BmAgreementInfo agreementInfo : listAgreement) {
@ -422,30 +427,34 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
}
}
// 获取编码详情
// 移出maCodeList集合中状态不为在库的数据
List<MaterialLeaseMaCodeDto> maCodeVoList = materialLeaseInfoMapper.getCodeList(id, detail.getTypeId());
if (!CollectionUtils.isEmpty(maCodeVoList)) {
if (!CollectionUtils.isEmpty(maCodeVoList)) {
// 根据id查询协议id
Long agreementId = materialLeaseInfoMapper.getAgreementId(id);
// 将maCodeList不等于1的收集到新集合中
for (MaterialLeaseMaCodeDto maCodeVo : maCodeVoList) {
if (maCodeVo.getMaId() != null) {
// 根据协议idtypeIdmaId查询设备是否已被领料
maCodeVo.setAgreementId(agreementId);
MaterialLeaseApplyInfo applyInfo = materialLeaseInfoMapper.selectInfoById(maCodeVo);
if (applyInfo != null) {
newCodeList.add(maCodeVo);
// 将maCodeVoList中的materialModel值赋值给typeName
maCodeVoList.forEach(maCodeVo -> maCodeVo.setTypeName(maCodeVo.getMaterialModel()));
detail.setMaCodeVoList(maCodeVoList);
if (info.getTaskStatus() == 1) {
if (!CollectionUtils.isEmpty(maCodeVoList)) {
// 根据id查询协议id
Long agreementId = materialLeaseInfoMapper.getAgreementId(id);
for (MaterialLeaseMaCodeDto maCodeVo : maCodeVoList) {
if (maCodeVo.getMaId() != null) {
// 根据协议idtypeIdmaId查询设备是否已被领料
maCodeVo.setAgreementId(agreementId);
MaterialLeaseApplyInfo applyInfo = materialLeaseInfoMapper.selectInfoById(maCodeVo);
if (applyInfo != null) {
// 将maCodeList中已领料的收集到新集合中
newCodeList.add(maCodeVo);
}
}
}
}
// 将maCodeVoList中包含newCodeList集合的数据移除
if (!CollectionUtils.isEmpty(newCodeList)) {
maCodeVoList.removeAll(newCodeList);
}
detail.setMaCodeVoList(maCodeVoList);
detail.setPreNum(BigDecimal.valueOf(maCodeVoList.size()));
}
// 将maCodeVoList中包含newCodeList集合的数据移除
if (!CollectionUtils.isEmpty(newCodeList)) {
maCodeVoList.removeAll(newCodeList);
}
detail.setMaCodeList(maCodeVoList);
detail.setPreNum(BigDecimal.valueOf(maCodeVoList.size()));
}
}
}
@ -454,7 +463,8 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
for (MaterialLeaseApplyDetails detail : outDetailsList) {
List<MaterialLeaseMaCodeDto> maCodeVoList = materialLeaseInfoMapper.getCodeList(id, detail.getTypeId());
if (!CollectionUtils.isEmpty(maCodeVoList)) {
detail.setMaCodeList(maCodeVoList);
maCodeVoList.forEach(maCodeVo -> maCodeVo.setTypeName(maCodeVo.getMaterialModel()));
detail.setMaCodeVoList(maCodeVoList);
}
}
}
@ -539,14 +549,104 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
if (!CollectionUtils.isEmpty(details)) {
leaseApplyRequestVo.setLeaseApplyDetailsList(details);
for (MaterialLeaseApplyDetails detail : details) {
// 获取编码详情
List<MaterialLeaseMaCodeDto> maCodeVoList = materialLeaseInfoMapper.getCodeList(dto.getId(), detail.getTypeId());
if (!CollectionUtils.isEmpty(maCodeVoList)) {
detail.setMaCodeList(maCodeVoList);
SelectDto selectDto = new SelectDto();
selectDto.setProId(Long.valueOf(info.getProjectId()));
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);
}
}
}
}
});
return leaseApplyRequestVo;
} catch (Exception e) {
@ -677,6 +777,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult insertLeaseApplyInfo(MaterialLeaseApplyRequestVo leaseApplyRequestVo) {
log.info("新增接口传参:{}", leaseApplyRequestVo);
if (null == leaseApplyRequestVo.getLeaseApplyInfo()) {
@ -721,13 +822,33 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
tmTask.setCreateBy(createBy);
tmTaskMapper.insertTmTask(tmTask);
BmAgreementInfo bmAgreementInfo = new BmAgreementInfo();
bmAgreementInfo.setProjectId(leaseApplyRequestVo.getLeaseApplyInfo().getProjectId());
bmAgreementInfo.setTeamId(leaseApplyRequestVo.getLeaseApplyInfo().getTeamId());
bmAgreementInfo.setUnitId(leaseApplyRequestVo.getLeaseApplyInfo().getTeamId());
bmAgreementInfo.setProjectId(leaseApplyRequestVo.getLeaseApplyInfo().getProId());
bmAgreementInfo.setCreateTime(DateUtils.getNowDate());
bmAgreementInfo.setCreateBy(createBy);
bmAgreementInfo.setSignTime(DateUtils.getNowDate());
bmAgreementInfo.setAgreementCode(getAgreementCode());
// 先根据班组名称查询此班组是否存在
BmTeam tbTeam = new BmTeam();
tbTeam.setTeamName(leaseApplyRequestVo.getLeaseApplyInfo().getTeamName());
tbTeam.setRelName(StringUtils.isNotBlank(leaseApplyRequestVo.getLeaseApplyInfo().getRelName()) ? leaseApplyRequestVo.getLeaseApplyInfo().getRelName() : null);
tbTeam.setIdCard(StringUtils.isNotBlank(leaseApplyRequestVo.getLeaseApplyInfo().getTeamLeaderIdCard()) ? leaseApplyRequestVo.getLeaseApplyInfo().getTeamLeaderIdCard() : null);
tbTeam.setProjectId(leaseApplyRequestVo.getLeaseApplyInfo().getProjectId().toString());
tbTeam.setRelPhone(StringUtils.isNotBlank(leaseApplyRequestVo.getLeaseApplyInfo().getRelPhone()) ? leaseApplyRequestVo.getLeaseApplyInfo().getRelPhone() : null);
// 班组类型固定传值
tbTeam.setTypeId(1731L);
BmTeam bmTeam = bmTeamMapper.selectByName(tbTeam);
if (bmTeam == null) {
// 新增班组
tbTeam.setCreateUser(SecurityUtils.getLoginUser().getUserid().toString());
int result = bmTeamMapper.insert(tbTeam);
if (result <= 0) {
return AjaxResult.error(HttpCodeEnum.UPDATE_TO_DATABASE.getCode(), HttpCodeEnum.UPDATE_TO_DATABASE.getMsg());
}
bmAgreementInfo.setUnitId(tbTeam.getId());
} else {
bmAgreementInfo.setUnitId(bmTeam.getId());
bmTeamMapper.update(tbTeam);
}
// 先根据班组和工程id查询若存在则直接返回不存在则新增
BmAgreementInfo info = bmAgreementInfoMapper.queryByTeamIdAndProjectIdCl(bmAgreementInfo);
if (info != null) {
@ -749,6 +870,7 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
// 领料任务类型为1 工器具领料
leaseApplyRequestVo.getLeaseApplyInfo().setLeaseStyle("1");
leaseApplyRequestVo.getLeaseApplyInfo().setTeamId(bmAgreementInfo.getUnitId().toString());
int count = materialLeaseInfoMapper.insertLeaseApplyInfo(leaseApplyRequestVo.getLeaseApplyInfo());
if (!CollectionUtils.isEmpty(leaseApplyRequestVo.getLeaseApplyInfo().getBmFileInfos())) {
TmTask finalTmTask = tmTask;
@ -1173,15 +1295,24 @@ public class MaterialLeaseInfoServiceImpl implements MaterialLeaseInfoService {
}
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(listL5)) {
for (TypeTreeNode node : listL5) {
// 根据工程和班组id查询协议id
BmAgreementInfo info = materialLeaseInfoMapper.getAgreeId(bean);
if (info != null) {
Type maType = new Type();
maType.setAgreementId(info.getAgreementId());
maType.setTypeId(node.getTypeId());
Type dto = typeMapper.getNumList(maType);
if (dto != null) {
node.setUseNum(dto.getUseNum());
// 先根据班组id查询班组是否存在
BmTeam bmTeam = new BmTeam();
bmTeam.setTeamName(bean.getTeamName());
BmTeam team = bmTeamMapper.selectByName(bmTeam);
if (team != null) {
bean.setTeamId(team.getId().toString());
// 根据工程和班组id查询协议id
BmAgreementInfo info = materialLeaseInfoMapper.getAgreeId(bean);
if (info != null) {
Type maType = new Type();
maType.setAgreementId(info.getAgreementId());
maType.setTypeId(node.getTypeId());
Type dto = typeMapper.getNumList(maType);
if (dto != null) {
node.setUseNum(dto.getUseNum());
} else {
node.setUseNum(BigDecimal.ZERO);
}
} else {
node.setUseNum(BigDecimal.ZERO);
}

View File

@ -34,7 +34,7 @@ public class SelectDto {
private int unitId;
/** 标段工程id*/
private int projectId;
private String projectId;
/** 计量单位*/
private String unitName;
@ -42,5 +42,7 @@ public class SelectDto {
private List<Integer> unitIds;
/** 班组id*/
private int teamId;
private String teamId;
private Long proId;
}

View File

@ -1,5 +1,6 @@
package com.bonus.material.common.service.impl;
import com.alibaba.nacos.common.utils.StringUtils;
import com.bonus.common.biz.domain.*;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
@ -12,7 +13,6 @@ import com.bonus.material.common.domain.vo.SelectVo;
import com.bonus.material.common.mapper.SelectMapper;
import com.bonus.material.common.service.SelectService;
import com.bonus.material.materialStation.domain.ProAuthorizeInfo;
import com.bonus.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
@ -261,8 +261,8 @@ public class SelectServiceImpl implements SelectService {
public AjaxResult getAgreementInfoByIdBack(SelectDto dto) {
AgreementVo vo = new AgreementVo();
try {
if (dto != null && dto.getTeamId() > 0) {
dto.setUnitId(dto.getTeamId());
if (dto != null && dto.getTeamId() != null) {
dto.setUnitId(Integer.parseInt(dto.getTeamId()));
}
List<AgreementVo> list = mapper.getAgreementInfoById(dto);
if (CollectionUtils.isNotEmpty(list)) {
@ -556,7 +556,7 @@ public class SelectServiceImpl implements SelectService {
List<Integer> agreementIdList = new ArrayList<>();
AgreementVo vo = new AgreementVo();
try {
if (dto != null && dto.getTeamId() > 0) {
if (dto != null && StringUtils.isNotBlank(dto.getTeamId())) {
List<AgreementVo> list = mapper.getAgreementInfoBy(dto);
if (CollectionUtils.isNotEmpty(list)) {
for (AgreementVo agreementVo : list) {

View File

@ -706,7 +706,7 @@ public class SltAgreementInfoServiceImpl implements ISltAgreementInfoService {
public AjaxResult getAgreementInfoById(SelectDto dto) {
List<AgreementVo> vo = new ArrayList<>();
try {
List<AgreementVo> list = sltAgreementInfoMapper.getAgreementInfoById(dto.getUnitIds(), dto.getProjectId());
List<AgreementVo> list = sltAgreementInfoMapper.getAgreementInfoById(dto.getUnitIds(), Integer.parseInt(dto.getProjectId()));
if (CollectionUtils.isNotEmpty(list)) {
vo = list;
} else {

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.material.clz.mapper.BmTeamMapper">
<insert id="insert">
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO bm_unit
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="teamName != null">unit_name,</if>
@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUser != null">create_by,</if>
del_flag,
<if test="projectId != null">project_id,</if>
<if test="idCard != null">bzz_idcard,</if>
<if test="idCard != null and idCard != ''">bzz_idcard,</if>
<if test="typeId != null">type_id,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
@ -26,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createUser != null">#{createUser},</if>
0,
<if test="projectId != null">#{projectId},</if>
<if test="idCard != null">#{idCard},</if>
<if test="idCard != null and idCard != ''">#{idCard},</if>
<if test="typeId != null">#{typeId},</if>
</trim>
</insert>
@ -35,11 +35,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
UPDATE bm_unit
<set>
<if test="teamName != null">unit_name = #{teamName},</if>
<if test="departId != null">depart_id = #{departId},</if>
<if test="typeId != null">type_id = #{typeId},</if>
<if test="relName != null">link_man = #{relName},</if>
<if test="relPhone != null">telphone = #{relPhone},</if>
<if test="updateUser != null">update_by = #{updateUser},</if>
<if test="status != null">status = #{status},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="idCard != null">bzz_idcard = #{idCard},</if>
<if test="bzId != null and bzId != ''">bz_id = #{bzId},</if>
update_time = NOW()
</set>
WHERE unit_id = #{id}
@ -90,11 +93,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectByName" resultType="com.bonus.material.clz.domain.BmTeam">
select unit_id as id, unit_name as teamName, link_man as relName,
telphone as relPhone, create_time as createTime, create_by as createUser,
update_time as updateTime, update_by as updateUser, del_flag as delFlag
update_time as updateTime, update_by as updateUser, del_flag as delFlag,
bz_id as bzId
from bm_unit
where del_flag = 0 and status = '0'
<if test="teamName != null and teamName != ''">
and unit_name = #{teamName}
</if>
</select>
<select id="getTeamList" resultType="com.bonus.material.clz.domain.BmTeam">
SELECT DISTINCT bu.unit_id AS id,
bu.unit_name AS teamName,
bu.link_man AS relName,
bu.telphone AS relPhone
FROM bm_project bpl
LEFT JOIN clz_bm_agreement_info bai ON bpl.pro_id = bai.project_id AND bai.`status` = '1'
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id AND bu.del_flag = '0'
WHERE bpl.pro_id = #{proId} AND bpl.del_flag = '0'
</select>
</mapper>

View File

@ -18,9 +18,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectProjectTeamInfoByIdCard" resultType="com.bonus.material.clz.domain.vo.IwsTeamUserVo">
select
bzgl_bz.id, bzgl_bz.bzmc as teamName, bzgl_bz.bzz_name as teamLeaderName, bzgl_bz.bzz_idcard as teamLeaderIdCard,
bzgl_bz.id, bzgl_bz.bzmc as teamName, bzgl_bz.bzz_name as relName, bzgl_bz.bzz_idcard as teamLeaderIdCard,
bzgl_bz.bz as remark, bzgl_bz.bz_status as teamStatus, bzgl_bz.project_id as projectId,
bzgl_bz.project_name as projectName, org_user.mobile as teamLeaderPhone
bzgl_bz.project_name as projectName, org_user.mobile as relPhone
from
`micro-tool`.bzgl_bz bzgl_bz
left join `uni_org`.org_user org_user on bzgl_bz.bzz_idcard = org_user.id_card
@ -33,9 +33,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectProjectTeamInfoByProjectIds" resultType="com.bonus.material.clz.domain.vo.IwsTeamUserVo">
select
bzgl_bz.id, bzgl_bz.bzmc as teamName, bzgl_bz.bzz_name as teamLeaderName, bzgl_bz.bzz_idcard as teamLeaderIdCard,
bzgl_bz.id, bzgl_bz.bzmc as teamName, bzgl_bz.bzz_name as relName, bzgl_bz.bzz_idcard as teamLeaderIdCard,
bzgl_bz.bz as remark, bzgl_bz.bz_status as teamStatus, bzgl_bz.project_id as projectId, bzgl_bz.project_name as projectName,
bzgl_bz.bzz_idcard as teamLeaderIdCard, org_user.mobile as teamLeaderPhone
bzgl_bz.bzz_idcard as teamLeaderIdCard, org_user.mobile as relPhone
from
`micro-tool`.bzgl_bz bzgl_bz
left join `uni_org`.org_user org_user on bzgl_bz.bzz_idcard = org_user.id_card

View File

@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="code" column="code" />
<result property="taskId" column="task_id" />
<result property="leasePerson" column="lease_person" />
<result property="phone" column="phone" />
<result property="relPhone" column="phone" />
<result property="type" column="type" />
<result property="companyAuditBy" column="company_audit_by" />
<result property="companyAuditTime" column="company_audit_time" />
@ -39,7 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="agreementId" column="agreement_id" />
<result property="externalId" column="external_id" />
<result property="impUnit" column="imp_unit" />
<result property="idCard" column="bzz_idcard" />
<result property="teamLeaderIdCard" column="bzz_idcard" />
</resultMap>
<resultMap type="com.bonus.material.clz.domain.lease.MaterialLeaseApplyDetails" id="LeaseApplyDetailsResult">
@ -70,7 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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.project_id as projectId, bp.pro_name as projectName, tt.task_status as taskStatus,
lai.project_id as proId, bp.pro_name as projectName, tt.task_status as taskStatus,
sda.dict_label as taskStatusName,
lai.team_id as teamId,
bt.unit_name as teamName,
@ -84,7 +84,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bp.imp_unit,
bt.bzz_idcard,
bai.unit_id,
bai.project_id
bai.project_id as projectId,
bt.link_man as relName
from
clz_lease_apply_info lai
left join tm_task tt on lai.task_id = tt.task_id
@ -148,7 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="estimateLeaseTime != null">estimate_lease_time,</if>
<if test="costBearingParty != null">cost_bearing_party,</if>
<if test="teamId != null">team_id,</if>
<if test="projectId != null">project_id,</if>
<if test="proId != null">project_id,</if>
<if test="leaseStyle != null">lease_style,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
@ -177,7 +178,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="estimateLeaseTime != null">#{estimateLeaseTime},</if>
<if test="costBearingParty != null">#{costBearingParty},</if>
<if test="teamId != null">#{teamId},</if>
<if test="projectId != null">#{projectId},</if>
<if test="proId != null">#{proId},</if>
<if test="leaseStyle != null">#{leaseStyle},</if>
</trim>
</insert>
@ -517,7 +518,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.type_name as materialModel,
mm.ma_id as maId,
mm.ma_code as maCode,
sd.dict_label as maStatus,
'在用' as maStatus,
mm.ma_status as status
FROM
clz_lease_out_details lod
@ -526,8 +527,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
AND mt1.del_flag = '0'
LEFT JOIN sys_dict_data sd ON mm.ma_status = sd.dict_value
and sd.dict_type = 'ma_machine_status'
WHERE
lod.parent_id = #{id}
and mt.type_id = #{typeId}
@ -617,7 +616,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
mt.unit_value as unitValue,
SUM(lad.out_num) as outNum,
IFNULL( lod.pre_num, 0 ) as preNum,
lad.remark as remark
lod.remark as remark
FROM
clz_lease_out_details lad
LEFT JOIN clz_lease_apply_details lod ON lad.parent_id = lod.parent_id

View File

@ -476,7 +476,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
bai.status = '1'
AND bu.type_id = 36
AND bai.project_id = #{projectId}
AND bai.project_id = #{proId}
</select>
<select id="getTeam" resultType="com.bonus.common.biz.domain.ProjectTreeNode">
@ -542,7 +542,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
/*根据往来单位id关联协议查询工程*/
<if test="teamId != null">
SELECT DISTINCT bp.pro_id AS proId,
bp.pro_name AS proName
bp.pro_name AS proName,
bp.external_id AS projectId
FROM bm_unit bu
LEFT JOIN clz_bm_agreement_info bai ON bu.unit_id = bai.unit_id AND bai.`status` = '1'
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id AND bp.del_flag = '0'
@ -550,7 +551,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="teamId == null">
SELECT pro_id AS proId,
pro_name AS proName
pro_name AS proName,
external_id AS projectId
FROM bm_project
WHERE del_flag = '0'
</if>