This commit is contained in:
mashuai 2025-07-23 09:04:57 +08:00
parent 48f78938fb
commit cceb802448
14 changed files with 101 additions and 32 deletions

View File

@ -9,6 +9,7 @@ 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;
@ -345,6 +346,12 @@ public class BackApplyInfoServiceImpl implements IBackApplyInfoService {
if (CollectionUtils.isNotEmpty(infos)) {
list.addAll(infos);
}
if (CollectionUtils.isNotEmpty( list)) {
list = list.stream()
.sorted(Comparator.comparing(BackApplyInfo::getCreateTime,
Comparator.nullsFirst(Comparator.naturalOrder())).reversed())
.collect(Collectors.toList());
}
// 提取关键字
String keyWord = backApplyInfo.getKeyWord();
// 如果关键字不为空进行过滤

View File

@ -189,7 +189,7 @@ public class LeaseApplyInfoController extends BaseController {
//@RequiresPermissions("lease:info:query")
@GetMapping(value = "/getInfo")
public AjaxResult getInfo(LeaseApplyInfo leaseApplyInfo) {
return success(leaseApplyInfoService.getInfo(leaseApplyInfo.getId()));
return success(leaseApplyInfoService.getInfo(leaseApplyInfo));
}
@ApiOperation(value = "导出领料出库单详情")
@ -197,7 +197,7 @@ public class LeaseApplyInfoController extends BaseController {
@SysLog(title = "领料任务", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出领料任务详情")
@PostMapping("/exportInfo")
public void exportInfo(HttpServletResponse response, LeaseApplyInfo leaseApplyInfo) {
LeaseApplyRequestVo leaseApplyRequestVo = leaseApplyInfoService.getInfo(leaseApplyInfo.getId());
LeaseApplyRequestVo leaseApplyRequestVo = leaseApplyInfoService.getInfo(leaseApplyInfo);
leaseApplyInfoService.exportInfo(leaseApplyInfo, leaseApplyRequestVo, response);
}

View File

@ -101,11 +101,10 @@ public interface LeaseApplyDetailsMapper {
/**
* 获取领料出库单详情
* @param id
* @param userId
* @param leaseApplyInfo
* @return
*/
List<LeaseOutVo> selectLeaseOutDetailsList(@Param("id") Long id, @Param("userId") Long userId);
List<LeaseOutVo> selectLeaseOutDetailsList(LeaseApplyInfo leaseApplyInfo);
/**
* 根据领料任务id查询领料任务详细
@ -137,12 +136,10 @@ public interface LeaseApplyDetailsMapper {
/**
* 根据领料任务id查询领料任务详细
* @param keyWord
* @param publishTask
* @param leaseApplyInfo
* @return
*/
List<LeaseApplyDetails> getDetailsPublish(@Param("keyWord") String keyWord, @Param("publishTask") String publishTask,
@Param("list") List<Long> typeIdList);
List<LeaseApplyDetails> getDetailsPublish(LeaseApplyInfo leaseApplyInfo);
/**
* 根据领料任务id查询领料任务详细

View File

@ -148,4 +148,11 @@ public interface LeaseApplyInfoMapper {
* @return
*/
List<LeaseOutSign> selectOutList(@Param("id") Long id, @Param("leaseSignId") String leaseSignId);
/**
* 查询领用单的领用单出库签名
* @param leaseApplyInfo
* @return
*/
LeaseApplyInfo selectLeaseApplyInfoPublishList(LeaseApplyInfo leaseApplyInfo);
}

View File

@ -124,10 +124,10 @@ public interface ILeaseApplyInfoService {
/**
* 获取领料任务详情
* @param id
* @param leaseApplyInfo
* @return
*/
LeaseApplyRequestVo getInfo(Long id);
LeaseApplyRequestVo getInfo(LeaseApplyInfo leaseApplyInfo);
/**
* 导出领料出库详细

View File

@ -95,6 +95,12 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
} else {
leaseApplyInfo.setUserId(userId);
}
if (StringUtils.isNotBlank(keyword)) {
leaseApplyInfo.setKeyWord(keyword);
}
if (StringUtils.isNotBlank(publishTask)) {
leaseApplyInfo.setPublishTask(publishTask);
}
Optional<LeaseApplyInfo> optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo));
LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo();
// 查询领用出库数据
@ -149,7 +155,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
// 走单独的领用详情查询
if (StringUtils.isNotBlank(publishTask)) {
// 根据领用批次查询领用详情
details = leaseApplyDetailsMapper.getDetailsPublish(keyword, publishTask, typeIdList);
details = leaseApplyDetailsMapper.getDetailsPublish(leaseApplyInfo);
if (!CollectionUtils.isEmpty(details)) {
for (LeaseApplyDetails detail : details) {
if (detail.getPreNum().compareTo(detail.getAlNum()) == 0) {
@ -161,11 +167,6 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
}
}
if (!CollectionUtils.isEmpty(details)) {
/*if (StringUtils.isNotBlank(keyword)) {
details = details.stream()
.filter(item -> containsDetailsKeyword(item, keyword))
.collect(Collectors.toList());
}*/
leaseApplyRequestVo.setLeaseApplyDetailsList(details);
for (LeaseApplyDetails detail : details) {
// 获取编码详情
@ -203,7 +204,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
} catch (Exception e) {
// 记录异常日志
System.err.println("Error occurred while selecting lease apply info by ID: " + id + e.getMessage());
throw new RuntimeException("Failed to select lease apply info", e);
throw new RuntimeException("查询失败,请联系管理员");
}
}
@ -1037,18 +1038,26 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
}
@Override
public LeaseApplyRequestVo getInfo(Long id) {
public LeaseApplyRequestVo getInfo(LeaseApplyInfo leaseApplyInfo) {
try {
LeaseApplyInfo leaseApplyInfo = new LeaseApplyInfo();
leaseApplyInfo.setId(id);
Long userId = SecurityUtils.getLoginUser().getUserid();
// 首先根据用户名去ma_type_manage表查询是否存在绑定物资信息
List<Long> typeIdList = leaseApplyInfoMapper.selectTypeIdList(userId);
if (!CollectionUtils.isEmpty(typeIdList)) {
leaseApplyInfo.setTypeIdList(typeIdList);
} else {
leaseApplyInfo.setUserId(userId);
}
Optional<LeaseApplyInfo> optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoById(leaseApplyInfo));
if (StringUtils.isNotBlank(leaseApplyInfo.getPublishTask())) {
optionalInfo = Optional.ofNullable(leaseApplyInfoMapper.selectLeaseApplyInfoPublishList(leaseApplyInfo));
}
LeaseApplyRequestVo leaseApplyRequestVo = new LeaseApplyRequestVo();
optionalInfo.ifPresent(info -> {
leaseApplyRequestVo.setLeaseApplyInfo(info);
// 获取领料单详情
List<LeaseOutVo> details = leaseApplyDetailsMapper.selectLeaseOutDetailsList(id, userId);
List<LeaseOutVo> details = leaseApplyDetailsMapper.selectLeaseOutDetailsList(leaseApplyInfo);
if (!CollectionUtils.isEmpty(details)) {
leaseApplyRequestVo.setLeaseOutVoList(details);
}
@ -1056,7 +1065,7 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
return leaseApplyRequestVo;
} catch (Exception e) {
// 记录异常日志
System.err.println("Error occurred while selecting lease apply info by ID: " + id + e.getMessage());
System.err.println("Error occurred while selecting lease apply info by ID: " + leaseApplyInfo.getId() + ", " + e.getMessage());
throw new RuntimeException("Failed to select lease apply info", e);
}
}

View File

@ -446,9 +446,11 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
int res = 0;
// 领用任务单独判断
if (StringUtils.isNotBlank(record.getPublishTask())) {
LeaseApplyInfo applyInfo = new LeaseApplyInfo();
applyInfo.setPublishTask(record.getPublishTask());
// 根据领用批次查询领用详情
boolean isFinished = true;
List<LeaseApplyDetails> details = leaseApplyDetailsMapper.getDetailsPublish(null, record.getPublishTask(), null);
List<LeaseApplyDetails> details = leaseApplyDetailsMapper.getDetailsPublish(applyInfo);
if (!CollectionUtils.isEmpty(details)) {
for (LeaseApplyDetails bean : details) {
if (bean.getAlNum().compareTo(bean.getPreNum()) != 0) {

View File

@ -43,4 +43,6 @@ public class MaTypeVo extends Type {
@ApiModelProperty(value = "是否显示绑定关系")
private Boolean displayBindRelationship;
private String keyword;
}

View File

@ -156,7 +156,7 @@ public class RepairTask {
* 维修人员
*/
@ApiModelProperty(value = "维修人员")
@Excel(name = "维修班组",sort = 15)
//@Excel(name = "维修班组",sort = 15)
private String repairer;
/**
* 维修时间

View File

@ -42,7 +42,7 @@ public class ScrapApplyDetailsVO {
* 维修班组名称
*/
@Excel(name = "维修班组",sort = 6)
@ApiModelProperty(value = "维修班组")
//@ApiModelProperty(value = "维修班组")
private String teamName;
/**

View File

@ -327,14 +327,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lease_out_details lod
LEFT JOIN ma_type mt ON lod.type_id = mt.type_id AND mt.del_flag = '0'
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0'
LEFT JOIN ma_type mt3 ON mt1.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 ma_machine mm ON lod.ma_id = mm.ma_id
LEFT JOIN lease_apply_details lad ON lod.type_id = lad.type_id AND lad.parent_id = #{id}
# LEFT JOIN purchase_check_details pcd ON lod.type_id = pcd.type_id
<if test="userId != null">
JOIN ma_type_keeper mtk ON mtk.type_id = lod.type_id AND mtk.user_id = #{userId}
</if>
WHERE lod.parent_id = #{id}
GROUP BY lod.type_id, mm.ma_code
<if test="typeIdList != null and typeIdList.size() > 0">
and mt4.type_id in
<foreach item="item" collection="typeIdList" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY lod.type_id, mm.ma_id
</select>
<select id="getInnerById" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
@ -426,7 +433,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN lease_apply_details lad ON lod.type_id = lad.type_id
LEFT JOIN purchase_check_details pcd ON lod.type_id = pcd.type_id
WHERE lod.ma_id = #{maId}
GROUP BY lod.type_id, mm.ma_code
GROUP BY lod.type_id, mm.ma_id
ORDER BY lod.create_time DESC
</select>

View File

@ -568,6 +568,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTypeIdList" resultType="java.lang.Long">
select
DISTINCT
type_id
from
ma_type_manage
@ -590,6 +591,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lod.lease_sign_id
</select>
<select id="selectLeaseApplyInfoPublishList" parameterType="Long" resultMap="LeaseApplyInfoResult">
select
lai.id, lai.code, lai.task_id, lai.lease_person, 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,
bu.unit_name, bp.pro_name, tt.task_status as taskStatus,
sda.dict_label as taskStatusName,
IFNULL(sum(lad.pre_num),0) as preCountNum,
IFNULL(sum(lad.al_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
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 bm_unit bu on bu.unit_id = lai.unit_id
left join bm_project bp on bp.pro_id = lai.project_id
left join sys_dept sd on sd.dept_id = bp.imp_unit
left join sys_dict_data sda on tt.task_status = sda.dict_value
and sda.dict_type = 'lease_task_status'
left join ma_type mt on lad.type_id = mt.type_id and mt.del_flag = '0'
left join ma_type mt1 on mt.parent_id = mt1.type_id and mt1.del_flag = '0'
left join ma_type mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0'
left join ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.del_flag = '0'
where lai.id = #{id}
</select>
<update id="confirmLeaseTask">
update
lease_out_details

View File

@ -771,9 +771,9 @@
GROUP BY
mt.type_id
) AS subquery0 ON subquery0.type_id = mt.type_id
<if test="userId != null">
<!--<if test="userId != null">
JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId}
</if>
</if>-->
WHERE
lad.parent_id = #{id}
</select>

View File

@ -123,7 +123,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
and mt.type_id is not null
and mhs.house_id = #{houseId} and mhs.del_flag = 0
<if test="keyword != null and keyword != ''">
and (
mt.type_name like concat('%', #{keyword}, '%')
or su.nick_name like concat('%', #{keyword}, '%')
)
</if>
</where>
</select>