领料出库优化
This commit is contained in:
parent
20dc13b756
commit
949cfd2c9a
|
|
@ -61,4 +61,6 @@ public interface BmAgreementInfoMapper
|
||||||
public int deleteBmAgreementInfoByAgreementIds(Long[] agreementIds);
|
public int deleteBmAgreementInfoByAgreementIds(Long[] agreementIds);
|
||||||
|
|
||||||
public int selectNumByMonth(Date nowDate);
|
public int selectNumByMonth(Date nowDate);
|
||||||
|
|
||||||
|
String getProtocol(String agreementId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,4 +74,6 @@ public interface LeaseApplyDetailsMapper {
|
||||||
LeaseApplyDetails getLeaseApplyDetails(@Param("record") LeaseOutDetails record);
|
LeaseApplyDetails getLeaseApplyDetails(@Param("record") LeaseOutDetails record);
|
||||||
|
|
||||||
int updateLeaseApplyDetailsByLeaseOutRecord(@Param("record") LeaseOutDetails record);
|
int updateLeaseApplyDetailsByLeaseOutRecord(@Param("record") LeaseOutDetails record);
|
||||||
|
|
||||||
|
LeaseApplyDetails getOutboundNum(LeaseOutDetails record);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,4 +57,6 @@ public interface LeaseApplyInfoMapper {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteLeaseApplyInfoByIds(Long[] ids);
|
int deleteLeaseApplyInfoByIds(Long[] ids);
|
||||||
|
|
||||||
|
String getTaskId(Long parentId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public interface LeaseOutDetailsMapper {
|
||||||
* @param leaseOutDetails 领料出库详细
|
* @param leaseOutDetails 领料出库详细
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails);
|
// public int insertLeaseOutDetails(LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改领料出库详细
|
* 修改领料出库详细
|
||||||
|
|
@ -72,25 +72,7 @@ public interface LeaseOutDetailsMapper {
|
||||||
*/
|
*/
|
||||||
public int deleteLeaseOutDetailsByIds(Long[] ids);
|
public int deleteLeaseOutDetailsByIds(Long[] ids);
|
||||||
|
|
||||||
LeaseApplyDetails getOutboundNum(LeaseOutDetails record);
|
|
||||||
|
|
||||||
String getTaskId(Long parentId);
|
|
||||||
|
|
||||||
int updateTaskStatus(@Param("taskId") String taskId, @Param("status")int status);
|
|
||||||
|
|
||||||
/** 插入领料出库详情表 -- 根据字段选择注入 */
|
/** 插入领料出库详情表 -- 根据字段选择注入 */
|
||||||
int insertSelective(LeaseOutDetails record);
|
int insertLeaseOutDetails(LeaseOutDetails record);
|
||||||
|
|
||||||
SltAgreementInfo getSltAgreementInfo(LeaseOutDetails record);
|
|
||||||
|
|
||||||
int updSltInfo(SltAgreementInfo sltAgreementInfo);
|
|
||||||
|
|
||||||
String getAgreementId(String taskId);
|
|
||||||
|
|
||||||
String getProtocol(String agreementId);
|
|
||||||
|
|
||||||
int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId,@Param("ma") Type ma);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package com.bonus.material.lease.service.impl;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.bonus.common.biz.constant.MaterialConstants;
|
import com.bonus.common.biz.constant.MaterialConstants;
|
||||||
import com.bonus.common.biz.enums.LeaseTaskStatusEnum;
|
import com.bonus.common.biz.enums.LeaseTaskStatusEnum;
|
||||||
import com.bonus.common.biz.enums.MaMachineStatusEnum;
|
import com.bonus.common.biz.enums.MaMachineStatusEnum;
|
||||||
|
|
@ -12,13 +11,17 @@ import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.bonus.common.core.utils.DateUtils;
|
import com.bonus.common.core.utils.DateUtils;
|
||||||
import com.bonus.common.core.utils.StringUtils;
|
import com.bonus.common.core.utils.StringUtils;
|
||||||
import com.bonus.common.core.web.domain.AjaxResult;
|
import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
|
import com.bonus.material.basic.mapper.BmAgreementInfoMapper;
|
||||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||||
import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper;
|
import com.bonus.material.lease.mapper.LeaseApplyDetailsMapper;
|
||||||
|
import com.bonus.material.lease.mapper.LeaseApplyInfoMapper;
|
||||||
import com.bonus.material.ma.domain.Type;
|
import com.bonus.material.ma.domain.Type;
|
||||||
import com.bonus.material.ma.mapper.MachineMapper;
|
import com.bonus.material.ma.mapper.MachineMapper;
|
||||||
import com.bonus.material.ma.mapper.TypeMapper;
|
import com.bonus.material.ma.mapper.TypeMapper;
|
||||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||||
import com.bonus.material.task.domain.TmTask;
|
import com.bonus.material.settlement.mapper.SltAgreementInfoMapper;
|
||||||
|
import com.bonus.material.task.mapper.TmTaskAgreementMapper;
|
||||||
|
import com.bonus.material.task.mapper.TmTaskMapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -36,6 +39,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
|
@Autowired
|
||||||
|
LeaseApplyInfoMapper leaseApplyInfoMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private LeaseOutDetailsMapper leaseOutDetailsMapper;
|
private LeaseOutDetailsMapper leaseOutDetailsMapper;
|
||||||
|
|
||||||
|
|
@ -47,6 +53,18 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TypeMapper typeMapper;
|
TypeMapper typeMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TmTaskMapper tmTaskMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SltAgreementInfoMapper sltAgreementInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
BmAgreementInfoMapper bmAgreementInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TmTaskAgreementMapper tmTaskAgreementMapper;
|
||||||
/**
|
/**
|
||||||
* 查询领料出库详细
|
* 查询领料出库详细
|
||||||
*
|
*
|
||||||
|
|
@ -157,7 +175,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
throw new RuntimeException("出库失败,修改任务状态失败");
|
throw new RuntimeException("出库失败,修改任务状态失败");
|
||||||
}
|
}
|
||||||
// 5、插入结算记录
|
// 5、插入结算记录
|
||||||
String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId());
|
String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId());
|
||||||
res = insSltInfo(taskId, record);
|
res = insSltInfo(taskId, record);
|
||||||
if (res == 0) {
|
if (res == 0) {
|
||||||
throw new RuntimeException("出库失败,插入结算记录失败");
|
throw new RuntimeException("出库失败,插入结算记录失败");
|
||||||
|
|
@ -179,7 +197,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
// 判断库存是否足够
|
// 判断库存是否足够
|
||||||
private boolean checkStorageIsEnough(LeaseOutDetails record) {
|
private boolean checkStorageIsEnough(LeaseOutDetails record) {
|
||||||
if (record.getManageType().equals(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId())) {
|
if (record.getManageType().equals(MaTypeManageTypeEnum.NUMBER_DEVICE.getTypeId())) {
|
||||||
LeaseApplyDetails details = leaseOutDetailsMapper.getOutboundNum(record);
|
LeaseApplyDetails details = leaseApplyDetailsMapper.getOutboundNum(record);
|
||||||
if (details == null) {
|
if (details == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -204,12 +222,12 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId());
|
String taskId = leaseApplyInfoMapper.getTaskId(record.getParentId());
|
||||||
if (i == leaseApplyDetailsList.size()) {
|
if (i == leaseApplyDetailsList.size()) {
|
||||||
leaseOutDetailsMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus());
|
tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_FINISHED.getStatus());
|
||||||
res = 1;
|
res = 1;
|
||||||
} else {
|
} else {
|
||||||
leaseOutDetailsMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatus());
|
tmTaskMapper.updateTaskStatus(taskId, LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatus());
|
||||||
res = 1;
|
res = 1;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -251,7 +269,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
}
|
}
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
// 插入领料出库明细表(lease_out_details)
|
// 插入领料出库明细表(lease_out_details)
|
||||||
res = leaseOutDetailsMapper.insertSelective(record);
|
res = leaseOutDetailsMapper.insertLeaseOutDetails(record);
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
// 普通机具减少 (ma_type 设备规格表)的库存数量
|
// 普通机具减少 (ma_type 设备规格表)的库存数量
|
||||||
res = typeMapper.updateMaTypeStockNum(record);
|
res = typeMapper.updateMaTypeStockNum(record);
|
||||||
|
|
@ -264,15 +282,15 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
|
|
||||||
public int insSltInfo(String taskId, LeaseOutDetails record) {
|
public int insSltInfo(String taskId, LeaseOutDetails record) {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
SltAgreementInfo sltAgreementInfo = leaseOutDetailsMapper.getSltAgreementInfo(record);
|
SltAgreementInfo sltAgreementInfo = sltAgreementInfoMapper.getSltAgreementInfo(record);
|
||||||
if (sltAgreementInfo != null) {
|
if (sltAgreementInfo != null) {
|
||||||
Long num = sltAgreementInfo.getNum();
|
Long num = sltAgreementInfo.getNum();
|
||||||
Long outNum = record.getOutNum();
|
Long outNum = record.getOutNum();
|
||||||
sltAgreementInfo.setNum(num + outNum);
|
sltAgreementInfo.setNum(num + outNum);
|
||||||
res = leaseOutDetailsMapper.updSltInfo(sltAgreementInfo);
|
res = sltAgreementInfoMapper.updSltInfo(sltAgreementInfo);
|
||||||
} else {
|
} else {
|
||||||
String agreementId = leaseOutDetailsMapper.getAgreementId(taskId);
|
String agreementId = tmTaskAgreementMapper.getAgreementId(taskId);
|
||||||
String protocol = leaseOutDetailsMapper.getProtocol(agreementId);
|
String protocol = bmAgreementInfoMapper.getProtocol(agreementId);
|
||||||
Type maType = typeMapper.getMaType(record.getTypeId());
|
Type maType = typeMapper.getMaType(record.getTypeId());
|
||||||
if (StringUtils.isEmpty(protocol)) {
|
if (StringUtils.isEmpty(protocol)) {
|
||||||
maType.setFinalPrice(maType.getLeasePrice());
|
maType.setFinalPrice(maType.getLeasePrice());
|
||||||
|
|
@ -285,7 +303,7 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
maType.setFinalPrice(maType.getLeasePrice());
|
maType.setFinalPrice(maType.getLeasePrice());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res = leaseOutDetailsMapper.insSltInfo(record, agreementId, maType);
|
res = sltAgreementInfoMapper.insSltInfo(record, agreementId, maType);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
package com.bonus.material.settlement.mapper;
|
package com.bonus.material.settlement.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.material.lease.domain.LeaseOutDetails;
|
||||||
|
import com.bonus.material.ma.domain.Type;
|
||||||
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算信息Mapper接口
|
* 结算信息Mapper接口
|
||||||
|
|
@ -57,4 +61,10 @@ public interface SltAgreementInfoMapper {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteSltAgreementInfoByIds(Long[] ids);
|
public int deleteSltAgreementInfoByIds(Long[] ids);
|
||||||
|
|
||||||
|
SltAgreementInfo getSltAgreementInfo(LeaseOutDetails record);
|
||||||
|
|
||||||
|
int updSltInfo(SltAgreementInfo sltAgreementInfo);
|
||||||
|
|
||||||
|
int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId, @Param("ma") Type ma);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,4 +58,6 @@ public interface TmTaskAgreementMapper {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteTmTaskAgreementByTaskIds(Long[] taskIds);
|
int deleteTmTaskAgreementByTaskIds(Long[] taskIds);
|
||||||
|
|
||||||
|
String getAgreementId(String taskId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,11 +95,6 @@ public interface TmTaskMapper {
|
||||||
*/
|
*/
|
||||||
String selectTaskNumByMonths(Date nowDate, Integer taskType);
|
String selectTaskNumByMonths(Date nowDate, Integer taskType);
|
||||||
|
|
||||||
// List<TmTaskRequestVo> getAuditListByLeaseTmTask(@Param("record") TmTaskRequestVo tmTaskRequestVo);
|
int updateTaskStatus(@Param("taskId") String taskId, @Param("status")int status);
|
||||||
//
|
|
||||||
// List<TmTaskRequestVo> getAuditListByLeaseTmTaskByPeople(@Param("record") TmTaskRequestVo tmTaskRequestVo);
|
|
||||||
//
|
|
||||||
// List<LeaseApplyInfo> getAuditListByLeaseInfo(@Param("record") TmTaskRequestVo record);
|
|
||||||
//
|
|
||||||
// List<LeaseApplyDetails> getLeaseApplyDetails(@Param("record") LeaseApplyInfo record);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,4 +125,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="selectNumByMonth" resultType="java.lang.Integer">
|
<select id="selectNumByMonth" resultType="java.lang.Integer">
|
||||||
select count(*) from bm_agreement_info where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m')
|
select count(*) from bm_agreement_info where DATE_FORMAT(create_time,'%y%m') = DATE_FORMAT(#{date},'%y%m')
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getProtocol" resultType="java.lang.String">
|
||||||
|
select protocol
|
||||||
|
from bm_agreement_info
|
||||||
|
where agreement_id = #{agreementId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -188,4 +188,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
WHERE
|
WHERE
|
||||||
parent_id = #{record.parentId} and type_id = #{record.typeId}
|
parent_id = #{record.parentId} and type_id = #{record.typeId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<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
|
||||||
|
FROM lease_apply_details
|
||||||
|
WHERE id = #{id} AND (pre_num - IFNULL(al_num, 0)) > 0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -191,4 +191,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="getTaskId" resultType="java.lang.String">
|
||||||
|
select task_id
|
||||||
|
from lease_apply_info
|
||||||
|
where id = #{parentId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -55,90 +55,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertLeaseOutDetails" parameterType="com.bonus.material.lease.domain.LeaseOutDetails" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertLeaseOutDetails" parameterType="com.bonus.material.lease.domain.LeaseOutDetails" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into lease_out_details
|
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="parentId != null">parent_id,</if>
|
|
||||||
<if test="typeId != null">type_id,</if>
|
|
||||||
<if test="maId != null">ma_id,</if>
|
|
||||||
<if test="outNum != null">out_num,</if>
|
|
||||||
<if test="outType != null">out_type,</if>
|
|
||||||
<if test="createBy != null">create_by,</if>
|
|
||||||
<if test="createTime != null">create_time,</if>
|
|
||||||
<if test="updateBy != null">update_by,</if>
|
|
||||||
<if test="updateTime != null">update_time,</if>
|
|
||||||
<if test="remark != null">remark,</if>
|
|
||||||
<if test="companyId != null">company_id,</if>
|
|
||||||
<if test="carCode != null">car_code,</if>
|
|
||||||
<if test="pushNotifications != null">push_notifications,</if>
|
|
||||||
</trim>
|
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
||||||
<if test="parentId != null">#{parentId},</if>
|
|
||||||
<if test="typeId != null">#{typeId},</if>
|
|
||||||
<if test="maId != null">#{maId},</if>
|
|
||||||
<if test="outNum != null">#{outNum},</if>
|
|
||||||
<if test="outType != null">#{outType},</if>
|
|
||||||
<if test="createBy != null">#{createBy},</if>
|
|
||||||
<if test="createTime != null">#{createTime},</if>
|
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
|
||||||
<if test="remark != null">#{remark},</if>
|
|
||||||
<if test="companyId != null">#{companyId},</if>
|
|
||||||
<if test="carCode != null">#{carCode},</if>
|
|
||||||
<if test="pushNotifications != null">#{pushNotifications},</if>
|
|
||||||
</trim>
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
<update id="updateLeaseOutDetails" parameterType="com.bonus.material.lease.domain.LeaseOutDetails">
|
|
||||||
update lease_out_details
|
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
|
||||||
<if test="parentId != null">parent_id = #{parentId},</if>
|
|
||||||
<if test="typeId != null">type_id = #{typeId},</if>
|
|
||||||
<if test="maId != null">ma_id = #{maId},</if>
|
|
||||||
<if test="outNum != null">out_num = #{outNum},</if>
|
|
||||||
<if test="outType != null">out_type = #{outType},</if>
|
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
|
||||||
<if test="companyId != null">company_id = #{companyId},</if>
|
|
||||||
<if test="carCode != null">car_code = #{carCode},</if>
|
|
||||||
<if test="pushNotifications != null">push_notifications = #{pushNotifications},</if>
|
|
||||||
</trim>
|
|
||||||
where id = #{id}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<delete id="deleteLeaseOutDetailsById" parameterType="Long">
|
|
||||||
delete from lease_out_details where id = #{id}
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<delete id="deleteLeaseOutDetailsByIds" parameterType="String">
|
|
||||||
delete from lease_out_details where id in
|
|
||||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
||||||
#{id}
|
|
||||||
</foreach>
|
|
||||||
</delete>
|
|
||||||
|
|
||||||
<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
|
|
||||||
FROM lease_apply_details
|
|
||||||
WHERE id = #{id} AND (pre_num - IFNULL(al_num, 0)) > 0
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getTaskId" resultType="java.lang.String">
|
|
||||||
select task_id
|
|
||||||
from lease_apply_info
|
|
||||||
where id = #{parentId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<update id="updateTaskStatus">
|
|
||||||
update tm_task
|
|
||||||
set task_status = #{status},
|
|
||||||
update_time = NOW()
|
|
||||||
where task_id = #{taskId}
|
|
||||||
</update>
|
|
||||||
|
|
||||||
<insert id="insertSelective">
|
|
||||||
insert into lease_out_details
|
insert into lease_out_details
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
<if test="parentId!= null">
|
<if test="parentId!= null">
|
||||||
|
|
@ -210,57 +126,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="getSltAgreementInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
<update id="updateLeaseOutDetails" parameterType="com.bonus.material.lease.domain.LeaseOutDetails">
|
||||||
SELECT
|
update lease_out_details
|
||||||
id,
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
agreement_id AS agreementId,
|
<if test="parentId != null">parent_id = #{parentId},</if>
|
||||||
type_id AS typeId,
|
<if test="typeId != null">type_id = #{typeId},</if>
|
||||||
ma_id AS maId,
|
<if test="maId != null">ma_id = #{maId},</if>
|
||||||
num AS num,
|
<if test="outNum != null">out_num = #{outNum},</if>
|
||||||
start_time AS startTime,
|
<if test="outType != null">out_type = #{outType},</if>
|
||||||
end_time AS endTime,
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
status AS status,
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
lease_id AS leaseId,
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
back_id AS backId,
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
lease_price AS leasePrice,
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
buy_price AS buyPrice,
|
<if test="companyId != null">company_id = #{companyId},</if>
|
||||||
company_id AS companyId
|
<if test="carCode != null">car_code = #{carCode},</if>
|
||||||
FROM
|
<if test="pushNotifications != null">push_notifications = #{pushNotifications},</if>
|
||||||
slt_agreement_info
|
</trim>
|
||||||
WHERE
|
|
||||||
lease_id = #{parentId}
|
|
||||||
AND
|
|
||||||
type_id = #{typeId}
|
|
||||||
AND
|
|
||||||
ma_id IS NULL
|
|
||||||
AND
|
|
||||||
status = '0'
|
|
||||||
AND
|
|
||||||
DATE(start_time) = CURDATE();
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<update id="updSltInfo">
|
|
||||||
update slt_agreement_info
|
|
||||||
set num = #{num},
|
|
||||||
update_time = now()
|
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="getAgreementId" resultType="java.lang.String">
|
<delete id="deleteLeaseOutDetailsById" parameterType="Long">
|
||||||
select agreement_id
|
delete from lease_out_details where id = #{id}
|
||||||
from tm_task_agreement
|
</delete>
|
||||||
where task_id = #{taskId}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getProtocol" resultType="java.lang.String">
|
<delete id="deleteLeaseOutDetailsByIds" parameterType="String">
|
||||||
select protocol
|
delete from lease_out_details where id in
|
||||||
from bm_agreement_info
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
where agreement_id = #{agreementId}
|
#{id}
|
||||||
</select>
|
</foreach>
|
||||||
|
</delete>
|
||||||
<insert id="insSltInfo">
|
|
||||||
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time)
|
|
||||||
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now());
|
|
||||||
</insert>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -135,4 +135,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="getSltAgreementInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
agreement_id AS agreementId,
|
||||||
|
type_id AS typeId,
|
||||||
|
ma_id AS maId,
|
||||||
|
num AS num,
|
||||||
|
start_time AS startTime,
|
||||||
|
end_time AS endTime,
|
||||||
|
status AS status,
|
||||||
|
lease_id AS leaseId,
|
||||||
|
back_id AS backId,
|
||||||
|
lease_price AS leasePrice,
|
||||||
|
buy_price AS buyPrice,
|
||||||
|
company_id AS companyId
|
||||||
|
FROM
|
||||||
|
slt_agreement_info
|
||||||
|
WHERE
|
||||||
|
lease_id = #{parentId}
|
||||||
|
AND
|
||||||
|
type_id = #{typeId}
|
||||||
|
AND
|
||||||
|
ma_id IS NULL
|
||||||
|
AND
|
||||||
|
status = '0'
|
||||||
|
AND
|
||||||
|
DATE(start_time) = CURDATE();
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updSltInfo">
|
||||||
|
update slt_agreement_info
|
||||||
|
set num = #{num},
|
||||||
|
update_time = now()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="insSltInfo">
|
||||||
|
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time)
|
||||||
|
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now());
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -60,4 +60,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{taskId}
|
#{taskId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="getAgreementId" resultType="java.lang.String">
|
||||||
|
select agreement_id
|
||||||
|
from tm_task_agreement
|
||||||
|
where task_id = #{taskId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -132,4 +132,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
ORDER BY create_time DESC LIMIT 1
|
ORDER BY create_time DESC LIMIT 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<update id="updateTaskStatus">
|
||||||
|
update tm_task
|
||||||
|
set task_status = #{status},
|
||||||
|
update_time = NOW()
|
||||||
|
where task_id = #{taskId}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue