shichongfu
2023-04-25 ce0b49552668d3331055e2b1a1447a743dc54939
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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;
 
    }
 
}