feat(lease): 新增领用发布驳回功能并优化相关逻辑
- 新增领用发布驳回接口和相关服务方法 - 实现驳回时减少已发布数量和删除发布详情的功能 - 优化工程机具领用导出中的SQL逻辑,避免重复计算
This commit is contained in:
parent
344bbfaad0
commit
25d102c90a
|
|
@ -210,6 +210,15 @@ public class LeaseTaskController extends BaseController {
|
||||||
return service.addPublish(leaseApplyRequestVo);
|
return service.addPublish(leaseApplyRequestVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领用发布驳回
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "领用发布驳回")
|
||||||
|
@PostMapping("/leasePublishReject")
|
||||||
|
public AjaxResult leasePublishReject(@RequestBody LeaseApplyDetails leaseApplyDetails) {
|
||||||
|
return service.leasePublishReject(leaseApplyDetails);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领用发布终结
|
* 领用发布终结
|
||||||
* @param leaseApplyInfo
|
* @param leaseApplyInfo
|
||||||
|
|
|
||||||
|
|
@ -130,12 +130,26 @@ public interface LeaseTaskMapper {
|
||||||
int addPublish(LeaseApplyDetails applyDetails);
|
int addPublish(LeaseApplyDetails applyDetails);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领用申请发布详情修改
|
* 领用申请发布详情修改 -- 增加发布数量
|
||||||
* @param applyDetails
|
* @param applyDetails
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
int updatePublish(LeaseApplyDetails applyDetails);
|
int updatePublish(LeaseApplyDetails applyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领用申请发布详情修改 -- 减少发布数量
|
||||||
|
* @param applyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int updatePublishSub(LeaseApplyDetails applyDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领用申请发布详情删除
|
||||||
|
* @param applyDetails
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int deletePublishDetails(LeaseApplyDetails applyDetails);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据当前年月查询最大序号
|
* 根据当前年月查询最大序号
|
||||||
* @param year
|
* @param year
|
||||||
|
|
|
||||||
|
|
@ -116,6 +116,13 @@ public interface ILeaseTaskService {
|
||||||
*/
|
*/
|
||||||
AjaxResult addPublish(LeaseApplyRequestVo leaseApplyRequestVo);
|
AjaxResult addPublish(LeaseApplyRequestVo leaseApplyRequestVo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领用发布驳回
|
||||||
|
* @param leaseApplyRequestVo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult leasePublishReject(LeaseApplyDetails leaseApplyRequestVo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 领用发布终结
|
* 领用发布终结
|
||||||
* @param leaseApplyInfo
|
* @param leaseApplyInfo
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
record.setOutNum(record.getInputNum());
|
record.setOutNum(record.getInputNum());
|
||||||
record.setOutType(InputOutEnum.NUMBER_DEVICE.getTypeId());
|
record.setOutType(InputOutEnum.NUMBER_DEVICE.getTypeId());
|
||||||
}
|
}
|
||||||
|
// 检查库存数量是否足够
|
||||||
res = checkStorageNum(record);
|
res = checkStorageNum(record);
|
||||||
|
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
|
|
|
||||||
|
|
@ -834,6 +834,32 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 领用发布驳回
|
||||||
|
*
|
||||||
|
* @param leaseApplyDetails 领用任务详情
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult leasePublishReject(LeaseApplyDetails leaseApplyDetails) {
|
||||||
|
if (leaseApplyDetails == null) {
|
||||||
|
return AjaxResult.error("参数不能为空");
|
||||||
|
}
|
||||||
|
// 根据parentId及typeId更新lease_apply_details表的发布数量
|
||||||
|
int result = mapper.updatePublishSub(leaseApplyDetails);
|
||||||
|
if (result == 0) {
|
||||||
|
return AjaxResult.error("发布驳回失败,请联系管理员");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据parentId及typeId更新lease_apply_details表的发布数量
|
||||||
|
int details = mapper.deletePublishDetails(leaseApplyDetails);
|
||||||
|
if (details == 0) {
|
||||||
|
throw new ServiceException("发布驳回详情删除失败,请联系管理员");
|
||||||
|
}
|
||||||
|
return AjaxResult.success("驳回成功");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布数据保存
|
* 发布数据保存
|
||||||
* @param leaseApplyRequestVo
|
* @param leaseApplyRequestVo
|
||||||
|
|
@ -898,6 +924,7 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结束发布
|
* 结束发布
|
||||||
* @param leaseApplyInfo
|
* @param leaseApplyInfo
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
|
||||||
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
|
||||||
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
LEFT JOIN ma_type mt4 ON mt3.parent_id = mt4.type_id
|
||||||
LEFT JOIN ma_type_manage mtm ON mt3.parent_id = mtm.type_id
|
-- 关键点:提前对 user_id 的 type_id 做去重
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT DISTINCT type_id
|
||||||
|
FROM ma_type_manage
|
||||||
|
<if test="userId != null">
|
||||||
|
WHERE user_id = #{userId}
|
||||||
|
</if>
|
||||||
|
) mtm ON mt3.parent_id = mtm.type_id
|
||||||
WHERE
|
WHERE
|
||||||
1=1
|
1=1
|
||||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||||
|
|
@ -55,9 +62,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
sd.dept_name like concat('%', #{keyWord}, '%')
|
sd.dept_name like concat('%', #{keyWord}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
<if test="userId != null">
|
|
||||||
and mtm.user_id = #{userId}
|
|
||||||
</if>
|
|
||||||
|
|
||||||
<if test="unitId != null">
|
<if test="unitId != null">
|
||||||
and bu.unit_id = #{unitId}
|
and bu.unit_id = #{unitId}
|
||||||
|
|
|
||||||
|
|
@ -700,6 +700,16 @@
|
||||||
where parent_id = #{parentId} and type_id = #{typeId}
|
where parent_id = #{parentId} and type_id = #{typeId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<update id="updatePublishSub">
|
||||||
|
update
|
||||||
|
lease_apply_details
|
||||||
|
set
|
||||||
|
publish_num = IFNULL(publish_num, 0) - #{num}
|
||||||
|
where
|
||||||
|
parent_id = #{parentId}
|
||||||
|
and type_id = #{typeId}
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="getApplyInfo" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
<select id="getApplyInfo" resultType="com.bonus.common.biz.domain.lease.LeaseApplyInfo">
|
||||||
select
|
select
|
||||||
lai.code as code,lai.lease_person as leasePerson,lai.phone as phone,lai.create_by as createBy,
|
lai.code as code,lai.lease_person as leasePerson,lai.phone as phone,lai.create_by as createBy,
|
||||||
|
|
@ -809,8 +819,7 @@
|
||||||
left join bm_unit bu on bu.unit_id = lai.unit_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 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_dept sd on sd.dept_id = bp.imp_unit
|
||||||
left join sys_dict_data sda on tt.task_status = sda.dict_value
|
left join sys_dict_data sda on tt.task_status = sda.dict_value and sda.dict_type = 'lease_task_status'
|
||||||
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 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 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 mt2 ON mt1.parent_id = mt2.type_id and mt2.del_flag = '0'
|
||||||
|
|
@ -818,7 +827,8 @@
|
||||||
<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}
|
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, 3, 4)
|
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}
|
||||||
|
|
@ -1011,4 +1021,14 @@
|
||||||
limit 1
|
limit 1
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<delete id="deletePublishDetails">
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
lease_publish_details
|
||||||
|
WHERE
|
||||||
|
parent_id = #{parentId}
|
||||||
|
and type_id = #{typeId}
|
||||||
|
and publish_task = #{publishTask}
|
||||||
|
</delete>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
spring.datasource.platform=mysql
|
spring.datasource.platform=mysql
|
||||||
db.num=1
|
db.num=1
|
||||||
db.url.0=jdbc:mysql://bonus-mysql:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
|
db.url.0=jdbc:mysql://bonus-mysql:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=30000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
|
||||||
db.user=root
|
db.user=root
|
||||||
#db.password=password
|
#db.password=password
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue