This commit is contained in:
mashuai 2025-07-23 18:56:14 +08:00
parent ffca789f74
commit 6e0e6a656b
14 changed files with 184 additions and 9 deletions

View File

@ -441,4 +441,17 @@ public class ComplexQueryController extends BaseController {
ExcelUtil<MaTypeSelectInfo> util = new ExcelUtil<>(MaTypeSelectInfo.class); ExcelUtil<MaTypeSelectInfo> util = new ExcelUtil<>(MaTypeSelectInfo.class);
util.exportExcel(response, list, "修试查询--导出一机一档案查询"); util.exportExcel(response, list, "修试查询--导出一机一档案查询");
} }
/**
* 机具库存个人查询
* @param bean
* @return
*/
@ApiOperation(value = "综合查询--机具库存个人查询")
@GetMapping("/getPersonNum")
public AjaxResult getPersonNum(RetainedEquipmentInfo bean) {
startPage();
List<RetainedEquipmentInfo> pageList = complexQueryService.getPersonNum(bean);
return AjaxResult.success(getDataTable(pageList));
}
} }

View File

@ -152,4 +152,11 @@ public interface ComplexQueryMapper {
* @return * @return
*/ */
List<Long> selectTypeIdList(Long userId); List<Long> selectTypeIdList(Long userId);
/**
* 查询个人数量
* @param bean
* @return
*/
List<RetainedEquipmentInfo> getPersonNum(RetainedEquipmentInfo bean);
} }

View File

@ -109,4 +109,11 @@ public interface ComplexQueryService {
* @return * @return
*/ */
List<MaTypeSelectInfo> getMaTypeSelectList(MaTypeSelectInfo bean); List<MaTypeSelectInfo> getMaTypeSelectList(MaTypeSelectInfo bean);
/**
* 机具库存个人查询
* @param bean
* @return
*/
List<RetainedEquipmentInfo> getPersonNum(RetainedEquipmentInfo bean);
} }

View File

@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.nacos.common.utils.CollectionUtils; import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.common.utils.StringUtils; import com.alibaba.nacos.common.utils.StringUtils;
import com.bonus.common.biz.enums.MaTypeManageTypeEnum; import com.bonus.common.biz.enums.MaTypeManageTypeEnum;
import com.bonus.common.security.utils.SecurityUtils;
import com.bonus.material.basic.domain.*; import com.bonus.material.basic.domain.*;
import com.bonus.material.basic.domain.vo.MaTypeSelectInfo; import com.bonus.material.basic.domain.vo.MaTypeSelectInfo;
import com.bonus.material.basic.mapper.ComplexQueryMapper; import com.bonus.material.basic.mapper.ComplexQueryMapper;
@ -597,4 +598,16 @@ public class ComplexQueryServiceImpl implements ComplexQueryService {
} }
return list; return list;
} }
/**
* 机具库存个人查询
* @param bean
* @return
*/
@Override
public List<RetainedEquipmentInfo> getPersonNum(RetainedEquipmentInfo bean) {
Long userId = SecurityUtils.getLoginUser().getUserid();
bean.setUserId(userId);
return complexQueryMapper.getPersonNum(bean);
}
} }

View File

@ -162,4 +162,17 @@ public interface LeaseApplyDetailsMapper {
*/ */
int deletePublishTask(LeaseOutDetails leaseOutDetails); int deletePublishTask(LeaseOutDetails leaseOutDetails);
/**
* 领用修改lease_apply_details
* @param record
* @return
*/
int updateLeaseApplyPublishDetailsOutNum(@Param("record") LeaseOutDetails record);
/**
* 获取领用任务详细
* @param record
* @return
*/
LeaseApplyDetails getLeasePublishApplyDetails(@Param("record") LeaseOutDetails record);
} }

View File

@ -517,9 +517,17 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
private int insertRecords(LeaseOutDetails record) { private int insertRecords(LeaseOutDetails record) {
int res = 0; int res = 0;
LeaseApplyDetails leaseApplyDetails = new LeaseApplyDetails();
// 首先更新领料任务详情表的领料数及状态lease_apply_details // 首先更新领料任务详情表的领料数及状态lease_apply_details
res = leaseApplyDetailsMapper.updateLeaseApplyDetailsOutNum(record); if (StringUtils.isNotBlank(record.getPublishTask())) {
LeaseApplyDetails leaseApplyDetails = leaseApplyDetailsMapper.getLeaseApplyDetails(record); // 领用
res = leaseApplyDetailsMapper.updateLeaseApplyPublishDetailsOutNum(record);
leaseApplyDetails = leaseApplyDetailsMapper.getLeasePublishApplyDetails(record);
} else {
// 领料办理
res = leaseApplyDetailsMapper.updateLeaseApplyDetailsOutNum(record);
leaseApplyDetails = leaseApplyDetailsMapper.getLeaseApplyDetails(record);
}
if (leaseApplyDetails.getPreNum().equals(leaseApplyDetails.getAlNum()) || leaseApplyDetails.getAuditNum().equals(leaseApplyDetails.getAlNum())) { if (leaseApplyDetails.getPreNum().equals(leaseApplyDetails.getAlNum()) || leaseApplyDetails.getAuditNum().equals(leaseApplyDetails.getAlNum())) {
leaseApplyDetailsMapper.updateLeaseApplyDetailsByLeaseOutRecord(record); leaseApplyDetailsMapper.updateLeaseApplyDetailsByLeaseOutRecord(record);
} }

View File

@ -909,7 +909,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
return AjaxResult.error("参数不能为空"); return AjaxResult.error("参数不能为空");
} }
// 根据taskId修改任务状态为终结 // 根据taskId修改任务状态为终结
int result = tmTaskMapper.updateTaskStatus(String.valueOf(leaseApplyInfo.getTaskId()), LeaseTaskStatusEnum.LEASE_TASK_TO_AUDIT.getStatus()); int result = tmTaskMapper.updateTaskStatus(String.valueOf(leaseApplyInfo.getTaskId()), 4);
if (result == 0) { if (result == 0) {
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg()); return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
} }

View File

@ -42,4 +42,7 @@ public class MachineVo extends Machine {
@ApiModelProperty("状态名称") @ApiModelProperty("状态名称")
private String statusName; private String statusName;
@ApiModelProperty("机具类型1机具2安全工器具")
private int jiJuType;
} }

View File

@ -1013,6 +1013,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTypeIdList" resultType="java.lang.Long"> <select id="selectTypeIdList" resultType="java.lang.Long">
select select
DISTINCT
type_id type_id
from from
ma_type_manage ma_type_manage

View File

@ -470,8 +470,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt3 ON mt3.type_id = mt2.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 LEFT JOIN ma_type mt4 ON mt4.type_id = mt3.parent_id
LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id LEFT JOIN ma_type_manage mtm ON mt4.type_id = mtm.type_id
WHERE mt.`level` = 4 WHERE mt.del_flag = '0'
and mt.del_flag = '0'
<if test="userId != null "> <if test="userId != null ">
and mtm.user_id = #{userId} and mtm.user_id = #{userId}
</if> </if>
@ -1066,6 +1065,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTypeIdList" resultType="java.lang.Long"> <select id="selectTypeIdList" resultType="java.lang.Long">
select select
DISTINCT
type_id type_id
from from
ma_type_manage ma_type_manage
@ -1073,4 +1073,86 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
user_id = #{userId} user_id = #{userId}
</select> </select>
<select id="getPersonNum" resultType="com.bonus.material.basic.domain.RetainedEquipmentInfo">
SELECT
mt.type_id AS typeId,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
mt.unit_name AS unit,
CASE mt.manage_type
WHEN 0 THEN
IFNULL(subquery0.num, 0)
ELSE
IFNULL(mt.storage_num, 0)
END AS storeNum,
IFNULL(subquery1.usNum, 0) AS usNum,
CASE mt.manage_type
WHEN 0 THEN
'编码'
ELSE
'数量'
END manageType
FROM ma_type mt
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
count(mm.ma_id) AS num
FROM ma_machine mm
LEFT JOIN ma_type mt ON mt.type_id = mm.type_id
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
WHERE mm.ma_code is not null and mm.ma_status in (1)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
LEFT JOIN (
SELECT
mt.type_id,
mt2.type_name AS typeName,
mt2.type_id AS thirdTypeId,
mt.type_name AS typeModelName,
SUM(IFNULL( sai.num, 0 )) AS usNum
FROM
slt_agreement_info sai
LEFT JOIN ma_type mt ON mt.type_id = sai.type_id
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
WHERE
sai.`status` = '0' and sai.`is_slt` = '0'
AND sai.end_time IS NULL
AND sai.back_id IS NULL
GROUP BY mt.type_id
) AS subquery1
ON mt.type_id = subquery1.type_id
LEFT JOIN ma_type mt2 on mt2.type_id = mt.parent_id
<if test="userId != null">
JOIN ma_type_keeper mtk ON mtk.type_id = mt.type_id AND mtk.user_id = #{userId}
</if>
WHERE mt.del_flag = '0'
<if test="typeId != null">
<if test="level == 3">
and mt.parent_id = #{typeId}
</if>
<if test="level == 2">
and mt2.parent_id = #{typeId}
</if>
</if>
<if test="keyWord != null and keyWord != ''">
and (
mt2.type_name like concat('%',#{keyWord},'%') or
mt.type_name like concat('%',#{keyWord},'%')
)
</if>
<if test="typeName != null and typeName != ''">
and mt2.type_name like concat('%',#{typeName},'%')
</if>
<if test="typeModelName != null and typeModelName != ''">
and mt.type_name like concat('%',#{typeModelName},'%')
</if>
</select>
</mapper> </mapper>

View File

@ -243,6 +243,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
parent_id = #{parentId} and type_id = #{typeId} parent_id = #{parentId} and type_id = #{typeId}
</update> </update>
<update id="updateLeaseApplyPublishDetailsOutNum">
UPDATE
lease_apply_details
SET
al_num = IF(al_num IS NULL, #{record.outNum}, al_num + #{record.outNum}),
<if test="record.updateBy != null and record.updateBy!= '' ">
update_by = #{record.updateBy},
</if>
update_time = now(),
status = '1'
WHERE
parent_id = #{record.parentId} and new_type = #{record.typeId}
</update>
<select id="getOutboundNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails"> <select id="getOutboundNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
SELECT id, parent_id as parentId, type_id as typeId, pre_num as preNum, al_num as alNum, `status`, remark SELECT id, parent_id as parentId, type_id as typeId, pre_num as preNum, al_num as alNum, `status`, remark
FROM lease_apply_details FROM lease_apply_details
@ -475,7 +489,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE mm.ma_code is not null WHERE mm.ma_code is not null
and mm.ma_status in (1) and mm.ma_status in (1)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
LEFT JOIN lease_out_details lod ON lpd.type_id = lod.type_id LEFT JOIN lease_out_details lod ON lpd.new_type = lod.type_id
AND lpd.publish_task = lod.publish_task AND lpd.publish_task = lod.publish_task
LEFT JOIN (SELECT id, parent_id, type_id from lease_apply_details GROUP BY parent_id, type_id) a LEFT JOIN (SELECT id, parent_id, type_id from lease_apply_details GROUP BY parent_id, type_id) a
on lpd.parent_id = a.parent_id and a.type_id = lpd.type_id on lpd.parent_id = a.parent_id and a.type_id = lpd.type_id
@ -572,4 +586,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
lod.create_time DESC lod.create_time DESC
</select> </select>
<select id="getLeasePublishApplyDetails" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
SELECT
ifnull( pre_num, 0 ) AS preNum,
ifnull( audit_num, 0 ) AS auditNum,
ifnull( al_num, 0 ) AS alNum
FROM
lease_apply_details
WHERE
parent_id = #{record.parentId}
AND new_type = #{record.typeId}
</select>
</mapper> </mapper>

View File

@ -695,6 +695,7 @@
update lease_apply_details update lease_apply_details
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="num != null">publish_num = IFNULL(publish_num, 0) + #{num},</if> <if test="num != null">publish_num = IFNULL(publish_num, 0) + #{num},</if>
<if test="newTypeId != null">new_type = #{newTypeId},</if>
</trim> </trim>
where parent_id = #{parentId} and type_id = #{typeId} where parent_id = #{parentId} and type_id = #{typeId}
</update> </update>
@ -791,7 +792,7 @@
case tt.task_status case tt.task_status
when 1 then '未完成' when 1 then '未完成'
when 2 then '已终止' when 4 then '已终止'
when 3 then '已完成' when 3 then '已完成'
end as taskStatusName, end as taskStatusName,
IFNULL(sum(lad.pre_num),0) as preCountNum, IFNULL(sum(lad.pre_num),0) as preCountNum,
@ -818,7 +819,7 @@
JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId} JOIN ma_type_keeper mtk ON mtk.type_id = lad.type_id AND mtk.user_id = #{userId}
</if> </if>
where tt.task_type = '19' where tt.task_type = '19'
and tt.task_status in (1, 2, 3) and tt.task_status in (1, 3, 4)
<if test="taskStatus != null and taskStatus != ''"> <if test="taskStatus != null and taskStatus != ''">
and tt.task_status = #{taskStatus} and tt.task_status = #{taskStatus}
</if> </if>

View File

@ -75,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ma.inspect_man as inspectMan, ma.inspect_man as inspectMan,
ma.inspect_status as inspectStatus, ma.inspect_status as inspectStatus,
ma.phone as phone, ma.phone as phone,
mt.jiju_type as jijuType,
CASE CASE
WHEN RIGHT(ma.ma_code, 4) REGEXP '^[0-9]{4}$' THEN CAST(RIGHT(ma.ma_code, 4) AS UNSIGNED) WHEN RIGHT(ma.ma_code, 4) REGEXP '^[0-9]{4}$' THEN CAST(RIGHT(ma.ma_code, 4) AS UNSIGNED)
WHEN RIGHT(ma.ma_code, 3) REGEXP '^[0-9]{3}$' THEN CAST(RIGHT(ma.ma_code, 3) AS UNSIGNED) WHEN RIGHT(ma.ma_code, 3) REGEXP '^[0-9]{3}$' THEN CAST(RIGHT(ma.ma_code, 3) AS UNSIGNED)

View File

@ -74,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTypeKeeperListAndUserName" resultMap="TypeKeeperResult"> <select id="selectTypeKeeperListAndUserName" resultMap="TypeKeeperResult">
select select
tk.ID, tk.type_id, tk.user_id, tk.create_time, tk.update_time, tk.company_id, u.user_name tk.ID, tk.type_id, tk.user_id, tk.create_time, tk.update_time, tk.company_id, u.nick_name as user_name
from from
ma_type_keeper tk ma_type_keeper tk
left join left join