package com.product.org.admin.service;
|
|
import java.text.DecimalFormat;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import com.product.admin.config.CmnConst;
|
import com.product.core.dao.BaseDao;
|
import com.product.core.entity.DataTableEntity;
|
import com.product.core.entity.FieldSetEntity;
|
import com.product.core.exception.BaseException;
|
import com.product.core.service.support.AbstractBaseService;
|
|
|
/**
|
*
|
* Copyright LX-BASE
|
*
|
* @Title: CompanyExchangeRateService
|
* @Project: LX-BASE-SERVER
|
* @Date: 2020年5月29日 上午11:05:27
|
* @Author: 郑盟
|
* @Description:单位汇率配置,对应单位汇率表
|
*/
|
@Component
|
public class CompanyExchangeRateService extends AbstractBaseService {
|
@Autowired
|
public BaseDao baseDao;
|
|
public FieldSetEntity findEmailSmtp(FieldSetEntity fs) throws BaseException {
|
return baseDao.getFieldSetEntity(CmnConst.PRODUCT_SYS_COMPANY_EXCHANGE_RATE, fs.getString("uuid"), false);
|
}
|
|
public boolean deleteEmailList(FieldSetEntity fs) throws BaseException {
|
return baseDao.delete(CmnConst.PRODUCT_SYS_COMPANY_EXCHANGE_RATE, "uuid=?", new String[] { fs.getString("uuid") });
|
}
|
public boolean deleteLevelsEmailList(FieldSetEntity fs) throws BaseException {
|
return baseDao.delete(CmnConst.PRODUCT_SYS_COMPANY_EXCHANGE_RATE, "org_level_uuid=?", new String[] { fs.getString(CmnConst.ORG_LEVEL_UUID) });
|
}
|
/**
|
* 汇率列表 inverse计算得到
|
* @param : fs org_level_uuid单位uuid
|
* @return :DataTableEntity
|
*/
|
public DataTableEntity listEmailSmtp(FieldSetEntity fs) throws BaseException {
|
DataTableEntity listTable = baseDao.listTable(CmnConst.PRODUCT_SYS_COMPANY_EXCHANGE_RATE, "org_level_uuid=?",
|
new String[] { fs.getString(CmnConst.ORG_LEVEL_UUID) }, null, null, fs.getInteger(CmnConst.PAGESIZE),
|
fs.getInteger(CmnConst.CPAGE), false);
|
for (int i = 0; i < listTable.getRows(); i++) {
|
Double inverse = 1 / listTable.getDouble(i, "exchange_rate");
|
DecimalFormat df=new DecimalFormat("0.0000");//设置保留位数
|
listTable.setFieldValue(i, "inverse",df.format(inverse));
|
}
|
|
return listTable;
|
|
}
|
|
}
|