This commit is contained in:
mashuai 2025-12-03 16:08:23 +08:00
parent 4631cec07c
commit eb9f571239
19 changed files with 323 additions and 12 deletions

View File

@ -57,4 +57,7 @@ public class TypeTreeNode {
@ApiModelProperty(value = "是否检验0不检验1检验")
private String isCheck;
@ApiModelProperty("是否提示 当前工器具仍有班组在用,请核实退料单位")
private Boolean isAlert = false;
}

View File

@ -106,4 +106,7 @@ public class MaCodeVo {
@ApiModelProperty(value = "发布批次")
private String publishTask;
@ApiModelProperty("是否提示 当前工器具仍有班组在用,请核实退料单位")
private Boolean isAlert = false;
}

View File

@ -10,6 +10,7 @@ import com.bonus.material.back.domain.vo.BackApplyInfoVo;
import com.bonus.material.back.domain.vo.BackApplyVo;
import com.bonus.material.back.domain.vo.BackExportDetailsVo;
import com.bonus.material.back.domain.vo.MaCodeVo;
import com.bonus.material.basic.domain.BmAgreementInfo;
import com.bonus.material.clz.domain.back.MaterialBackApplyDetails;
import com.bonus.material.settlement.domain.SltAgreementInfo;
import org.apache.ibatis.annotations.Param;
@ -568,4 +569,12 @@ public interface BackApplyInfoMapper {
* @return
*/
int updateClzInfo(SltAgreementInfo info);
/**
* 查询材料站在用
* @param maCodeVo
* @param listAgreement
* @return
*/
SltAgreementInfo getClzUseInfoList(@Param("info") MaCodeVo maCodeVo, @Param("agreementIds") List<BmAgreementInfo> listAgreement);
}

View File

@ -1201,7 +1201,27 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
if (StringUtils.isBlank(dto.getTypeId())) {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "机具类型ID为空");
}
return AjaxResult.success(backApplyInfoMapper.getMachineById(dto));
// 根据单位id查询是否属于项目部退料
boolean isXmb = false;
List<BmAgreementInfo> listAgreement = new ArrayList<>();
TypeTreeNode node = mapper.getTypeId(dto);
if (node != null && node.getTypeId() == 36) {
listAgreement = mapper.getAgreementIdByProId(dto);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(listAgreement)) {
isXmb = true;
}
}
List<MaCodeVo> list = backApplyInfoMapper.getMachineById(dto);
if (isXmb) {
for (MaCodeVo maCodeVo : list) {
// 根据typeId及maId及材料站协议查询该设备是否在材料站在用
SltAgreementInfo info = backApplyInfoMapper.getClzUseInfoList(maCodeVo, listAgreement);
if (info != null) {
maCodeVo.setIsAlert(true);
}
}
}
return AjaxResult.success(list);
}
/**
@ -2130,6 +2150,25 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
filter(info -> !maCodes.contains(info.getMaCode())).
collect(Collectors.toList());
}
// 根据单位id查询是否属于项目部退料
boolean isXmb = false;
List<BmAgreementInfo> listAgreement = new ArrayList<>();
TypeTreeNode node = mapper.getTypeId(dto);
if (node != null && node.getTypeId() == 36) {
listAgreement = mapper.getAgreementIdByProId(dto);
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(listAgreement)) {
isXmb = true;
}
}
if (isXmb) {
for (MaCodeVo maCodeVo : list) {
// 根据typeId及maId及材料站协议查询该设备是否在材料站在用
SltAgreementInfo info = backApplyInfoMapper.getClzUseInfoList(maCodeVo, listAgreement);
if (info != null) {
maCodeVo.setIsAlert(true);
}
}
}
}
return list;
}

View File

@ -155,4 +155,6 @@ public class BmAgreementInfo extends BaseEntity
@ApiModelProperty(value = "所属项目部名称")
private String projectUnitName;
private long typeId;
}

View File

@ -5,6 +5,7 @@ import com.bonus.common.biz.domain.TreeNode;
import com.bonus.common.biz.domain.TypeTreeNode;
import com.bonus.material.back.domain.BackApplyDetails;
import com.bonus.material.back.domain.BackApplyInfo;
import com.bonus.material.basic.domain.BmAgreementInfo;
import com.bonus.material.basic.domain.BmProject;
import com.bonus.material.basic.domain.BmUnit;
import com.bonus.material.clz.domain.back.MaterialBackPreApply;
@ -506,4 +507,33 @@ public interface SelectMapper {
* @return
*/
List<ProjectTreeNode> getAgreeUnitList(BmUnit bmUnit);
/**
* 根据单位id查询是否属于项目部退料
* @param bean
* @return
*/
TypeTreeNode getTypeId(BackApplyInfo bean);
/**
* 根据工程id查询协议id
* @param bean
* @return
*/
List<BmAgreementInfo> getAgreementIdByProId(BackApplyInfo bean);
/**
* 根据类型id查询使用量
* @param listAgreement
* @param typeTreeNode
* @return
*/
TypeTreeNode getClzUseByTypeId(@Param("agreementIds") List<BmAgreementInfo> listAgreement,@Param("type") TypeTreeNode typeTreeNode);
/**
* 根据协议id查询协议信息
* @param bean
* @return
*/
BmAgreementInfo getInfoList(BackApplyInfo bean);
}

View File

@ -7,12 +7,11 @@ import com.bonus.common.biz.domain.*;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.back.domain.BackApplyInfo;
import com.bonus.material.basic.domain.BmAgreementInfo;
import com.bonus.material.basic.domain.BmProject;
import com.bonus.material.basic.domain.BmUnit;
import com.bonus.material.basic.mapper.BmUnitMapper;
import com.bonus.material.clz.domain.BmTeam;
import com.bonus.material.clz.domain.vo.MaterialRetainedEquipmentInfo;
import com.bonus.material.clz.service.MaterialLeaseInfoService;
import com.bonus.material.common.domain.dto.SelectDto;
import com.bonus.material.common.domain.vo.AgreementVo;
import com.bonus.material.common.domain.vo.SelectVo;
@ -944,6 +943,16 @@ public class SelectServiceImpl implements SelectService {
*/
@Override
public AjaxResult getUseTypeTree(BackApplyInfo bean) {
// 根据单位id查询是否属于项目部退料
boolean isXmb = false;
List<BmAgreementInfo> listAgreement = new ArrayList<>();
TypeTreeNode node = mapper.getTypeId(bean);
if (node != null && node.getTypeId() == 36) {
listAgreement = mapper.getAgreementIdByProId(bean);
if (CollectionUtils.isNotEmpty(listAgreement)) {
isXmb = true;
}
}
List<TypeTreeNode> groupList = new ArrayList<>();
List<TypeTreeNode> list = new ArrayList<>();
List<TypeTreeNode> listL4 = new ArrayList<>();
@ -953,6 +962,17 @@ public class SelectServiceImpl implements SelectService {
// 先查第四层类型
listL4 = mapper.getUseTypeTreeL4(bean);
if (CollectionUtils.isNotEmpty(listL4)) {
if (isXmb) {
for (TypeTreeNode typeTreeNode : listL4) {
// 针对于数量设备根据协议查询是否存在班组在用
if (StringUtils.isNotBlank(typeTreeNode.getManageType()) && "1".equals(typeTreeNode.getManageType())) {
TypeTreeNode info = mapper.getClzUseByTypeId(listAgreement, typeTreeNode);
if (info != null) {
typeTreeNode.setIsAlert(true);
}
}
}
}
List<Long> list4ParentIds = listL4.stream().map(TypeTreeNode::getParentId).collect(Collectors.toList());
// 根据第四层parentId 查第三层类型
listL3 = mapper.getUseTypeTreeL3(list4ParentIds);
@ -982,12 +1002,32 @@ public class SelectServiceImpl implements SelectService {
*/
@Override
public AjaxResult getUseType(BackApplyInfo bean) {
// 根据协议id查询是否是项目部退料
boolean isXmb = false;
List<BmAgreementInfo> listAgreement = new ArrayList<>();
BmAgreementInfo bmAgreementInfo = mapper.getInfoList(bean);
if (bmAgreementInfo != null && bmAgreementInfo.getTypeId() == 36) {
bean.setProId(bmAgreementInfo.getProjectId());
listAgreement = mapper.getAgreementIdByProId(bean);
if (CollectionUtils.isNotEmpty(listAgreement)) {
isXmb = true;
}
}
//四级类型只查询数量管理类型数据
bean.setUserId(SecurityUtils.getLoginUser().getUserid());
List<TypeTreeNode> listL4 = mapper.getUseTypeTreeApp(bean);
if (CollectionUtils.isEmpty(listL4)) {
return AjaxResult.success();
}
if (isXmb) {
for (TypeTreeNode typeTreeNode : listL4) {
// 针对于数量设备根据协议查询是否存在班组在用
TypeTreeNode info = mapper.getClzUseByTypeId(listAgreement, typeTreeNode);
if (info != null) {
typeTreeNode.setIsAlert(true);
}
}
}
// 根据四级查询三级类型信息
List<Long> list4ParentIds = listL4.stream()
.map(TypeTreeNode::getParentId)

View File

@ -1,5 +1,6 @@
package com.bonus.material.ma.controller;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
@ -195,9 +196,16 @@ public class DirectRotationController extends BaseController {
*/
@PostMapping("/export")
public void export(HttpServletResponse response, DirectApplyInfo directApplyInfo) {
String fileName = "直转记录查询";
List<DirectApplyExportInfo> list = service.getList(directApplyInfo);
// 根据list集合数去填充序号
for (int i = 0; i < list.size(); i++) {
list.get(i).setSerialNumber(i + 1);
}
ExcelUtil<DirectApplyExportInfo> util = new ExcelUtil<>(DirectApplyExportInfo.class);
util.exportExcel(response, list, "直转记录数据");
// 获取当前年月日时分秒导出时间用括号拼接在后面
String title = "直转记录查询" + "" + "导出时间:" + DateUtils.getTime() + "";
util.exportExcel(response, list, fileName, title);
}
/**
@ -273,5 +281,16 @@ public class DirectRotationController extends BaseController {
public AjaxResult getSignatureList(SltAgreementInfo sltAgreementInfo) {
return service.getSignatureList(sltAgreementInfo);
}
/**
* 获取业务联系单号下拉
* @param directApplyInfo
* @return
*/
@ApiOperation(value = "获取业务联系单号下拉")
@GetMapping("/getCodeList")
public AjaxResult getCodeList(DirectApplyInfo directApplyInfo) {
return service.getCodeList(directApplyInfo);
}
}

View File

@ -18,6 +18,10 @@ import java.util.List;
@Data
public class DirectApplyExportInfo {
@ApiModelProperty(value = "序号")
@Excel(name = "序号", isSequence = true, sort = 0, width = 5)
private Integer serialNumber;
/**
* id
*/
@ -43,7 +47,7 @@ public class DirectApplyExportInfo {
private String createBy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "申请时间", sort = 1, width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "申请时间", sort = 1, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private String updateBy;
@ -55,7 +59,7 @@ public class DirectApplyExportInfo {
/**
* 退料工程名称
*/
@Excel(name = "转出工程", sort = 4)
@Excel(name = "转出工程", sort = 4, width = 30)
private String backProName;
/**
@ -66,7 +70,7 @@ public class DirectApplyExportInfo {
/**
* 退料单位名称
*/
@Excel(name = "转出单位", sort = 3)
@Excel(name = "转出单位", sort = 3, width = 30)
private String backUnitName;
/**
@ -76,7 +80,7 @@ public class DirectApplyExportInfo {
/**
* 领料工程名称
*/
@Excel(name = "转入工程", sort = 6)
@Excel(name = "转入工程", sort = 6, width = 30)
private String leaseProName;
/**
* 领料单位id
@ -85,7 +89,7 @@ public class DirectApplyExportInfo {
/**
* 领料单位名称
*/
@Excel(name = "转入单位", sort = 5)
@Excel(name = "转入单位", sort = 5, width = 30)
private String leaseUnitName;
/**
* 退料人
@ -208,4 +212,8 @@ public class DirectApplyExportInfo {
@ApiModelProperty(value = "结束时间")
private String endTime;
@ApiModelProperty(value = "业务联系单号")
@Excel(name = "业务联单", sort = 9, width = 20)
private String businessCode;
}

View File

@ -228,4 +228,10 @@ public class DirectApplyInfo extends BaseEntity {
@ApiModelProperty(value = "退料项目部")
private String backDepartName;
@ApiModelProperty(value = "业务办理单号")
private String businessCode;
@ApiModelProperty(value = "业务联单集合")
private List<String> codeList;
}

View File

@ -126,4 +126,11 @@ public interface DirectRotationMapper {
* @return
*/
BmUnit getTeam(SltAgreementInfo sltAgreementInfo);
/**
* 获取业务联系单号下拉
* @param directApplyInfo
* @return
*/
List<DirectApplyInfo> getCodeList(DirectApplyInfo directApplyInfo);
}

View File

@ -122,4 +122,11 @@ public interface DirectRotationService {
* @return
*/
BmUnit getTeam(SltAgreementInfo sltAgreementInfo);
/**
* 获取业务联系单号下拉
* @param directApplyInfo
* @return
*/
AjaxResult getCodeList(DirectApplyInfo directApplyInfo);
}

View File

@ -358,6 +358,10 @@ public class DirectRotationImpl implements DirectRotationService {
directApplyInfos.setDirUrl(String.join(",", urls));
}
directApplyInfos.setCreateBy(SecurityUtils.getLoginUser().getUserid().toString());
if (CollectionUtils.isNotEmpty(directApplyInfos.getCodeList())) {
// 将领料单号集合转换成字符串
directApplyInfos.setBusinessCode(String.join(",", directApplyInfos.getCodeList()));
}
//将数据插入直转表direct_apply_info
int res = workSiteDirectManageService.saveDirectApplyInfo(directApplyInfos);
int id =directApplyInfos.getId();
@ -581,6 +585,17 @@ public class DirectRotationImpl implements DirectRotationService {
return mapper.getTeam(sltAgreementInfo);
}
/**
* 获取业务联系单号下拉
* @param directApplyInfo
* @return
*/
@Override
public AjaxResult getCodeList(DirectApplyInfo directApplyInfo) {
List<DirectApplyInfo> list = mapper.getCodeList(directApplyInfo);
return AjaxResult.success(list);
}
// 将签名分类的逻辑提取到一个单独的方法
private void classifySignature(ClzDirectApplyInfo clzDirectApplyInfo, LeaseOutSign leaseOutSign,
List<LeaseOutSign> list1, List<LeaseOutSign> list2, List<LeaseOutSign> list3) {

View File

@ -1876,4 +1876,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY
bcd.create_time desc
</select>
<select id="getClzUseInfoList" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
SELECT
id AS id,
agreement_id AS agreementId,
type_id AS typeId,
ma_id AS maId,
num AS backNum,
start_time AS startTime,
end_time AS endTime,
status AS status,
lease_id AS leaseId,
lease_type AS leaseType,
back_id AS backId,
lease_price AS leasePrice,
buy_price AS buyPrice,
company_id AS companyId
FROM
clz_slt_agreement_info
WHERE
status = 0
AND (source = 1 OR source is NULL)
AND type_id = #{info.typeId}
AND ma_id = #{info.maId}
AND agreement_id in
<foreach item="agreement" collection="agreementIds" open="(" separator="," close=")">
#{agreement.agreementId}
</foreach>
order by start_time asc
LIMIT 1
</select>
</mapper>

View File

@ -1717,4 +1717,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ORDER BY
LEVEL
</select>
<select id="getTypeId" resultType="com.bonus.common.biz.domain.TypeTreeNode">
select type_id as typeId
from bm_unit
where unit_id = #{unitId}
</select>
<select id="getAgreementIdByProId" resultType="com.bonus.material.basic.domain.BmAgreementInfo">
SELECT
bai.agreement_id as agreementId,
bai.agreement_code as agreementCode
FROM
clz_bm_agreement_info bai
LEFT JOIN bm_project bp ON bai.project_id = bp.pro_id
WHERE
bai.project_id = #{proId}
</select>
<select id="getClzUseByTypeId" resultType="com.bonus.common.biz.domain.TypeTreeNode">
SELECT
type_id AS typeId,
SUM(IFNULL(num, 0 )) AS num
FROM
clz_slt_agreement_info
WHERE
STATUS = '0'
AND (source = 1 OR source is NULL)
AND type_id = #{type.typeId}
AND agreement_id in
<foreach item="agreement" collection="agreementIds" open="(" separator="," close=")">
#{agreement.agreementId}
</foreach>
GROUP BY
type_id
HAVING
num > 0
LIMIT 1
</select>
<select id="getInfoList" resultType="com.bonus.material.basic.domain.BmAgreementInfo">
SELECT
bai.unit_id as unitId,
bai.project_id as projectId,
bu.type_id as typeId
FROM
bm_agreement_info bai
LEFT JOIN bm_unit bu ON bai.unit_id = bu.unit_id
WHERE
bai.agreement_id = #{agreementId}
LIMIT 1
</select>
</mapper>

View File

@ -109,7 +109,8 @@
bpl1.pro_id AS leaseProId,
bpl1.pro_name AS leaseProName,
GROUP_CONCAT(DISTINCT mt2.type_name) as typeName,
IFNULL(swr.workflow_status,2) as status
IFNULL(swr.workflow_status,2) as status,
dai.business_code as businessCode
FROM
direct_apply_info dai
LEFT JOIN bm_agreement_info bai ON dai.back_agreement_id = bai.agreement_id
@ -149,7 +150,8 @@
INSTR(a.backUnitName,#{keyWord}) > 0 OR
INSTR(a.backProName,#{keyWord}) > 0 OR
INSTR(a.leaseUnitName,#{keyWord}) > 0 OR
INSTR(a.leaseProName,#{keyWord}) > 0
INSTR(a.leaseProName,#{keyWord}) > 0 OR
INSTR(a.businessCode,#{keyWord}) > 0
)
</if>
@ -179,7 +181,8 @@
dai.dir_url AS dirUrl,
dai.`status`,
bpl.external_id AS backExternalId,
bpl1.external_id AS leaseExternalId
bpl1.external_id AS leaseExternalId,
dai.business_code AS businessCode
FROM
direct_apply_info dai
LEFT JOIN direct_apply_details dad ON dai.id = dad.direct_id
@ -439,4 +442,18 @@
WHERE
agreement_id = #{agreementId}
</select>
<select id="getCodeList" resultType="com.bonus.material.ma.domain.DirectApplyInfo">
SELECT
lai.`code` as businessCode
FROM
lease_apply_info lai
LEFT JOIN tm_task tt ON lai.task_id = tt.task_id
WHERE
tt.task_type = 19
GROUP BY
lai.`code`
ORDER BY
lai.create_time DESC
</select>
</mapper>

View File

@ -256,6 +256,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="manageType != null and manageType!=''">
and manage_type=#{manageType}
</if>
GROUP BY type_name
</select>
<insert id="insertMachine" parameterType="com.bonus.material.ma.domain.Machine" useGeneratedKeys="true" keyProperty="maId">

View File

@ -47,6 +47,9 @@
<if test="createBy != null">
create_by,
</if>
<if test="businessCode != null and businessCode != ''">
business_code,
</if>
create_time
) values (
<if test="code != null and code != ''">
@ -91,6 +94,9 @@
<if test="createBy != null">
#{createBy},
</if>
<if test="businessCode != null and businessCode != ''">
#{businessCode},
</if>
NOW()
)
</insert>

View File

@ -1377,6 +1377,23 @@
<if test="impUnitName != null and impUnitName != ''">
AND sd.dept_name = #{impUnitName}
</if>
<if test="typeName != null and typeName != ''">
AND mt1.type_name = #{typeName}
</if>
<if test="modelName != null and modelName != ''">
AND mt.type_name = #{modelName}
</if>
<if test="keyWord != null and keyWord != ''">
AND (
bai.agreement_code like concat('%',#{keyWord},'%')
OR bp.pro_name like concat('%',#{keyWord},'%')
OR mt1.type_name like concat('%',#{keyWord},'%')
OR mt.type_name like concat('%',#{keyWord},'%')
OR mt.unit_name like concat('%',#{keyWord},'%')
OR ifnull(sad.unit_name ,bui.unit_name) like concat('%',#{keyWord},'%')
OR sd.dept_name like concat('%',#{keyWord},'%')
)
</if>
</where>
) res