This commit is contained in:
linfso 2024-07-18 20:16:26 +08:00
parent 4217326bfc
commit f0462521c4
6 changed files with 77 additions and 1 deletions

View File

@ -76,6 +76,20 @@ public class EmisExchangeRateController extends BaseController
}
@GetMapping("/getValidExchangeRate")
public AjaxResult getValidExchangeRate(String from,String to)
{
EmisExchangeRate emisExchangeRate=emisExchangeRateService.getValidExchangeRate(from,to);
float rate=0.0f;
if(emisExchangeRate!=null){
rate=Float.valueOf(emisExchangeRate.getRate());
}
return AjaxResult.success("获取成功",rate);
}
/**
* 导出汇率维护列表
*/

View File

@ -13,6 +13,8 @@ package com.xdadan.erp.emis.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xdadan.erp.emis.domain.EmisExchangeRate;
import org.apache.ibatis.annotations.Param;
/**
* @ClassName EmisExchangeRateMapper
* @Description <p> 汇率维护 Mapper 接口 </p>
@ -44,7 +46,9 @@ public interface EmisExchangeRateMapper extends BaseMapper<EmisExchangeRate>
* @return 数量
*/
public int checkUnique(EmisExchangeRate emisExchangeRate);
public EmisExchangeRate getValidExchangeRate(@Param("from") String from,@Param("from") String to);
/**
* 新增

View File

@ -44,6 +44,14 @@ public interface IEmisExchangeRateService
*/
public int checkUnique(EmisExchangeRate emisExchangeRate);
/**
* 获取有效汇率
* @param from
* @param to
* @return
*/
public EmisExchangeRate getValidExchangeRate(String from, String to);
/**
* 新增汇率维护
*

View File

@ -66,6 +66,12 @@ public class EmisExchangeRateServiceImpl implements IEmisExchangeRateService
return emisExchangeRateMapper.checkUnique(emisExchangeRate);
}
@Override
public EmisExchangeRate getValidExchangeRate(String from, String to)
{
return emisExchangeRateMapper.getValidExchangeRate(from, to);
}
/**
* 新增汇率维护
*

View File

@ -67,6 +67,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from emis_exchange_rate a
where a.id = #{id}
</select>
<select id="getValidExchangeRate" parameterType="String" resultMap="EmisExchangeRateResult">
select id, currency, dest_currency, rate, start_date, end_date, bl_valid, del_flag, create_by, create_time, update_by, update_time, remark, create_site, update_site
from emis_exchange_rate a
where a.currency=#{from} and a.dest_currency=#{to}
and start_date <![CDATA[ <= ]]> now() and now() <![CDATA[ <= ]]> end_date
</select>
<insert id="insertEmisExchangeRate" parameterType="EmisExchangeRate" useGeneratedKeys="true" keyProperty="id">
insert into emis_exchange_rate

View File

@ -1074,12 +1074,22 @@
<where>
a.del_flag='0' and order_status !='0'
<if test="sendSiteCode != null and sendSiteCode != ''"> and a.send_site_code= #{sendSiteCode}</if>
<if test="sendCenterCode != null and sendCenterCode != ''"> and a.send_center_code= #{sendCenterCode}</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''">
and a.dispatch_underling_site_code= #{dispatchUnderlingSiteCode}
</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''">
and a.destination_center_code= #{destinationCenterCode}
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
<if test="params.endSendDate != null and params.endSendDate != ''">
and a.send_date <![CDATA[ <= ]]> #{params.endSendDate}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code in (
@ -1090,6 +1100,15 @@
UNION
SELECT #{params.privSiteCode} FROM dual
)
or
a.dispatch_underling_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
)
</if>
@ -1121,6 +1140,14 @@
<where>
a.del_flag='0' and order_status !='0'
<if test="sendSiteCode != null and sendSiteCode != ''"> and a.send_site_code= #{sendSiteCode}</if>
<if test="sendCenterCode != null and sendCenterCode != ''"> and a.send_center_code= #{sendCenterCode}</if>
<if test="dispatchUnderlingSiteCode != null and dispatchUnderlingSiteCode != ''">
and a.dispatch_underling_site_code= #{dispatchUnderlingSiteCode}
</if>
<if test="destinationCenterCode != null and destinationCenterCode != ''">
and a.destination_center_code= #{destinationCenterCode}
</if>
<if test="params.beginSendDate != null and params.beginSendDate != ''">
and a.send_date <![CDATA[ >= ]]> #{params.beginSendDate}
</if>
@ -1129,6 +1156,15 @@
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and (
a.send_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=
#{params.privSiteCode} ) pd
WHERE FIND_IN_SET( parent_site_code, @pid ) > 0 AND @pid := concat(@pid,',',site_code)
UNION
SELECT #{params.privSiteCode} FROM dual
)
or
a.dispatch_underling_site_code in (
SELECT t1.site_code FROM (
SELECT * FROM emis_site WHERE parent_site_code IS NOT NULL ) t1,( SELECT @pid :=